Skip to content

Commit a96d396

Browse files
den-run-aiden-run-aifilmor
authored andcommitted
Add context manager protocol for .NET IDisposable types (pythonnet#2568)
* 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)
1 parent ca19e49 commit a96d396

6 files changed

Lines changed: 815 additions & 2 deletions

File tree

AUTHORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- Barton Cline ([@BartonCline](https://github.com/BartonCline))
1010
- Brian Lloyd ([@brianlloyd](https://github.com/brianlloyd))
1111
- David Anthoff ([@davidanthoff](https://github.com/davidanthoff))
12-
- Denis Akhiyarov ([@denfromufa](https://github.com/denfromufa))
12+
- Denis Akhiyarov ([@den-run-ai](https://github.com/den-run-ai))
1313
- Tony Roberts ([@tonyroberts](https://github.com/tonyroberts))
1414
- Victor Uriarte ([@vmuriart](https://github.com/vmuriart))
1515

CHANGELOG.md

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,92 @@ project adheres to [Semantic Versioning][].
55

66
This document follows the conventions laid out in [Keep a CHANGELOG][].
77

8-
## [Unreleased][]
8+
## Unreleased
9+
10+
### Added
11+
12+
- Support `del obj[...]` for types derived from `IList<T>` and `IDictionary<K, V>`
13+
- Support for .NET Framework 4.6.1 (#2701)
14+
- Add context manager protocol for .NET IDisposable types, allowing use of `with` statements
15+
for IDisposable objects (#2568)
16+
17+
### Changed
18+
### Fixed
19+
20+
- Fixed crash when trying to `del clrObj[...]` for non-arrays
21+
- ci: properly exclude job (#2542)
22+
23+
## [3.0.5](https://github.com/pythonnet/pythonnet/releases/tag/v3.0.5) - 2024-12-13
24+
25+
### Added
26+
27+
- Support for Python 3.13 (#2454)
28+
29+
30+
## [3.0.4](https://github.com/pythonnet/pythonnet/releases/tag/v3.0.4) - 2024-09-19
31+
32+
### Added
33+
34+
- Added `ToPythonAs<T>()` extension method to allow for explicit conversion
35+
using a specific type. ([#2311][i2311])
36+
- Added `IComparable` and `IEquatable` implementations to `PyInt`, `PyFloat`,
37+
and `PyString` to compare with primitive .NET types like `long`.
38+
39+
### Changed
40+
41+
- Added a `FormatterFactory` member in RuntimeData to create formatters with
42+
parameters. For compatibility, the `FormatterType` member is still present
43+
and has precedence when defining both `FormatterFactory` and `FormatterType`
44+
- Added a post-serialization and a pre-deserialization step callbacks to
45+
extend (de)serialization process
46+
- Added an API to stash serialized data on Python capsules
47+
48+
### Fixed
49+
50+
- Fixed RecursionError for reverse operators on C# operable types from python. See #2240
51+
- Fixed crash when .NET event has no `AddMethod`
52+
- Fixed probing for assemblies in `sys.path` failing when a path in `sys.path`
53+
has invalid characters. See #2376
54+
- Fixed possible access violation exception on shutdown. See ([#1977][i1977])
55+
56+
## [3.0.3](https://github.com/pythonnet/pythonnet/releases/tag/v3.0.3) - 2023-10-11
57+
58+
### Added
59+
60+
- Support for Python 3.12
61+
62+
### Changed
63+
64+
- Use enum name in `repr`
65+
66+
## [3.0.2](https://github.com/pythonnet/pythonnet/releases/tag/v3.0.2) - 2023-08-29
67+
68+
### Fixed
69+
70+
- Fixed error occuring when inheriting a class containing a virtual generic method
71+
- Make a second call to `pythonnet.load` a no-op, as it was intended
72+
- Added support for multiple inheritance when inheriting from a class and/or multiple interfaces
73+
- Fixed error occuring when calling `GetBuffer` for anything other than `PyBUF.SIMPLE`
74+
- Bumped `clr_loader` dependency to incorporate patches
75+
76+
## [3.0.1](https://github.com/pythonnet/pythonnet/releases/tag/v3.0.1) - 2022-11-03
77+
78+
### Added
79+
80+
- Support for Python 3.11
81+
82+
### Changed
83+
84+
- Allow decoders to override conversion of types derived from primitive types
85+
86+
### Fixed
87+
88+
- Fixed objects leaking when Python attached event handlers to them even if they were later removed
89+
- Fixed `PyInt` conversion to `BigInteger` and `System.String` produced incorrect result for values between 128 and 255.
90+
- Fixed implementing a generic interface with a Python class
91+
92+
93+
## [3.0.0](https://github.com/pythonnet/pythonnet/releases/tag/v3.0.0) - 2022-09-29
994

1095
### Added
1196

0 commit comments

Comments
 (0)