[pypy-commit] pypy py3.6: fix 194165a1cae6
mattip
pypy.commits at gmail.com
Wed May 22 12:00:14 EDT 2019
Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.6
Changeset: r96659:e9bfcbb9043c
Date: 2019-05-22 18:59 +0300
http://bitbucket.org/pypy/pypy/changeset/e9bfcbb9043c/
Log: fix 194165a1cae6
diff --git a/lib-python/3/datetime.py b/lib-python/3/datetime.py
--- a/lib-python/3/datetime.py
+++ b/lib-python/3/datetime.py
@@ -6,6 +6,7 @@
import time as _time
import math as _math
+import sys
# for cpyext, use these as base classes
from __pypy__._pypydatetime import dateinterop, deltainterop, timeinterop
@@ -1379,7 +1380,8 @@
def __new__(cls, year, month=None, day=None, hour=0, minute=0, second=0,
microsecond=0, tzinfo=None, *, fold=0):
- if isinstance(year, bytes) and len(year) == 10 and 1 <= year[2]&0x7F <= 12:
+ if (isinstance(year, (bytes, str)) and len(year) == 10 and
+ 1 <= ord(year[2:3])&0x7F <= 12):
# Pickle support
self = dateinterop.__new__(cls)
self.__setstate(year, month)
More information about the pypy-commit
mailing list