-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Support new booleans in Tkinter #65725
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
Comments
Recent Tcl versions (since 8.5) no longer use internal "boolean" type. Instead they use "booleanString" type (but looks as only internally). Here is a patch which add support for "booleanString" Tcl type in case when it leaks to user. There are no any new tests because there is no simple way (if any) to create pure Tcl boolean object. |
New changeset e9d86c1de292 by Serhiy Storchaka in branch 'default': |
I'm not sure that this change is correct. Fortunately value->typePtr is probably never NULL, but I think the comparison should be skipped in this case. Where did you see this booleanString? |
The case (value->typePtr == NULL) is tested above for purpose, so it is not a bug when one of type pointers is NULL. "booleanString" was added in 8.5, replacing "boolean", but in 8.6 it is not used. All boolean values in 8.6 are just integers 0 and 1. |
Ah, the NULL case is indeed tested just above. So the current code works correctly. |
When I said this, I understood that the patch should be backported to maintained releases. Unpatched Python with Tcl 8.5: >>> import tkinter; tcl = tkinter.Tcl()
>>> tcl.call('expr', 'false')
<booleanString object: 'false'>
>>> bool(tcl.call('expr', 'false'))
True |
New changeset de3496cd609e by Serhiy Storchaka in branch '3.4': New changeset b2413da7516f by Serhiy Storchaka in branch 'default': New changeset d0554559de53 by Serhiy Storchaka in branch '2.7': |
And indeed, "app->BooleanType" is NULL, because the "booleanString" type is not registered in Tcl. Thank you for pointing on it Amaury. Now it is fixed. |
New changeset 954e7e1d85f1 by Serhiy Storchaka in branch '2.7': New changeset 4255ca2f5314 by Serhiy Storchaka in branch '3.4': New changeset bb0b5b6c13f3 by Serhiy Storchaka in branch 'default': |
http://buildbot.python.org/all/builders/x86%20Tiger%203.x/builds/9465/steps/test/logs/stdio ====================================================================== Traceback (most recent call last):
File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_tcl.py", line 391, in test_booleans
check('true', True)
File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_tcl.py", line 386, in check
self.assertEqual(result, expected)
AssertionError: 'true' != True |
New changeset 77e5623e22dd by Serhiy Storchaka in branch '2.7': New changeset 3b8039c37b37 by Serhiy Storchaka in branch '3.4': New changeset 8ad98ade3f78 by Serhiy Storchaka in branch 'default': |
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: