diff --git a/product/ERP5Type/patches/Restricted.py b/product/ERP5Type/patches/Restricted.py index ee116fb0223ad3341329e80902ce8a528d16e82b..585b2a255f683ffc287fbd248d7b03b43067289f 100644 --- a/product/ERP5Type/patches/Restricted.py +++ b/product/ERP5Type/patches/Restricted.py @@ -360,6 +360,7 @@ allow_class_attribute(datetime.date) allow_class_attribute(datetime.time) allow_class_attribute(datetime.timedelta) allow_class_attribute(datetime.tzinfo) + # We need special care for datetime.datetime.strptime() in Python 2.7. # It is because datetime.datetime.strptime() imports _strptime by C function # PyImport_Import which calls @@ -370,6 +371,8 @@ allow_class_attribute(datetime.tzinfo) # This prevents both importing _strptime with level=0, and accessing __doc__, # when calling datetime.datetime.strptime(). import _strptime +# on python3 it seems we actually need to call strptime for this. +datetime.datetime.strptime('', '') # Allow dict.fromkeys, Only this method is a class method in dict module. allow_class_attribute(dict, {'fromkeys': 1})