File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -97,10 +97,21 @@ internal static void Initialize()
97
97
warnings_module = Runtime . PyImport_ImportModule ( "warnings" ) ;
98
98
Exceptions . ErrorCheck ( warnings_module ) ;
99
99
Type type = typeof ( Exceptions ) ;
100
- foreach ( FieldInfo fi in type . GetFields ( BindingFlags . Public |
101
- BindingFlags . Static ) )
100
+ foreach ( var fi in type . GetFields (
101
+ BindingFlags . Public |
102
+ BindingFlags . Static ) )
102
103
{
103
- IntPtr op = Runtime . PyObject_GetAttrString ( exceptions_module , fi . Name ) ;
104
+ if ( Runtime . pyversionnumber < 25
105
+ && ( fi . Name == "BaseException" || fi . Name == "GeneratorExit" ) )
106
+ {
107
+ continue ;
108
+ }
109
+ if ( Runtime . pyversionnumber >= 32 && fi . Name == "StandardError" )
110
+ {
111
+ continue ;
112
+ }
113
+
114
+ var op = Runtime . PyObject_GetAttrString ( exceptions_module , fi . Name ) ;
104
115
if ( op != IntPtr . Zero )
105
116
{
106
117
fi . SetValue ( type , op ) ;
You can’t perform that action at this time.
0 commit comments