File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6588,6 +6588,9 @@ local_timezone_from_timestamp(time_t timestamp)
65886588 struct tm local_time_tm ;
65896589 PyObject * nameo = NULL ;
65906590 const char * zone = NULL ;
6591+ #ifndef HAVE_STRUCT_TM_TM_ZONE
6592+ char buf [100 ]; // for zone, which is used after the block below
6593+ #endif
65916594
65926595 if (_PyTime_localtime (timestamp , & local_time_tm ) != 0 )
65936596 return NULL ;
@@ -6598,9 +6601,9 @@ local_timezone_from_timestamp(time_t timestamp)
65986601 {
65996602 PyObject * local_time , * utc_time ;
66006603 struct tm utc_time_tm ;
6601- char buf [ 100 ];
6602- strftime ( buf , sizeof ( buf ), "%Z" , & local_time_tm ) ;
6603- zone = buf ;
6604+ if ( strftime ( buf , sizeof ( buf ), "%Z" , & local_time_tm ) != 0 ) {
6605+ zone = buf ;
6606+ }
66046607 local_time = new_datetime (local_time_tm .tm_year + 1900 ,
66056608 local_time_tm .tm_mon + 1 ,
66066609 local_time_tm .tm_mday ,
@@ -6610,8 +6613,10 @@ local_timezone_from_timestamp(time_t timestamp)
66106613 if (local_time == NULL ) {
66116614 return NULL ;
66126615 }
6613- if (_PyTime_gmtime (timestamp , & utc_time_tm ) != 0 )
6616+ if (_PyTime_gmtime (timestamp , & utc_time_tm ) != 0 ) {
6617+ Py_DECREF (local_time );
66146618 return NULL ;
6619+ }
66156620 utc_time = new_datetime (utc_time_tm .tm_year + 1900 ,
66166621 utc_time_tm .tm_mon + 1 ,
66176622 utc_time_tm .tm_mday ,
You can’t perform that action at this time.
0 commit comments