10000 Remove suggestions to use `internal` functions by filmor · Pull Request #2092 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

Remove suggestions to use internal functions #2092

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

Merged
merged 2 commits into from
Jan 29, 2023
Merged
Changes from 1 commit
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
Next Next commit
Remove suggestions to use internal functions
Fixes #2091.
  • Loading branch information
filmor authored Jan 26, 2023
commit 1dc3c1cb61120e608984065e6a8d19eab6c0e863
19 changes: 7 additions & 12 deletions doc/source/dotnet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,9 @@ application.

Before interacting with any of the objects or APIs provided by the
``Python.Runtime`` namespace, calling code must have acquired the Python
global interpreter lock by calling the ``PythonEngine.AcquireLock``
method. The only exception to this rule is the
``PythonEngine.Initialize`` method, which may be called at startup
without having acquired the GIL.

When finished using Python APIs, managed code must call a corresponding
``PythonEngine.ReleaseLock`` to release the GIL and allow other threads
to use Python.
Comment on lines -50 to -52
Copy link
Member
@lostmsu lostmsu Jan 26, 2023

Choose a reason for hiding this comment

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

IMHO, "when finished" section needs corresponding replacement (maybe merged with the acquisition part).

Copy link
Member Author
9BFE

Choose a reason for hiding this comment

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

Better?

global interpreter lock by ``using'' ``Py.GIL()``. The only exception to
this rule is the ``PythonEngine.Initialize`` method, which may be called
at startup without having acquired the GIL.

A ``using`` statement may be used to acquire and release the GIL:

Expand All @@ -60,10 +55,10 @@ A ``using`` statement may be used to acquire and release the GIL:
PythonEngine.Exec("doStuff()");
}

The AcquireLock and ReleaseLock methods are thin wrappers over the
unmanaged ``PyGILState_Ensure`` and ``PyGILState_Release`` functions
from the Python API, and the documentation for those APIs applies to the
managed versions.
The ``Py.GIL()'' object is a thin wrapper over the unmanaged
``PyGILState_Ensure`` (on construction) and ``PyGILState_Release`` (on
disposal) functions from the Python API, and the documentation for those
APIs applies to the managed versions.

Passing C# Objects to the Python Engine
---------------------------------------
Expand Down
0