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

python cannot parse tcl value #66080

Closed
andreas-schwab mannequin opened this issue Jun 29, 2014 · 10 comments
Closed

python cannot parse tcl value #66080

andreas-schwab mannequin opened this issue Jun 29, 2014 · 10 comments
Assignees
Labels
topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@andreas-schwab
Copy link
Mannequin

andreas-schwab mannequin commented Jun 29, 2014

BPO 21881
Nosy @serhiy-storchaka, @andreas-schwab
Files
  • test_tcl_nan.patch
  • 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:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2014-07-07.12:29:41.958>
    created_at = <Date 2014-06-29.19:38:46.769>
    labels = ['type-bug', 'expert-tkinter']
    title = 'python cannot parse tcl value'
    updated_at = <Date 2014-07-07.12:29:41.957>
    user = 'https://github.com/andreas-schwab'

    bugs.python.org fields:

    activity = <Date 2014-07-07.12:29:41.957>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2014-07-07.12:29:41.958>
    closer = 'serhiy.storchaka'
    components = ['Tkinter']
    creation = <Date 2014-06-29.19:38:46.769>
    creator = 'schwab'
    dependencies = []
    files = ['35864']
    hgrepos = []
    issue_num = 21881
    keywords = ['patch']
    message_count = 10.0
    messages = ['221887', '221947', '221973', '222297', '222299', '222340', '222345', '222445', '222455', '222456']
    nosy_count = 3.0
    nosy_names = ['python-dev', 'serhiy.storchaka', 'schwab']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue21881'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @andreas-schwab
    Copy link
    Mannequin Author

    andreas-schwab mannequin commented Jun 29, 2014

    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)

    @andreas-schwab andreas-schwab mannequin added topic-tkinter type-bug An unexpected behavior, bug, or error labels Jun 29, 2014
    @ned-deily
    Copy link
    Member

    What version of Tcl are you using and on what platform?

    @andreas-schwab
    Copy link
    Mannequin Author

    andreas-schwab mannequin commented Jun 30, 2014

    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.

    @serhiy-storchaka
    Copy link
    Member

    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?

    @serhiy-storchaka serhiy-storchaka self-assigned this Jul 4, 2014
    @andreas-schwab
    Copy link
    Mannequin Author

    andreas-schwab mannequin commented Jul 4, 2014

    >>> _tkinter.create().getdouble(float('nan'))
    nan

    @serhiy-storchaka
    Copy link
    Member

    Here is a patch which omits using of float() to convert Tcl's NaN values.

    @andreas-schwab
    Copy link
    Mannequin Author

    andreas-schwab mannequin commented Jul 5, 2014

    Thanks, this is working now.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 7, 2014

    New changeset 4514804d0e50 by Serhiy Storchaka in branch '2.7':
    Issue bpo-21881: Be more tolerant in test_tcl to not parsable by float() NaN
    http://hg.python.org/cpython/rev/4514804d0e50

    New changeset 4879f6337ef6 by Serhiy Storchaka in branch '3.4':
    Issue bpo-21881: Be more tolerant in test_tcl to not parsable by float() NaN
    http://hg.python.org/cpython/rev/4879f6337ef6

    New changeset 72289f574664 by Serhiy Storchaka in branch 'default':
    Issue bpo-21881: Be more tolerant in test_tcl to not parsable by float() NaN
    http://hg.python.org/cpython/rev/72289f574664

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 7, 2014

    New changeset 01ec8bb7187f by Serhiy Storchaka in branch '2.7':
    Issue bpo-21881: Just omit tests for platform-specific NaN representation in test_tcl.
    http://hg.python.org/cpython/rev/01ec8bb7187f

    New changeset 5ac811cbec87 by Serhiy Storchaka in branch '3.4':
    Issue bpo-21881: Just omit tests for platform-specific NaN representation in test_tcl.
    http://hg.python.org/cpython/rev/5ac811cbec87

    New changeset f138a74ee611 by Serhiy Storchaka in branch 'default':
    Issue bpo-21881: Just omit tests for platform-specific NaN representation in test_tcl.
    http://hg.python.org/cpython/rev/f138a74ee611

    @serhiy-storchaka
    Copy link
    Member

    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().

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants