Skip to content
Prev Previous commit
Next Next commit
Remove _can_support_c99 from _pydatetime.py
  • Loading branch information
encukou committed Jul 1, 2025
commit edf4428a59eecb2b547c92a0e19d9bbf3c2743d0
13 changes: 1 addition & 12 deletions Lib/_pydatetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,6 @@ def _need_normalize_century():
_normalize_century = True
return _normalize_century

_supports_c99 = None
def _can_support_c99():
global _supports_c99
if _supports_c99 is None:
try:
_supports_c99 = (
_time.strftime("%F", (1900, 1, 1, 0, 0, 0, 0, 1, 0)) == "1900-01-01")
except ValueError:
_supports_c99 = False
return _supports_c99

# Correctly substitute for %z and %Z escapes in strftime formats.
def _wrap_strftime(object, format, timetuple):
# Don't call utcoffset() or tzname() unless actually needed.
Expand Down Expand Up @@ -283,7 +272,7 @@ def _wrap_strftime(object, format, timetuple):
newformat.append(Zreplace)
# Note that datetime(1000, 1, 1).strftime('%G') == '1000' so
# year 1000 for %G can go on the fast path.
elif ((ch in 'YG' or ch in 'FC' and _can_support_c99()) and
elif ((ch in 'YG' or ch in 'FC') and
object.year < 1000 and _need_normalize_century()):
if ch == 'G':
year = int(_time.strftime("%G", timetuple))
Expand Down
Loading