Open chrstphrchvz opened 1 year ago
@serhiy-storchaka This issue is about patching _tkinter.
I agree with the analysis of @chrstphrchvz. I came to the same two possible quick solutions, and I also not qualified to decide what is better.
For now, it looks safer to add the missing declaration of Tcl_AppInit
:
#if TK_MAJOR_VERSION >= 9
int Tcl_AppInit(Tcl_Interp *);
#endif
If the user code uses an embedded Python or a custom build of Python with statically linked Tcl/Tk and third-party binary Tcl/Tk libraries, they will still be able to define a custom Tcl_AppInit()
.
In future we may implement more modern approach, but this minimum is necessary to build Tkinter with Tcl/Tk 9.0.
I'll add this change in #112681 because both changes are needed to unblock a build.
Tkinter builds now with Tcl 9.0. I leave this issue open for the case if we find better solution.
Since Tcl 8.0.5 (https://github.com/tcltk/tcl/commit/17481a9360ea758b106cce6d9ec42c575a877eb5), tcl.h has clarified that
Tcl_AppInit()
is not an exported Tcl library function, and declaresTcl_AppInit()
for compatibility/convenience only:This declaration is deprecated in Tcl 8.7 and removed in Tcl 9.0. Without it, _tkinter.c will fail to build if the compiler treats implicit function declarations as errors:
Although it seems possible to have _tkinter.c declare
Tcl_AppInit()
when tcl.h does not, I am not familiar enough withTcl_AppInit()
usage to know whether that is a good solution. From reading theTcl_AppInit()
documentation, it sounds like Tkinter could instead rename itsTcl_AppInit()
in tkappinit.c to something else, which it then always declares in _tkinter.c.