python-babel / babel

The official repository for Babel, the Python Internationalization Library
http://babel.pocoo.org/
BSD 3-Clause "New" or "Revised" License
1.29k stars 433 forks source link

parse_date() "ParseError: No numbers were found in input" Python 3.6 and newer #1032

Open photodude opened 9 months ago

photodude commented 9 months ago

Overview Description

A traceback happens due to a parsing error in babel parse_date() if the input is string. This is inconsistent with older versions of python 3.5 and older work as expected

Steps to Reproduce

I'm not sure how to describe the replication of this issue, but please see the following appveyor build https://ci.appveyor.com/project/j4321/tkcalendar/builds/48195627

Actual Results

Traceback (most recent call last):
  File "C:\projects\tkcalendar\tests\test_calendar.py", line 228, in test_calendar_textvariable 
  year=2015, month=1, day=3, textvariable=var)
  File "C:\projects\tkcalendar\tkcalendar\calendar_.py", line 268, in __init__
    self._sel_date = parse_date(self._textvariable.get(), locale)
  File "C:\PYTHON36\lib\site-packages\babel\dates.py", line 1201, in parse_date
    raise ParseError("No numbers were found in input")
babel.dates.ParseError: No numbers were found in input

Expected Results

date parsed from string input

Reproducibility

Additional Information

CI testing in Appveyor Visual Studio 2022 image py3.6 => Babel 2.11.0 py3.7 => Babel 2.13.0 py3.8 => Babel 2.13.0 py3.9 => Babel 2.13.0 py3.10 => Babel 2.13.0 py3.11 => Babel 2.13.0

akx commented 8 months ago

Can you share what the input (self._textvariable.get()) there had been, and what locale was?

FWIW, I think this is more a change between babel-2.9.1 and babel-2.11.0 than related to Python versions :)

photodude commented 8 months ago

hi @akx as far as I can tell the input is from nose unit tests in tkcalendar\tests\test_calendar.py", line 228, in test_calendar_textvariable year=2015, month=1, day=3, textvariable=var) https://github.com/j4321/tkcalendar/blob/master/tests/test_calendar.py#L227

Sorry, I struggle running tests like this on local and working through debugging so I'm a bit blind to some things in python which I'm used to doing in C++.

I agree that it's something that changed between babel-2.9.1 and babel-2.11.0