Changeset 107794 in vbox for trunk/src/libs/xpcom18a4/python
- Timestamp:
- Jan 15, 2025 4:28:07 PM (5 weeks ago)
- svn:sync-xref-src-repo-rev:
- 166933
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/python/src/PyIID.cpp
r103125 r107794 240 240 { 0, NULL } /* terminator */ 241 241 }; 242 243 /* The parent/base class specified in Py_tp_base (&PyType_Type) here is larger 244 * than the Py_nsIID derived class so we need to ensure enough space is allocated 245 * for both when calling PyType_FromSpec(), i.e.: PyType_Type.tp_basicsize + 246 * sizeof(Py_nsIID). Starting with Python 3.12 when 'basicsize' is negative "the 247 * absolute value specifies how much space instances of the class need in addition 248 * to the superclass". Earlier Python releases require calculating the total size 249 * by hand. */ 250 #if PY_VERSION_HEX >= 0x030C0000 251 int basicsize = -(int)sizeof(Py_nsIID); 252 #else 253 /* PyObjects are opaque in the Py_LIMITED_API so we must use PyObject_GetAttrString() here. */ 254 PyObject *sizeObj = PyObject_GetAttrString((PyObject*)&PyType_Type, "__basicsize__"); 255 int basicsize = (int)PyLong_AsLong(sizeObj) + (int)sizeof(Py_nsIID); 256 #endif 242 257 PyType_Spec TypeSpec = { 243 258 /* .name: */ "IID", 244 /* .basicsize: */ sizeof(Py_nsIID),259 /* .basicsize: */ basicsize, 245 260 /* .itemsize: */ 0, 246 261 /* .flags: */ Py_TPFLAGS_DEFAULT,
Note:
See TracChangeset
for help on using the changeset viewer.