Add context manager protocol for .NET IDisposable types#119
Add context manager protocol for .NET IDisposable types#119Martin-Molinero wants to merge 1 commit into
Conversation
* Add context manager protocol for .NET IDisposable types --------- Co-authored-by: den-run-ai <macmone@Deniss-Air.hsd1.ca.comcast.net> Co-authored-by: Benedikt Reinartz <filmor@gmail.com> (cherry picked from commit 25e0ccf)
|
Closing — this can't pass on this fork as-is. The upstream implementation (pythonnet#2568) adds Making this work would require re-enabling the mixins provider, which is a deliberate fork decision — out of scope for a cherry-pick. If you want IDisposable-as-context-manager, it'd need either re-enabling mixins (revisiting pythonnet#1785) or a C#-side implementation that doesn't depend on the mixin mechanism. Closing; happy to revisit if you decide to re-enable mixins. |
Cherry-pick from upstream
pythonnet/pythonnet: lets .NETIDisposableobjects be used as Python context managers (withstatement), callingDispose()on exit.-x(original authorship preserved).Conflict note: only docs conflicted (
CHANGELOG.md,doc/source/python.rst) — resolved to keep the upstream additions; no code conflicts. Builds clean; addstests/test_disposable.py. Fits this fork's pattern of adding Pythonic protocols (__bool__, container methods,len).🤖 Generated with Claude Code