Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#12372 closed defect (fixed)

OverflowError: signed integer is greater than maximum

Reported by: Ryan J Ollos Owned by: Jun Omae
Priority: normal Milestone: 1.0.11
Component: timeline Version: 1.0
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix parse_date() raising OverflowError for large integer part.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

From the logs:

2016-02-15 16:54:12,734 Trac[main] ERROR: Internal Server Error: <RequestWithSession "GET '/timeline?daysback=7&authors=&from=2010-12-122121121121212.1'">, referrer None
Traceback (most recent call last):
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/web/main.py", line 554, in _dispatch_request
    dispatcher.dispatch(req)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/web/main.py", line 247, in dispatch
    resp = chosen_handler.process_request(req)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/timeline/web_ui.py", line 115, in process_request
    precisedate = user_time(req, parse_date, reqfromdate)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/util/datefmt.py", line 793, in user_time
    return func(*args, **kwargs)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/util/datefmt.py", line 518, in parse_date
    dt = _i18n_parse_date(text, tzinfo, locale)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/util/datefmt.py", line 646, in _i18n_parse_date
    month_names, tzinfo)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/util/datefmt.py", line 702, in _i18n_parse_date_0
    t = tzinfo.localize(datetime(*(values[k] for k in 'yMdhms')))
OverflowError: signed integer is greater than maximum

Related to #12007.

Attachments (0)

Change History (5)

comment:1 by Jun Omae, 5 years ago

Owner: set to Jun Omae
Status: newassigned
Version: 1.0

Good catch. parse_date() should catch OverflowError.

>>> parse_date('Jan 2147483647, 2016', locale='en_US')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/venv/trac/1.0/lib/python2.5/site-packages/trac/util/datefmt.py", line 477, in parse_date
    date=text, hint=hint), _('Invalid Date'))
trac.core.TracError: "2147483647 Jan, 2016" is an invalid date, or the date format is not known. Try "MMM d, yyyy" instead.
>>> parse_date('Jan 2147483648, 2016', locale='en_US')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/venv/trac/1.0/lib/python2.5/site-packages/trac/util/datefmt.py", line 458, in parse_date
    dt = _i18n_parse_date(text, tzinfo, locale)
  File "/venv/trac/1.0/lib/python2.5/site-packages/trac/util/datefmt.py", line 571, in _i18n_parse_date
    month_names, tzinfo)
  File "/venv/trac/1.0/lib/python2.5/site-packages/trac/util/datefmt.py", line 627, in _i18n_parse_date_0
    t = tzinfo.localize(datetime(*(values[k] for k in 'yMdhms')))
OverflowError: signed integer is greater than maximum
>>> parse_date('Jan 9223372036854775808, 2016', locale='en_US')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/venv/trac/1.0/lib/python2.5/site-packages/trac/util/datefmt.py", line 458, in parse_date
    dt = _i18n_parse_date(text, tzinfo, locale)
  File "/venv/trac/1.0/lib/python2.5/site-packages/trac/util/datefmt.py", line 571, in _i18n_parse_date
    month_names, tzinfo)
  File "/venv/trac/1.0/lib/python2.5/site-packages/trac/util/datefmt.py", line 627, in _i18n_parse_date_0
    t = tzinfo.localize(datetime(*(values[k] for k in 'yMdhms')))
OverflowError: long int too large to convert to int

comment:2 by Jun Omae, 5 years ago

comment:3 by Ryan J Ollos, 5 years ago

Description: modified (diff)

Changes look good. Thanks for fixing!

comment:4 by Jun Omae, 5 years ago

Thanks for the review! Also, added unit tests for #12007 ([9b9c8a56e/jomae.git]).

comment:5 by Jun Omae, 5 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [14594] and merged to trunk in [14595].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.