@@ -69,92 +69,92 @@ cdef extern from "datetime.h":
69
69
70
70
ctypedef extern class datetime.date[object PyDateTime_Date]:
71
71
@property
72
- cdef inline int year(self ):
72
+ cdef inline int year(self ) noexcept :
73
73
return PyDateTime_GET_YEAR(self )
74
74
75
75
@property
76
- cdef inline int month(self ):
76
+ cdef inline int month(self ) noexcept :
77
77
return PyDateTime_GET_MONTH(self )
78
78
79
79
@property
80
- cdef inline int day(self ):
80
+ cdef inline int day(self ) noexcept :
81
81
return PyDateTime_GET_DAY(self )
82
82
83
83
ctypedef extern class datetime.time[object PyDateTime_Time]:
84
84
@property
85
- cdef inline int hour(self ):
85
+ cdef inline int hour(self ) noexcept :
86
86
return PyDateTime_TIME_GET_HOUR(self )
87
87
88
88
@property
89
- cdef inline int minute(self ):
89
+ cdef inline int minute(self ) noexcept :
90
90
return PyDateTime_TIME_GET_MINUTE(self )
91
91
92
92
@property
93
- cdef inline int second(self ):
93
+ cdef inline int second(self ) noexcept :
94
94
return PyDateTime_TIME_GET_SECOND(self )
95
95
96
96
@property
97
- cdef inline int microsecond(self ):
97
+ cdef inline int microsecond(self ) noexcept :
98
98
return PyDateTime_TIME_GET_MICROSECOND(self )
99
99
100
100
@property
101
101
cdef inline object tzinfo(self ):
102
102
return < object > PyDateTime_TIME_GET_TZINFO(self )
103
103
104
104
@property
105
- cdef inline int fold(self ):
105
+ cdef inline int fold(self ) noexcept :
106
106
# For Python < 3.6 this returns 0 no matter what
107
107
return PyDateTime_TIME_GET_FOLD(self )
108
108
109
109
ctypedef extern class datetime.datetime[object PyDateTime_DateTime]:
110
110
@property
111
- cdef inline int year(self ):
111
+ cdef inline int year(self ) noexcept :
112
112
return PyDateTime_GET_YEAR(self )
113
113
114
114
@property
115
- cdef inline int month(self ):
115
+ cdef inline int month(self ) noexcept :
116
116
return PyDateTime_GET_MONTH(self )
117
117
118
118
@property
119
- cdef inline int day(self ):
119
+ cdef inline int day(self ) noexcept :
120
120
return PyDateTime_GET_DAY(self )
121
121
122
122
@property
123
- cdef inline int hour(self ):
123
+ cdef inline int hour(self ) noexcept :
124
124
return PyDateTime_DATE_GET_HOUR(self )
125
125
126
126
@property
127
- cdef inline int minute(self ):
127
+ cdef inline int minute(self ) noexcept :
128
128
return PyDateTime_DATE_GET_MINUTE(self )
129
129
130
130
@property
131
- cdef inline int second(self ):
131
+ cdef inline int second(self ) noexcept :
132
132
return PyDateTime_DATE_GET_SECOND(self )
133
133
134
134
@property
135
- cdef inline int microsecond(self ):
135
+ cdef inline int microsecond(self ) noexcept :
136
136
return PyDateTime_DATE_GET_MICROSECOND(self )
137
137
138
138
@property
139
139
cdef inline object tzinfo(self ):
140
140
return < object > PyDateTime_DATE_GET_TZINFO(self )
141
141
142
142
@property
143
- cdef inline int fold(self ):
143
+ cdef inline int fold(self ) noexcept :
144
144
# For Python < 3.6 this returns 0 no matter what
145
145
return PyDateTime_DATE_GET_FOLD(self )
146
146
147
147
ctypedef extern class datetime.timedelta[object PyDateTime_Delta]:
148
148
@property
149
- cdef inline int day(self ):
149
+ cdef inline int day(self ) noexcept :
150
150
return PyDateTime_DELTA_GET_DAYS(self )
151
151
152
152
@property
153
- cdef inline int second(self ):
153
+ cdef inline int second(self ) noexcept :
154
154
return PyDateTime_DELTA_GET_SECONDS(self )
155
155
156
156
@property
157
- cdef inline int microsecond(self ):
157
+ cdef inline int microsecond(self ) noexcept :
158
158
return PyDateTime_DELTA_GET_MICROSECONDS(self )
159
159
160
160
ctypedef extern class datetime.tzinfo[object PyDateTime_TZInfo]:
@@ -279,7 +279,7 @@ cdef extern from "datetime.h":
279
279
280
280
# Datetime C API initialization function.
281
281
# You have to call it before any usage of DateTime CAPI functions.
282
- cdef inline void import_datetime():
282
+ cdef inline void import_datetime() noexcept :
283
283
PyDateTime_IMPORT
284
284
285
285
# Create date object using DateTime CAPI factory function.
@@ -337,84 +337,84 @@ cdef inline object datetime_tzinfo(object o):
337
337
return < object > PyDateTime_DATE_GET_TZINFO(o)
338
338
339
339
# Get year of date
340
- cdef inline int date_year(object o):
340
+ cdef inline int date_year(object o) noexcept :
341
341
return PyDateTime_GET_YEAR(o)
342
342
343
343
# Get month of date
344
- cdef inline int date_month(object o):
344
+ cdef inline int date_month(object o) noexcept :
345
345
return PyDateTime_GET_MONTH(o)
346
346
347
347
# Get day of date
348
- cdef inline int date_day(object o):
348
+ cdef inline int date_day(object o) noexcept :
349
349
return PyDateTime_GET_DAY(o)
350
350
351
351
# Get year of datetime
352
- cdef inline int datetime_year(object o):
352
+ cdef inline int datetime_year(object o) noexcept :
353
353
return PyDateTime_GET_YEAR(o)
354
354
355
355
# Get month of datetime
356
- cdef inline int datetime_month(object o):
356
+ cdef inline int datetime_month(object o) noexcept :
357
357
return PyDateTime_GET_MONTH(o)
358
358
359
359
# Get day of datetime
360
- cdef inline int datetime_day(object o):
360
+ cdef inline int datetime_day(object o) noexcept :
361
361
return PyDateTime_GET_DAY(o)
362
362
363
363
# Get hour of time
364
- cdef inline int time_hour(object o):
364
+ cdef inline int time_hour(object o) noexcept :
365
365
return PyDateTime_TIME_GET_HOUR(o)
366
366
367
367
# Get minute of time
368
- cdef inline int time_minute(object o):
368
+ cdef inline int time_minute(object o) noexcept :
369
369
return PyDateTime_TIME_GET_MINUTE(o)
370
370
371
371
# Get second of time
372
- cdef inline int time_second(object o):
372
+ cdef inline int time_second(object o) noexcept :
373
373
return PyDateTime_TIME_GET_SECOND(o)
374
374
375
375
# Get microsecond of time
376
- cdef inline int time_microsecond(object o):
376
+ cdef inline int time_microsecond(object o) noexcept :
377
377
return PyDateTime_TIME_GET_MICROSECOND(o)
378
378
379
379
# Get fold of time
380
- cdef inline int time_fold(object o):
380
+ cdef inline int time_fold(object o) noexcept :
381
381
# For Python < 3.6 this returns 0 no matter what
382
382
return PyDateTime_TIME_GET_FOLD(o)
383
383
384
384
# Get hour of datetime
385
- cdef inline int datetime_hour(object o):
385
+ cdef inline int datetime_hour(object o) noexcept :
386
386
return PyDateTime_DATE_GET_HOUR(o)
387
387
388
388
# Get minute of datetime
389
- cdef inline int datetime_minute(object o):
389
+ cdef inline int datetime_minute(object o) noexcept :
390
390
return PyDateTime_DATE_GET_MINUTE(o)
391
391
392
392
# Get second of datetime
393
- cdef inline int datetime_second(object o):
393
+ cdef inline int datetime_second(object o) noexcept :
394
394
return PyDateTime_DATE_GET_SECOND(o)
395
395
396
396
# Get microsecond of datetime
397
- cdef inline int datetime_microsecond(object o):
397
+ cdef inline int datetime_microsecond(object o) noexcept :
398
398
return PyDateTime_DATE_GET_MICROSECOND(o)
399
399
400
400
# Get fold of datetime
401
- cdef inline int datetime_fold(object o):
401
+ cdef inline int datetime_fold(object o) noexcept :
402
402
# For Python < 3.6 this returns 0 no matter what
403
403
return PyDateTime_DATE_GET_FOLD(o)
404
404
405
405
# Get days of timedelta
406
- cdef inline int timedelta_days(object o):
406
+ cdef inline int timedelta_days(object o) noexcept :
407
407
return (< PyDateTime_Delta* > o).days
408
408
409
409
# Get seconds of timedelta
410
- cdef inline int timedelta_seconds(object o):
410
+ cdef inline int timedelta_seconds(object o) noexcept :
411
411
return (< PyDateTime_Delta* > o).seconds
412
412
413
413
# Get microseconds of timedelta
414
- cdef inline int timedelta_microseconds(object o):
414
+ cdef inline int timedelta_microseconds(object o) noexcept :
415
415
return (< PyDateTime_Delta* > o).microseconds
416
416
417
- cdef inline double total_seconds(timedelta obj):
417
+ cdef inline double total_seconds(timedelta obj) noexcept :
418
418
# Mirrors the "timedelta.total_seconds()" method.
419
419
# Note that this implementation is not guaranteed to give *exactly* the same
420
420
# result as the original method, due to potential differences in floating point rounding.
0 commit comments