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

Conversation

y5c4l3
Copy link
Contributor

@y5c4l3 y5c4l3 commented Oct 10, 2024

@@ -143,7 +143,8 @@ _get_tcl_lib_path(void)
struct stat stat_buf;
int stat_return_value;

PyObject *prefix = PySys_GetObject("prefix"); // borrowed reference
/* gh-125235: Should not use "prefix" which might point to venv root. */
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

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinner vstinner merged commit b3aa1b5 into python:main Oct 11, 2024
40 checks passed
@miss-islington-app
Copy link

Thanks @y5c4l3 for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 11, 2024
…ion on Windows (pythonGH-125250)

(cherry picked from commit b3aa1b5)

Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com>
Signed-off-by: y5c4l3 <y5c4l3@proton.me>
@bedevere-app
Copy link

bedevere-app bot commented Oct 11, 2024

GH-125312 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Oct 11, 2024
@vstinner
Copy link
Member

Thank you for your bugfix @y5c4l3. I merged your PR.

@vstinner
Copy link
Member

@y5c4l3: Do you want to propose a fix for the Py_GetPrefix() deprecation doc?

vstinner pushed a commit that referenced this pull request Oct 11, 2024
…tion on Windows (GH-125250) (#125312)

gh-125235: Keep `_tkinter` TCL paths pointing to base installation on Windows (GH-125250)
(cherry picked from commit b3aa1b5)

Signed-off-by: y5c4l3 <y5c4l3@proton.me>
Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com>
@y5c4l3
Copy link
Contributor Author

y5c4l3 commented Oct 11, 2024

@y5c4l3: Do you want to propose a fix for the Py_GetPrefix() deprecation doc?

I'd like to. I've left an issue #125313 and doc fix is WIP. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants