-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
gh-104399: Use newer libtommath APIs when necessary #104407
Conversation
As with #103842, this requires knowing whether Tcl was built with |
general thought: We could use a buildbot with bleeding edge versions of tcl/tk |
Modules/_tkinter.c
Outdated
@@ -65,6 +65,12 @@ Copyright (C) 1994 Steen Lumholt. | |||
#endif | |||
#include <tclTomMath.h> | |||
|
|||
#if defined(TCL_WITH_EXTERNAL_TOMMATH) || (TCL_MAJOR_VERSION >= 9) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new API is available since 8.6.10. Would not be better to use it as soon as it is available? Potentially it can support larger integers.
#if defined(TCL_WITH_EXTERNAL_TOMMATH) || (TCL_MAJOR_VERSION >= 9) | |
#if defined(TCL_WITH_EXTERNAL_TOMMATH) || (TK_HEX_VERSION >= 0x0806020a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not familiar with libtommath APIs nor aware what the exact limits are, but I would think that Tcl is more likely to be the limiting factor anyway, as even the deprecated libtommath functions can handle numbers exceeding what Tcl < 9 can usefully convert to and from (due to various 2**31-1 size limitations on strings, etc.).
Given how Tkinter requires the Tcl version but not the patchlevel to match at compile time and runtime (#104399 (comment)), it should be fine to enable the new functions on Tcl 8.7; this would also allow not having to check for TCL_WITH_EXTERNAL_TOMMATH
in this case (although it still has to be checked for #103842).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
Thanks @chrstphrchvz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
…04407) (cherry picked from commit 00d73ca) Co-authored-by: Christopher Chavez <[email protected]>
GH-105343 is a backport of this pull request to the 3.12 branch. |
GH-105344 is a backport of this pull request to the 3.11 branch. |
…04407) (cherry picked from commit 00d73ca) Co-authored-by: Christopher Chavez <[email protected]>
mp_to_unsigned_bin_n()
andmp_unsigned_bin_size()
#104399