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

gh-133644: remove deprecated Python initialization getter functions#133661

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

picnixz
Copy link
Member

@picnixzpicnixz commentedMay 8, 2025
edited by github-actionsbot
Loading

For now, I'm only removing the getters. The setters will be removed in a separate PR (it's a bit tricky to remove them in this PR asPyConfig_Get requires the GIL to be held)


📚 Documentation preview 📚:https://cpython-previews--133661.org.readthedocs.build/

@vstinner
Copy link
Member

The 2 following projects refer to these removed getter functions:

  • Nuitka (2.6)
  • pythonnet (3.0.5)
Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: // NUITKA_PRINTF_TRACE("Final Py_GetPath is '%ls'.\n", Py_GetPath());Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_GetPath();pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Native/CustomMarshaler.cs: /// Ex. Py_GetPythonHomepythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/PythonEngine.cs: IntPtr p = Runtime.TryUsingDll(() => Runtime.Py_GetProgramName());pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/PythonEngine.cs: IntPtr p = Runtime.TryUsingDll(() => Runtime.Py_GetPythonHome());pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/PythonEngine.cs: IntPtr p = Runtime.TryUsingDll(() => Runtime.Py_GetPath());pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.Delegates.cs: Py_GetProgramName = (delegate* unmanaged[Cdecl]<IntPtr>)GetFunctionByName(nameof(Py_GetProgramName), GetUnmanagedDll(_PythonDll));pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.Delegates.cs: Py_GetPythonHome = (delegate* unmanaged[Cdecl]<IntPtr>)GetFunctionByName(nameof(Py_GetPythonHome), GetUnmanagedDll(_PythonDll));pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.Delegates.cs: Py_GetPath = (delegate* unmanaged[Cdecl]<IntPtr>)GetFunctionByName(nameof(Py_GetPath), GetUnmanagedDll(_PythonDll));pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.Delegates.cs: internal static delegate* unmanaged[Cdecl]<IntPtr> Py_GetProgramName { get; }pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.Delegates.cs: internal static delegate* unmanaged[Cdecl]<IntPtr> Py_GetPythonHome { get; }pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.Delegates.cs: internal static delegate* unmanaged[Cdecl]<IntPtr> Py_GetPath { get; }pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.cs: internal static IntPtr Py_GetProgramName() => Delegates.Py_GetProgramName();pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.cs: internal static IntPtr Py_GetPythonHome() => Delegates.Py_GetPythonHome();pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.cs: internal static IntPtr Py_GetPath() => Delegates.Py_GetPath();

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@picnixz
Copy link
MemberAuthor

The 2 following projects refer to these removed getter functions:

Should we actually open issues out there? (I can do it)

@vstinner
Copy link
Member

Should we actually open issues out there? (I can do it)

You can open an issue in the upstream projects:

Or even propose a fix :-)

hugovk reacted with rocket emoji

@vstinnervstinner reopened thisMay 9, 2025
@vstinner
Copy link
Member

The CI was sick on this PR, so I tried to close/reopen the issue to repair the CI.

picnixz reacted with laugh emoji

@picnixz
Copy link
MemberAuthor

Or even propose a fix :-)

Let's do that :) (just finishing up my reviews elsewhere)

hugovk reacted with hooray emoji

@vstinnervstinnerenabled auto-merge (squash)May 9, 2025 11:33
@vstinnervstinner merged commit5044e85 intopython:mainMay 9, 2025
43 checks passed
@picnixz
Copy link
MemberAuthor

Oh, for Nuitka the usage is fine (https://github.com/Nuitka/Nuitka/blob/4feeaf96be22b38993b7872f4e2df816fd206c27/nuitka/build/static_src/MainProgram.c#L194-L198):

#elif PYTHON_VERSION < 0x370PySys_SetPath(getBinaryDirectoryWideChars(true));Py_SetPath(getBinaryDirectoryWideChars(true));// NUITKA_PRINTF_TRACE("Final Py_GetPath is '%ls'.\n", Py_GetPath());#endif

It's only being used in Python 3.7 and before (well, they are directly accessing the structure members otherwise...).

vstinner and hugovk reacted with thumbs up emoji

@picnixzpicnixz deleted the cleanup/315/process-wide-parameters-133644 branchMay 9, 2025 11:42
@vstinner
Copy link
Member

_NUITKA_EXPERIMENTAL_DUMP_PY_PATH_CONFIG can be updated to usePyConfig_Get() andPySys_FormatStdout().

picnixz reacted with thumbs up emoji

@vstinner
Copy link
Member

Merged, thank you.

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

@zoobazoobazooba left review comments

@vstinnervstinnervstinner approved these changes

@encukouencukouAwaiting requested review from encukouencukou is a code owner

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@picnixz@vstinner@encukou@zooba

[8]ページ先頭

©2009-2025 Movatter.jp