(Translated by https://www.hiragana.jp/)
Failure to parse long float · Issue #55 · uiri/toml · GitHub
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

Failure to parse long float #55

Closed
rekka opened this issue Jul 19, 2016 · 3 comments
Closed

Failure to parse long float #55

rekka opened this issue Jul 19, 2016 · 3 comments

Comments

@rekka
Copy link

rekka commented Jul 19, 2016

Hi!

I'm using version 0.9.1 from pypi. The following fails:

>>> import toml
>>> toml.loads('x=0.1234567891234567891')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bertik/.local/lib/python2.7/site-packages/toml.py", line 331, in loads
    value, vtype = load_value(pair[1])
  File "/home/bertik/.local/lib/python2.7/site-packages/toml.py", line 453, in load_value
    parsed_date = load_date(v)
  File "/home/bertik/.local/lib/python2.7/site-packages/toml.py", line 350, in load_date
    tz = TomlTz(val[19:24])
  File "/home/bertik/.local/lib/python2.7/site-packages/toml.py", line 10, in __new__
    self._minutes = int(toml_offset[4:6])
ValueError: invalid literal for int() with base 10: ''

It seems that it is trying to parse a long float as a date.

Shorter floats of course work:

>>> toml.loads('x=0.123456789123456789')
{'x': 0.12345678912345678}
@uiri
Copy link
Owner

uiri commented Oct 28, 2016

This issue appears to be fixed in the latest version. Can you confirm whether or not it is present in release 0.9.2?

On Mon, Jul 18, 2016 at 05:34:31PM -0700, Norbert Pozar wrote:

Hi!

I'm using version 0.9.1 from pypi. The following fails:

>>> import toml
>>> toml.loads('x=0.1234567891234567891')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bertik/.local/lib/python2.7/site-packages/toml.py", line 331, in loads
    value, vtype = load_value(pair[1])
  File "/home/bertik/.local/lib/python2.7/site-packages/toml.py", line 453, in load_value
    parsed_date = load_date(v)
  File "/home/bertik/.local/lib/python2.7/site-packages/toml.py", line 350, in load_date
    tz = TomlTz(val[19:24])
  File "/home/bertik/.local/lib/python2.7/site-packages/toml.py", line 10, in __new__
    self._minutes = int(toml_offset[4:6])
ValueError: invalid literal for int() with base 10: ''

It seems that it is trying to parse a long float as a date.

Shorter floats of course work:

>>> toml.loads('x=0.123456789123456789')
{'x': 0.12345678912345678}

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#55

@rekka
Copy link
Author

rekka commented Oct 30, 2016

Seems to be fixed in 0.9.2:

import toml
toml.loads('x=0.1234567891234567891')
{u'x': 0.12345678912345678}

@uiri
Copy link
Owner

uiri commented Oct 30, 2016

Thanks for confirming!
Closed as FIXED.

@uiri uiri closed this as completed Oct 30, 2016
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

2 participants