Skip to content

[pull] master from pythonnet:master#43

Merged
pull[bot] merged 6 commits into
QSLee-Net:masterfrom
pythonnet:master
May 15, 2026
Merged

[pull] master from pythonnet:master#43
pull[bot] merged 6 commits into
QSLee-Net:masterfrom
pythonnet:master

Conversation

@pull

@pull pull Bot commented May 15, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

filmor and others added 6 commits May 15, 2026 21:57
- Catch exceptions in TrySet/DeleteMember
- Convert the exceptions into Python exceptions
- Add tests for the remaining cases
- Add a note on why the field has to be lazily initialized (general
  issue with derived classes)
The dynamic getter swallowed any exception from TryGetMember and
returned default to Python with the prior AttributeError still set,
so user code observed a misleading AttributeError instead of the real
failure.

Set a Python exception in the catch arm. We use RuntimeError with the
message string rather than Converter.ToPython(e) because wrapping the
CLR exception object can trigger type initialisation that re-enters
this same slot on the live dynamic object, producing infinite
recursion.

Mirrors the symmetry already present in the setter (#2706 review,
@lostmsu) and adds a regression test alongside the existing
ThrowingSetDynamicObject coverage.
- Cache HasClrMember reflection per (Type, name) so tp_getattro_dlr_proxy
  / tp_setattro_dlr_proxy avoid repeated GetMember() calls on every
  attribute access of DLR-aware objects.

- Mirror tp_setattro_dlr_proxy's catch arm to the getter's safer
  SetError(RuntimeError, e.Message) shape instead of SetError(Exception),
  keeping both slots re-entry-safe on live dynamic objects.

Related to #2706.
Implement support for DLR get/set
@pull pull Bot locked and limited conversation to collaborators May 15, 2026
@pull pull Bot added the ⤵️ pull label May 15, 2026
@pull pull Bot merged commit 27caf5c into QSLee-Net:master May 15, 2026
@pull pull Bot had a problem deploying to github-pages May 15, 2026 23:45 Failure
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants