Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mis-parsing date in inline table with trailing spaces #438

Open
programmerjake opened this issue Mar 1, 2024 · 0 comments
Open

mis-parsing date in inline table with trailing spaces #438

programmerjake opened this issue Mar 1, 2024 · 0 comments

Comments

@programmerjake
Copy link

for toml==0.10.2:

import toml
toml.loads('a={b=2024-01-01 }')

incorrectly produces the following error:

Traceback (most recent call last):
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 512, in loads
    multibackslash)
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 778, in load_line
    value, vtype = self.load_value(pair[1], strictly_valid)
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 883, in load_value
    self.load_inline_object(v, inline_object)
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 680, in load_inline_object
    multibackslash)
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 737, in load_line
    raise ValueError("Invalid date or number")
ValueError: Invalid date or number

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 514, in loads
    raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Invalid date or number (line 1 column 1 char 0)
>>> toml.loads('a={b=2024-01-01 }')
Traceback (most recent call last):
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 512, in loads
    multibackslash)
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 778, in load_line
    value, vtype = self.load_value(pair[1], strictly_valid)
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 883, in load_value
    self.load_inline_object(v, inline_object)
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 680, in load_inline_object
    multibackslash)
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 737, in load_line
    raise ValueError("Invalid date or number")
ValueError: Invalid date or number

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<venv-path>/lib/python3.7/site-packages/toml/decoder.py", line 514, in loads
    raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Invalid date or number (line 1 column 1 char 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant