Provides Python context manager support via with_python/2 macro.
Ensures __exit__ is always called, even on exception.
Example
SnakeBridge.with_python(file_ref) do
SnakeBridge.Dynamic.call(file_ref, :read, [])
end
Summary
Functions
Calls enter on a Python context manager.
Calls exit on a Python context manager.
Executes a block with a Python context manager.
Functions
@spec call_enter( SnakeBridge.Ref.t() | map(), keyword() ) :: {:ok, term()} | {:error, term()}
Calls enter on a Python context manager.
@spec call_exit(SnakeBridge.Ref.t() | map(), Exception.t() | nil, keyword()) :: {:ok, term()} | {:error, term()}
Calls exit on a Python context manager.
Executes a block with a Python context manager.
Calls __enter__ before the block and guarantees __exit__ after,
even if an exception occurs.