8000 Merge pull request #1048 from andreydani/master · SanityLacking/pythonnet@7fa0af2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7fa0af2

Browse files
authored
Merge pull request pythonnet#1048 from andreydani/master
pythonnet#1047 ModuleObject __getattribute__ doesn't treat exceptions ocurred during internal GetAttribute
2 parents 6236806 + 1aabd61 commit 7fa0af2

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- Alex Earl ([@slide](https://github.com/slide))
1616
- Alex Helms ([@alexhelms](https://github.com/alexhelms))
1717
- Alexandre Catarino([@AlexCatarino](https://github.com/AlexCatarino))
18+
- Andrey Sant'Anna ([@andreydani](https://github.com/andreydani))
1819
- Arvid JB ([@ArvidJB](https://github.com/ArvidJB))
1920
- Benoît Hudson ([@benoithudson](https://github.com/benoithudson))
2021
- Bradley Friedman ([@leith-bartrich](https://github.com/leith-bartrich))

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
2929
together with Nuitka
3030
- Fixes bug where delegates get casts (dotnetcore)
3131
- Determine size of interpreter longs at runtime
32+
- Handling exceptions ocurred in ModuleObject's getattribute
3233

3334
## [2.4.0][]
3435

src/runtime/moduleobject.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,18 @@ public static IntPtr tp_getattro(IntPtr ob, IntPtr key)
280280
return self.dict;
281281
}
282282

283-
ManagedType attr = self.GetAttribute(name, true);
283+
ManagedType attr = null;
284+
285+
try
286+
{
287+
attr = self.GetAttribute(name, true);
288+
}
289+
catch (Exception e)
290+< 5E7A /span>
{
291+
Exceptions.SetError(e);
292+
return IntPtr.Zero;
293+
}
294+
284295

285296
if (attr == null)
286297
{

0 commit comments

Comments
 (0)
0