Skip to content
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-125235: Keep _tkinter TCL paths pointing to base installation on Windows #125250

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Keep :mod:`tkinter` TCL paths in venv pointing to base installation on
Windows.
2 changes: 1 addition & 1 deletion Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ _get_tcl_lib_path(void)
struct stat stat_buf;
int stat_return_value;

PyObject *prefix = PySys_GetObject("prefix"); // borrowed reference
PyObject *prefix = PySys_GetObject("base_prefix"); // borrowed reference

Choose a reason for hiding this comment

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

I think removing //bordered reference is more appropriate, because you have already explained it above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed my extra comment line, since it's neither a workaround nor a corner case.

Copy link
Member

Choose a reason for hiding this comment

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

So deprecated Py_GetPath() should be replaced with PySys_GetObject("base_prefix"), instead of PySys_GetObject("prefix")?

Copy link
Contributor Author

@y5c4l3 y5c4l3 Oct 11, 2024

Choose a reason for hiding this comment

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

So deprecated Py_GetPath() should be replaced with PySys_GetObject("base_prefix"), instead of PySys_GetObject("prefix")?

Yeah, the equivalent of Py_GetPath / Py_GetPrefix should be sys.base_prefix, since sys.prefix takes venv into consideration. I think it's necessary to clarify it in their deprecation notes: https://docs.python.org/3/c-api/init.html#c.Py_GetPrefix

if (prefix == NULL) {
return NULL;
}
Expand Down
Loading