~jelmer/meliae/parentheses

« back to all changes in this revision

Viewing changes to meliae/_scanner_core.c

  • Committer: John Arbash Meinel
  • Date: 2020-01-30 12:38:45 UTC
  • mfrom: (208.2.1 py-type-macro)
  • Revision ID: john@arbash-meinel.com-20200130123845-59yraxcno3oyga55
Switch from accessing ob_type to using Py_TYPE

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
_basic_object_size(PyObject *c_obj)
80
80
{
81
81
    Py_ssize_t size;
82
 
    size = c_obj->ob_type->tp_basicsize;
 
82
    size = Py_TYPE(c_obj)->tp_basicsize;
83
83
    if (PyObject_IS_GC(c_obj)) {
84
84
        size += sizeof(PyGC_Head);
85
85
    }
98
98
        PyErr_Clear();
99
99
    }
100
100
    return _basic_object_size((PyObject *)c_obj)
101
 
            + num_entries * c_obj->ob_type->tp_itemsize;
 
101
            + num_entries * Py_TYPE(c_obj)->tp_itemsize;
102
102
}
103
103
 
104
104
static Py_ssize_t
227
227
     * method.
228
228
     */
229
229
 
230
 
    if (c_obj->ob_type->tp_itemsize != 0) {
 
230
    if (Py_TYPE(c_obj)->tp_itemsize != 0) {
231
231
        // Variable length object with inline storage
232
232
        // total size is tp_itemsize * ob_size
233
233
        return _var_object_size((PyVarObject *)c_obj);
500
500
    _last_dumped = c_obj;
501
501
    _write_to_ref_info(info, "{\"address\": %lu, \"type\": ",
502
502
                       (unsigned long)c_obj);
503
 
    _dump_json_c_string(info, c_obj->ob_type->tp_name, -1);
 
503
    _dump_json_c_string(info, Py_TYPE(c_obj)->tp_name, -1);
504
504
    _write_to_ref_info(info, ", \"size\": " SSIZET_FMT, _size_of(c_obj));
505
505
    //  HANDLE __name__
506
506
    if (PyModule_Check(c_obj)) {