| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -120,7 +120,7 @@ PyAPI_FUNC(PyLongObject*) _PyLong_FromDigits( | |||
| 120 | 120 | ||
| 121 | 121 | static inline int | |
| 122 | 122 | _PyLong_IsCompact(const PyLongObject* op) { | |
| 123 | - assert(PyType_HasFeature((op)->ob_base.ob_type, Py_TPFLAGS_LONG_SUBCLASS)); | ||
| 123 | + assert(PyType_HasFeature(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)); | ||
| 124 | 124 | return op->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS); | |
| 125 | 125 | } | |
| 126 | 126 | ||
@@ -130,7 +130,7 @@ static inline Py_ssize_t | |||
| 130 | 130 | _PyLong_CompactValue(const PyLongObject *op) | |
| 131 | 131 | { | |
| 132 | 132 | Py_ssize_t sign; | |
| 133 | - assert(PyType_HasFeature((op)->ob_base.ob_type, Py_TPFLAGS_LONG_SUBCLASS)); | ||
| 133 | + assert(PyType_HasFeature(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)); | ||
| 134 | 134 | assert(PyUnstable_Long_IsCompact(op)); | |
| 135 | 135 | sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK); | |
| 136 | 136 | return sign * (Py_ssize_t)op->long_value.ob_digit[0]; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -261,8 +261,8 @@ PyAPI_DATA(PyTypeObject) PyBool_Type; | |||
| 261 | 261 | ||
| 262 | 262 | // bpo-39573: The Py_SET_SIZE() function must be used to set an object size. | |
| 263 | 263 | static inline Py_ssize_t Py_SIZE(PyObject *ob) { | |
| 264 | - assert(ob->ob_type != &PyLong_Type); | ||
| 265 | - assert(ob->ob_type != &PyBool_Type); | ||
| 264 | + assert(Py_TYPE(ob) != &PyLong_Type); | ||
| 265 | + assert(Py_TYPE(ob) != &PyBool_Type); | ||
| 266 | 266 | return _PyVarObject_CAST(ob)->ob_size; | |
| 267 | 267 | } | |
| 268 | 268 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 | |
@@ -289,8 +289,8 @@ static inline void Py_SET_TYPE(PyObject *ob, PyTypeObject *type) { | |||
| 289 | 289 | #endif | |
| 290 | 290 | ||
| 291 | 291 | static inline void Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size) { | |
| 292 | - assert(ob->ob_base.ob_type != &PyLong_Type); | ||
| 293 | - assert(ob->ob_base.ob_type != &PyBool_Type); | ||
| 292 | + assert(Py_TYPE(_PyObject_CAST(ob)) != &PyLong_Type); | ||
| 293 | + assert(Py_TYPE(_PyObject_CAST(ob)) != &PyBool_Type); | ||
| 294 | 294 | #ifdef Py_GIL_DISABLED | |
| 295 | 295 | _Py_atomic_store_ssize_relaxed(&ob->ob_size, size); | |
| 296 | 296 | #else | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3090,7 +3090,7 @@ static PyDateTime_Delta * | |||
| 3090 | 3090 | look_up_delta(int days, int seconds, int microseconds, PyTypeObject *type) | |
| 3091 | 3091 | { | |
| 3092 | 3092 | if (days == 0 && seconds == 0 && microseconds == 0 | |
| 3093 | - && type == zero_delta.ob_base.ob_type) | ||
| 3093 | + && type == Py_TYPE(&zero_delta)) | ||
| 3094 | 3094 | { | |
| 3095 | 3095 | return &zero_delta; | |
| 3096 | 3096 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2389,7 +2389,7 @@ PyObject * | |||
| 2389 | 2389 | _PyDict_GetItemWithError(PyObject *dp, PyObject *kv) | |
| 2390 | 2390 | { | |
| 2391 | 2391 | assert(PyUnicode_CheckExact(kv)); | |
| 2392 | - Py_hash_t hash = kv->ob_type->tp_hash(kv); | ||
| 2392 | + Py_hash_t hash = Py_TYPE(kv)->tp_hash(kv); | ||
| 2393 | 2393 | if (hash == -1) { | |
| 2394 | 2394 | return NULL; | |
| 2395 | 2395 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2083,7 +2083,7 @@ PyVarObject * | |||
| 2083 | 2083 | _PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems) | |
| 2084 | 2084 | { | |
| 2085 | 2085 | const size_t basicsize = _PyObject_VAR_SIZE(Py_TYPE(op), nitems); | |
| 2086 | - const size_t presize = _PyType_PreHeaderSize(((PyObject *)op)->ob_type); | ||
| 2086 | + const size_t presize = _PyType_PreHeaderSize(Py_TYPE(op)); | ||
| 2087 | 2087 | _PyObject_ASSERT((PyObject *)op, !_PyObject_GC_IS_TRACKED(op)); | |
| 2088 | 2088 | if (basicsize > (size_t)PY_SSIZE_T_MAX - presize) { | |
| 2089 | 2089 | return (PyVarObject *)PyErr_NoMemory(); | |
@@ -2101,15 +2101,15 @@ _PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems) | |||
| 2101 | 2101 | void | |
| 2102 | 2102 | PyObject_GC_Del(void *op) | |
| 2103 | 2103 | { | |
| 2104 | - size_t presize = _PyType_PreHeaderSize(((PyObject *)op)->ob_type); | ||
| 2104 | + size_t presize = _PyType_PreHeaderSize(Py_TYPE(op)); | ||
| 2105 | 2105 | PyGC_Head *g = AS_GC(op); | |
| 2106 | 2106 | if (_PyObject_GC_IS_TRACKED(op)) { | |
| 2107 | 2107 | gc_list_remove(g); | |
| 2108 | 2108 | #ifdef Py_DEBUG | |
| 2109 | 2109 | PyObject *exc = PyErr_GetRaisedException(); | |
| 2110 | 2110 | if (PyErr_WarnExplicitFormat(PyExc_ResourceWarning, "gc", 0, | |
| 2111 | 2111 | "gc", NULL, "Object of type %s is not untracked before destruction", | |
| 2112 | - ((PyObject*)op)->ob_type->tp_name)) { | ||
| 2112 | + Py_TYPE(op)->tp_name)) { | ||
| 2113 | 2113 | PyErr_WriteUnraisable(NULL); | |
| 2114 | 2114 | } | |
| 2115 | 2115 | PyErr_SetRaisedException(exc); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -637,7 +637,7 @@ specialize_module_load_attr( | |||
| 637 | 637 | ) { | |
| 638 | 638 | _PyAttrCache *cache = (_PyAttrCache *)(instr + 1); | |
| 639 | 639 | PyModuleObject *m = (PyModuleObject *)owner; | |
| 640 | - assert((owner->ob_type->tp_flags & Py_TPFLAGS_MANAGED_DICT) == 0); | ||
| 640 | + assert((Py_TYPE(owner)->tp_flags & Py_TPFLAGS_MANAGED_DICT) == 0); | ||
| 641 | 641 | PyDictObject *dict = (PyDictObject *)m->md_dict; | |
| 642 | 642 | if (dict == NULL) { | |
| 643 | 643 | SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_NO_DICT); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments