Skip to content

Usage of deprecated Python functions slated for removal in Python 3.15 #2592

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

Open
picnixz opened this issue May 9, 2025 · 2 comments
Open

Comments

@picnixz
Copy link

picnixz commented May 9, 2025

Hi, I'm a CPython core developer and we are currently working on the next alpha, namely Python 3.15. In Python 3.15, we are removing a bunch of deprecated functions (see python/cpython#133661 and https://github.com/python/cpython/pull/133661/files#diff-bd7a9c5b54eeb2b40e6db5e48e8d79d309d8738e776a40918773c6840189edf9).

We found the following references in this project, but as I never coded in .NET, I don't know how to change them:

pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Native/CustomMarshaler.cs: /// Ex. Py_GetPythonHome
pythonnet-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();
@filmor
Copy link
Member

filmor commented May 9, 2025

The respective replacements are PyConfig_Get with the right parameters from Python 3.14 onwards, right? I can have a look into implementing these along with 3.14 support.

Thank you very much for the heads up!

@picnixz
Copy link
Author

picnixz commented May 9, 2025

The respective replacements are PyConfig_Get with the right parameters from Python 3.14 onwards, right

Yes indeed! don't forget to hold the GIL though. If there are issues, please open a ticket on python/cpython.

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

No branches or pull requests

2 participants