Skip to content

gh-140001: Remove obsolete TCL_WIN_SOCKET macro (from Tcl 7.x) from _tkinter.c#139998

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
mdehoon:remove_tcl_win_socket
Oct 13, 2025
Merged

gh-140001: Remove obsolete TCL_WIN_SOCKET macro (from Tcl 7.x) from _tkinter.c#139998
serhiy-storchaka merged 1 commit into
python:mainfrom
mdehoon:remove_tcl_win_socket

Conversation

@mdehoon

@mdehoon mdehoon commented Oct 12, 2025

Copy link
Copy Markdown
Contributor

The macro TCL_WIN_SOCKET used in Modules/_tkinter.c is a Tcl 7.x legacy macro that is no longer defined in Tcl ≥ 8.0.
As Python now requires Tcl 8.5.12, the code path is now unreachable, and can safely be removed.

The macro FHANDLETYPE defined in Modules/_tkinter.c then always evaluates to TCL_UNIX_FD, and can also be removed.

@bedevere-app

This comment was marked as resolved.

@picnixz

picnixz commented Oct 12, 2025

Copy link
Copy Markdown
Member

Please open an issue and link the Tcl documentation as well; TiA.

@mdehoon

mdehoon commented Oct 12, 2025

Copy link
Copy Markdown
Contributor Author

See https://www.tcl-lang.org/man/tcl7.6/TclLib/GetFile.3.html for a description of these macros in Tcl 7.6.
The macros TCL_WIN_SOCKET and TCL_UNIX_FD were used in Tcl_GetFile, which was removed in Tcl 8.0.

See generic/tcl.h in the Tcl 7.6 source code for the definition of these two macros:

#define TCL_UNIX_FD	1
#define TCL_WIN_SOCKET	6

These macros are not defined in generic/tcl.h of Tcl 8.0, or mentioned anywhere else in the Tcl 8.0 source code.

@picnixz picnixz changed the title Remove obsolete TCL_WIN_SOCKET macro (from Tcl 7.x) from _tkinter.c gh-140001: Remove obsolete TCL_WIN_SOCKET macro (from Tcl 7.x) from _tkinter.c Oct 12, 2025

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not WAIT_FOR_STDIN be removed too?

@mdehoon

mdehoon commented Oct 12, 2025

Copy link
Copy Markdown
Contributor Author

WAIT_FOR_STDIN is not always defined: it remains undefined if __CYGWIN__ is defined.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

@serhiy-storchaka serhiy-storchaka merged commit a00655b into python:main Oct 13, 2025
51 checks passed
@mdehoon mdehoon deleted the remove_tcl_win_socket branch October 13, 2025 11:27
@mdehoon

mdehoon commented Oct 28, 2025

Copy link
Copy Markdown
Contributor Author

@serhiy-storchaka

Should not WAIT_FOR_STDIN be removed too?

Pull request #140147 removes WAIT_FOR_STDIN as well as much of the Windows-specific code in Modules/_tkinter.c. Would you be willing to have a look at that PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants