| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1966,6 +1966,15 @@ internal static IntPtr PyMem_Realloc(IntPtr ptr, long size) | |||
| 1966 | 1966 | [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] | |
| 1967 | 1967 | internal static extern void PyErr_Print(); | |
| 1968 | 1968 | ||
| 1969 | + //==================================================================== | ||
| 1970 | + // Cell API | ||
| 1971 | + //==================================================================== | ||
| 1972 | + | ||
| 1973 | + [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] | ||
| 1974 | + internal static extern NewReference PyCell_Get(IntPtr cell); | ||
| 1975 | + | ||
| 1976 | + [DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] | ||
| 1977 | + internal static extern int PyCell_Set(IntPtr cell, IntPtr value); | ||
| 1969 | 1978 | ||
| 1970 | 1979 | //==================================================================== | |
| 1971 | 1980 | // Miscellaneous | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -280,6 +280,14 @@ internal static IntPtr CreateSubType(IntPtr py_name, IntPtr py_base_type, IntPtr | |||
| 280 | 280 | IntPtr cls_dict = Marshal.ReadIntPtr(py_type, TypeOffset.tp_dict); | |
| 281 | 281 | Runtime.PyDict_Update(cls_dict, py_dict); | |
| 282 | 282 | ||
| 283 | + // Update the __classcell__ if it exists | ||
| 284 | + IntPtr cell = Runtime.PyDict_GetItemString(cls_dict, "__classcell__"); | ||
| 285 | + if (cell != IntPtr.Zero) | ||
| 286 | + { | ||
| 287 | + Runtime.PyCell_Set(cell, py_type); | ||
| 288 | + Runtime.PyDict_DelItemString(cls_dict, "__classcell__"); | ||
| 289 | + } | ||
| 290 | + | ||
| 283 | 291 | return py_type; | |
| 284 | 292 | } | |
| 285 | 293 | catch (Exception e) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments