| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,7 @@ public static IntPtr tp_descr_get(IntPtr ds, IntPtr ob, IntPtr tp) | |||
| 33 | 33 | MethodInfo getter = self.getter; | |
| 34 | 34 | object result; | |
| 35 | 35 | ||
| 36 | + IntPtr ts = IntPtr.Zero; | ||
| 36 | 37 | ||
| 37 | 38 | if (getter == null) | |
| 38 | 39 | { | |
@@ -48,13 +49,16 @@ public static IntPtr tp_descr_get(IntPtr ds, IntPtr ob, IntPtr tp) | |||
| 48 | 49 | return IntPtr.Zero; | |
| 49 | 50 | } | |
| 50 | 51 | ||
| 52 | + ts = PythonEngine.BeginAllowThreads(); | ||
| 51 | 53 | try | |
| 52 | 54 | { | |
| 53 | 55 | result = self.info.GetValue(null, null); | |
| 56 | + PythonEngine.EndAllowThreads(ts); | ||
| 54 | 57 | return Converter.ToPython(result, self.info.PropertyType); | |
| 55 | 58 | } | |
| 56 | 59 | catch (Exception e) | |
| 57 | 60 | { | |
| 61 | + PythonEngine.EndAllowThreads(ts); | ||
| 58 | 62 | return Exceptions.RaiseTypeError(e.Message); | |
| 59 | 63 | } | |
| 60 | 64 | } | |
@@ -65,9 +69,11 @@ public static IntPtr tp_descr_get(IntPtr ds, IntPtr ob, IntPtr tp) | |||
| 65 | 69 | return Exceptions.RaiseTypeError("invalid target"); | |
| 66 | 70 | } | |
| 67 | 71 | ||
| 72 | + ts = PythonEngine.BeginAllowThreads(); | ||
| 68 | 73 | try | |
| 69 | 74 | { | |
| 70 | 75 | result = self.info.GetValue(co.inst, null); | |
| 76 | + PythonEngine.EndAllowThreads(ts); | ||
| 71 | 77 | return Converter.ToPython(result, self.info.PropertyType); | |
| 72 | 78 | } | |
| 73 | 79 | catch (Exception e) | |
@@ -76,6 +82,7 @@ public static IntPtr tp_descr_get(IntPtr ds, IntPtr ob, IntPtr tp) | |||
| 76 | 82 | { | |
| 77 | 83 | e = e.InnerException; | |
| 78 | 84 | } | |
| 85 | + PythonEngine.EndAllowThreads(ts); | ||
| 79 | 86 | Exceptions.SetError(e); | |
| 80 | 87 | return IntPtr.Zero; | |
| 81 | 88 | } | |
@@ -92,6 +99,7 @@ public static IntPtr tp_descr_get(IntPtr ds, IntPtr ob, IntPtr tp) | |||
| 92 | 99 | var self = (PropertyObject)GetManagedObject(ds); | |
| 93 | 100 | MethodInfo setter = self.setter; | |
| 94 | 101 | object newval; | |
| 102 | + IntPtr ts = IntPtr.Zero; | ||
| 95 | 103 | ||
| 96 | 104 | if (val == IntPtr.Zero) | |
| 97 | 105 | { | |
@@ -132,12 +140,15 @@ public static IntPtr tp_descr_get(IntPtr ds, IntPtr ob, IntPtr tp) | |||
| 132 | 140 | Exceptions.RaiseTypeError("invalid target"); | |
| 133 | 141 | return -1; | |
| 134 | 142 | } | |
| 143 | + ts = PythonEngine.BeginAllowThreads(); | ||
| 135 | 144 | self.info.SetValue(co.inst, newval, null); | |
| 136 | 145 | } | |
| 137 | 146 | else | |
| 138 | 147 | { | |
| 148 | + ts = PythonEngine.BeginAllowThreads(); | ||
| 139 | 149 | self.info.SetValue(null, newval, null); | |
| 140 | 150 | } | |
| 151 | + PythonEngine.EndAllowThreads(ts); | ||
| 141 | 152 | return 0; | |
| 142 | 153 | } | |
| 143 | 154 | catch (Exception e) | |
@@ -146,6 +157,11 @@ public static IntPtr tp_descr_get(IntPtr ds, IntPtr ob, IntPtr tp) | |||
| 146 | 157 | { | |
| 147 | 158 | e = e.InnerException; | |
| 148 | 159 | } | |
| 160 | + | ||
| 161 | + if (IntPtr.Zero != ts) | ||
| 162 | + { | ||
| 163 | + PythonEngine.EndAllowThreads(ts); | ||
| 164 | + } | ||
| 149 | 165 | Exceptions.SetError(e); | |
| 150 | 166 | return -1; | |
| 151 | 167 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments