gh-104399: Use newer libtommath APIs when necessary#104407
gh-104399: Use newer libtommath APIs when necessary#104407serhiy-storchaka merged 4 commits intopython:mainfrom
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
| #endif | ||
| #include <tclTomMath.h> | ||
|
|
||
| #if defined(TCL_WITH_EXTERNAL_TOMMATH) || (TCL_MAJOR_VERSION >= 9) |
There was a problem hiding this comment.
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.
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).
|
Thanks @chrstphrchvz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
|
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. |
mp_to_unsigned_bin_n()andmp_unsigned_bin_size()#104399