[Zope-Checkins] CVS: Zope/lib/python/DateTime - DateTime.py:1.90
Chris McDonough
cvs-admin at zope.org
Tue Nov 4 17:03:29 EST 2003
Update of /cvs-repository/Zope/lib/python/DateTime
In directory cvs.zope.org:/tmp/cvs-serv25686
Modified Files:
DateTime.py
Log Message:
In Python 2.3, the int callable can return a long. This breaks code
that depends on it to raise an OverflowError when presented with a
number above sys.maxint. We work around it here.
=== Zope/lib/python/DateTime/DateTime.py 1.89 => 1.90 ===
--- Zope/lib/python/DateTime/DateTime.py:1.89 Tue Oct 21 09:40:45 2003
+++ Zope/lib/python/DateTime/DateTime.py Tue Nov 4 17:03:28 2003
@@ -393,6 +393,8 @@
'''gmtime with a safety zone.'''
try:
t_int = int(t)
+ if isinstance(t_int, long):
+ raise OverflowError # Python 2.3 fix: int can return a long!
return gmtime(t_int)
except (IOError, OverflowError):
raise 'TimeError', 'The time %f is beyond the range ' \
@@ -402,6 +404,8 @@
'''localtime with a safety zone.'''
try:
t_int = int(t)
+ if isinstance(t_int, long):
+ raise OverflowError # Python 2.3 fix: int can return a long!
except OverflowError:
raise 'TimeError', 'The time %f is beyond the range ' \
'of this Python implementation.' % float(t)
More information about the Zope-Checkins
mailing list