8000 #1047 ModuleObject __getattribute__ doesn't treat exceptions ocurred … · sdpython/pythonnet@8ae5cf4 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jul 22, 2023. It is now read-only.

Commit 8ae5cf4

Browse files
committed
pythonnet#1047 ModuleObject __getattribute__ doesn't treat exceptions ocurred during internal GetAttribute
1 parent f5548e3 commit 8ae5cf4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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+
{
291+
Exceptions.SetError(e);
292+
return IntPtr.Zero;
293+
}
294+
284295

285296
if (attr == null)
286297
{

0 commit comments

Comments
 (0)
0