Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit00d73ca

Browse files
authored
gh-104399: Use newer libtommath APIs when necessary (GH-104407)
1 parent852348a commit00d73ca

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Prepare the ``_tkinter`` module for building with Tcl 9.0 and future
2+
libtommath by replacing usage of deprecated functions
3+
:c:func:`mp_to_unsigned_bin_n` and:c:func:`mp_unsigned_bin_size`
4+
when necessary.

‎Modules/_tkinter.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ Copyright (C) 1994 Steen Lumholt.
6565
#endif
6666
#include<tclTomMath.h>
6767

68+
#if defined(TCL_WITH_EXTERNAL_TOMMATH)|| (TK_HEX_VERSION >=0x08070000)
69+
#defineUSE_DEPRECATED_TOMMATH_API 0
70+
#else
71+
#defineUSE_DEPRECATED_TOMMATH_API 1
72+
#endif
73+
6874
#if !(defined(MS_WINDOWS)|| defined(__CYGWIN__))
6975
#defineHAVE_CREATEFILEHANDLER
7076
#endif
@@ -1049,20 +1055,33 @@ static PyObject*
10491055
fromBignumObj(TkappObject*tkapp,Tcl_Obj*value)
10501056
{
10511057
mp_intbigValue;
1058+
mp_errerr;
1059+
#ifUSE_DEPRECATED_TOMMATH_API
10521060
unsigned longnumBytes;
1061+
#else
1062+
size_tnumBytes;
1063+
#endif
10531064
unsignedchar*bytes;
10541065
PyObject*res;
10551066

10561067
if (Tcl_GetBignumFromObj(Tkapp_Interp(tkapp),value,&bigValue)!=TCL_OK)
10571068
returnTkinter_Error(tkapp);
1069+
#ifUSE_DEPRECATED_TOMMATH_API
10581070
numBytes=mp_unsigned_bin_size(&bigValue);
1071+
#else
1072+
numBytes=mp_ubin_size(&bigValue);
1073+
#endif
10591074
bytes=PyMem_Malloc(numBytes);
10601075
if (bytes==NULL) {
10611076
mp_clear(&bigValue);
10621077
returnPyErr_NoMemory();
10631078
}
1064-
if (mp_to_unsigned_bin_n(&bigValue,bytes,
1065-
&numBytes)!=MP_OKAY) {
1079+
#ifUSE_DEPRECATED_TOMMATH_API
1080+
err=mp_to_unsigned_bin_n(&bigValue,bytes,&numBytes);
1081+
#else
1082+
err=mp_to_ubin(&bigValue,bytes,numBytes,NULL);
1083+
#endif
1084+
if (err!=MP_OKAY) {
10661085
mp_clear(&bigValue);
10671086
PyMem_Free(bytes);
10681087
returnPyErr_NoMemory();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp