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
python cannot parse tcl value #66080
Comments
Lib/test/test_tcl.py fails with: test test_tcl failed -- Traceback (most recent call last):
File "/home/abuild/rpmbuild/BUILD/Python-2.7.7/Lib/test/test_tcl.py", line 430
, in test_user_command
check(float('nan'), 'NaN', eq=nan_eq)
File "/home/abuild/rpmbuild/BUILD/Python-2.7.7/Lib/test/test_tcl.py", line 397
, in check
eq(result[0], expected2)
File "/home/abuild/rpmbuild/BUILD/Python-2.7.7/Lib/test/test_tcl.py", line 405
, in nan_eq
actual = float(actual)
ValueError: invalid literal for float(): NaN(7ffffffffffff) |
What version of Tcl are you using and on what platform? |
You will see this on any architecture where the canonical NaN has all bits set (or a subset of them). This include mips and m68k. |
Interesting, what result of getdouble? >>> import _tkinter
>>> tk = _tkinter.create()
>>> nan = float('nan')
>>> tk.getdouble(nan)
nan What returns getdouble() (note that _tkinter is imported instead of tkinter!) for NaN value? |
>>> _tkinter.create().getdouble(float('nan'))
nan |
Here is a patch which omits using of float() to convert Tcl's NaN values. |
Thanks, this is working now. |
New changeset 4514804d0e50 by Serhiy Storchaka in branch '2.7': New changeset 4879f6337ef6 by Serhiy Storchaka in branch '3.4': New changeset 72289f574664 by Serhiy Storchaka in branch 'default': |
New changeset 01ec8bb7187f by Serhiy Storchaka in branch '2.7': New changeset 5ac811cbec87 by Serhiy Storchaka in branch '3.4': New changeset f138a74ee611 by Serhiy Storchaka in branch 'default': |
On some platforms NaN representation has a minus before "nan" (see http://buildbot.python.org/all/builders/x86%20OpenIndiana%202.7/builds/2384/steps/test/logs/stdio). So it is easier just omit tests for these platform-specific values. Regardless of the fact that it is very unlikely to get NaN in Tk, in future we should fix getdouble() (it should work with Tcl_Obj) and use it everywhere in tkinter instead of float(). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: