File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
Original file line number Diff line number Diff line change @@ -853,28 +853,19 @@ load_timedelta(zoneinfo_state *state, long seconds)
853
853
if (pyoffset == NULL ) {
854
854
return NULL ;
855
855
}
856
- rv = PyDict_GetItemWithError (state -> TIMEDELTA_CACHE , pyoffset );
857
- if (rv == NULL ) {
858
- if (PyErr_Occurred ()) {
859
- goto error ;
860
- }
856
+ if (PyDict_GetItemRef (state -> TIMEDELTA_CACHE , pyoffset , & rv ) == 0 ) {
861
857
PyObject * tmp = PyDateTimeAPI -> Delta_FromDelta (
862
858
0 , seconds , 0 , 1 , PyDateTimeAPI -> DeltaType );
863
859
864
- if (tmp == NULL ) {
865
- goto error ;
860
+ if (tmp != NULL ) {
861
+ rv = PyDict_SetDefault (state -> TIMEDELTA_CACHE , pyoffset , tmp );
862
+ Py_XINCREF (rv );
863
+ Py_DECREF (tmp );
866
864
}
867
-
868
- rv = PyDict_SetDefault (state -> TIMEDELTA_CACHE , pyoffset , tmp );
869
- Py_DECREF (tmp );
870
865
}
871
866
872
- Py_XINCREF (rv );
873
867
Py_DECREF (pyoffset );
874
868
return rv ;
875
- error :
876
- Py_DECREF (pyoffset );
877
- return NULL ;
878
869
}
879
870
880
871
/* Constructor for _ttinfo object - this starts by initializing the _ttinfo
You can’t perform that action at this time.
0 commit comments