Skip to content

Commit

Permalink
Drop reference to Py_Main (pythonnet#2504)
Browse files Browse the repository at this point in the history
Was only used in the console and might not be available in some
embedding scenarios.
  • Loading branch information
filmor authored Nov 8, 2024
1 parent de7a1d2 commit 0ea1d29
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/runtime/Runtime.Delegates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ static Delegates()
PyGILState_Ensure = (delegate* unmanaged[Cdecl]<PyGILState>)GetFunctionByName(nameof(PyGILState_Ensure), GetUnmanagedDll(_PythonDll));
PyGILState_Release = (delegate* unmanaged[Cdecl]<PyGILState, void>)GetFunctionByName(nameof(PyGILState_Release), GetUnmanagedDll(_PythonDll));
PyGILState_GetThisThreadState = (delegate* unmanaged[Cdecl]<PyThreadState*>)GetFunctionByName(nameof(PyGILState_GetThisThreadState), GetUnmanagedDll(_PythonDll));
Py_Main = (delegate* unmanaged[Cdecl]<int, IntPtr, int>)GetFunctionByName(nameof(Py_Main), GetUnmanagedDll(_PythonDll));
PyEval_InitThreads = (delegate* unmanaged[Cdecl]<void>)GetFunctionByName(nameof(PyEval_InitThreads), GetUnmanagedDll(_PythonDll));
PyEval_ThreadsInitialized = (delegate* unmanaged[Cdecl]<int>)GetFunctionByName(nameof(PyEval_ThreadsInitialized), GetUnmanagedDll(_PythonDll));
PyEval_AcquireLock = (delegate* unmanaged[Cdecl]<void>)GetFunctionByName(nameof(PyEval_AcquireLock), GetUnmanagedDll(_PythonDll));
Expand Down Expand Up @@ -319,7 +318,6 @@ static Delegates()
internal static delegate* unmanaged[Cdecl]<PyGILState> PyGILState_Ensure { get; }
internal static delegate* unmanaged[Cdecl]<PyGILState, void> PyGILState_Release { get; }
internal static delegate* unmanaged[Cdecl]<PyThreadState*> PyGILState_GetThisThreadState { get; }
internal static delegate* unmanaged[Cdecl]<int, IntPtr, int> Py_Main { get; }
internal static delegate* unmanaged[Cdecl]<void> PyEval_InitThreads { get; }
internal static delegate* unmanaged[Cdecl]<int> PyEval_ThreadsInitialized { get; }
internal static delegate* unmanaged[Cdecl]<void> PyEval_AcquireLock { get; }
Expand Down
14 changes: 0 additions & 14 deletions src/runtime/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -719,20 +719,6 @@ internal static T TryUsingDll<T>(Func<T> op)
internal static PyThreadState* PyGILState_GetThisThreadState() => Delegates.PyGILState_GetThisThreadState();


public static int Py_Main(int argc, string[] argv)
{
var marshaler = StrArrayMarshaler.GetInstance(null);
var argvPtr = marshaler.MarshalManagedToNative(argv);
try
{
return Delegates.Py_Main(argc, argvPtr);
}
finally
{
marshaler.CleanUpNativeData(argvPtr);
}
}

internal static void PyEval_InitThreads() => Delegates.PyEval_InitThreads();


Expand Down

0 comments on commit 0ea1d29

Please sign in to comment.