File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6330,6 +6330,9 @@ local_timezone_from_timestamp(time_t timestamp)
63306330 struct tm local_time_tm ;
63316331 PyObject * nameo = NULL ;
63326332 const char * zone = NULL ;
6333+ #ifndef HAVE_STRUCT_TM_TM_ZONE
6334+ char buf [100 ]; // for zone, which is used after the block below
6335+ #endif
63336336
63346337 if (_PyTime_localtime (timestamp , & local_time_tm ) != 0 )
63356338 return NULL ;
@@ -6340,9 +6343,9 @@ local_timezone_from_timestamp(time_t timestamp)
63406343 {
63416344 PyObject * local_time , * utc_time ;
63426345 struct tm utc_time_tm ;
6343- char buf [ 100 ];
6344- strftime ( buf , sizeof ( buf ), "%Z" , & local_time_tm ) ;
6345- zone = buf ;
6346+ if ( strftime ( buf , sizeof ( buf ), "%Z" , & local_time_tm ) != 0 ) {
6347+ zone = buf ;
6348+ }
63466349 local_time = new_datetime (local_time_tm .tm_year + 1900 ,
63476350 local_time_tm .tm_mon + 1 ,
63486351 local_time_tm .tm_mday ,
@@ -6352,8 +6355,10 @@ local_timezone_from_timestamp(time_t timestamp)
63526355 if (local_time == NULL ) {
63536356 return NULL ;
63546357 }
6355- if (_PyTime_gmtime (timestamp , & utc_time_tm ) != 0 )
6358+ if (_PyTime_gmtime (timestamp , & utc_time_tm ) != 0 ) {
6359+ Py_DECREF (local_time );
63566360 return NULL ;
6361+ }
63576362 utc_time = new_datetime (utc_time_tm .tm_year + 1900 ,
63586363 utc_time_tm .tm_mon + 1 ,
63596364 utc_time_tm .tm_mday ,
You can’t perform that action at this time.
0 commit comments