summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-02-07 01:24:48 (GMT)
committerGitHub <noreply@github.com>2020-02-07 01:24:48 (GMT)
commita102ed7d2f0e7e05438f14d5fb72ca0358602249 (patch)
treea5a3aca7a251c82d7b35c130cc913d6009baa18a /Python/ceval.c
parent38aaaaac805fa30870e2d093e52a900dddde3b34 (diff)
downloadcpython-a102ed7d2f0e7e05438f14d5fb72ca0358602249.zip
cpython-a102ed7d2f0e7e05438f14d5fb72ca0358602249.tar.gz
cpython-a102ed7d2f0e7e05438f14d5fb72ca0358602249.tar.bz2
bpo-39573: Use Py_TYPE() macro in Python and Include directories (GH-18391)
Replace direct access to PyObject.ob_type with Py_TYPE().
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 892d668..c36a38e 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2633,7 +2633,7 @@ main_loop:
PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable);
if (none_val == NULL) {
if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) &&
- (iterable->ob_type->tp_iter == NULL && !PySequence_Check(iterable)))
+ (Py_TYPE(iterable)->tp_iter == NULL && !PySequence_Check(iterable)))
{
_PyErr_Clear(tstate);
_PyErr_Format(tstate, PyExc_TypeError,
@@ -2803,7 +2803,7 @@ main_loop:
if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) {
_PyErr_Format(tstate, PyExc_TypeError,
"'%.200s' object is not a mapping",
- update->ob_type->tp_name);
+ Py_TYPE(update)->tp_name);
}
Py_DECREF(update);
goto error;
@@ -3158,7 +3158,7 @@ main_loop:
PREDICTED(FOR_ITER);
/* before: [iter]; after: [iter, iter()] *or* [] */
PyObject *iter = TOP();
- PyObject *next = (*iter->ob_type->tp_iternext)(iter);
+ PyObject *next = (*Py_TYPE(iter)->tp_iternext)(iter);
if (next != NULL) {
PUSH(next);
PREDICT(STORE_FAST);
@@ -4369,11 +4369,11 @@ unpack_iterable(PyThreadState *tstate, PyObject *v,
it = PyObject_GetIter(v);
if (it == NULL) {
if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) &&
- v->ob_type->tp_iter == NULL && !PySequence_Check(v))
+ Py_TYPE(v)->tp_iter == NULL && !PySequence_Check(v))
{
_PyErr_Format(tstate, PyExc_TypeError,
"cannot unpack non-iterable %.200s object",
- v->ob_type->tp_name);
+ Py_TYPE(v)->tp_name);
}
return 0;
}
@@ -4790,7 +4790,7 @@ PyEval_GetFuncName(PyObject *func)
else if (PyCFunction_Check(func))
return ((PyCFunctionObject*)func)->m_ml->ml_name;
else
- return func->ob_type->tp_name;
+ return Py_TYPE(func)->tp_name;
}
const char *
@@ -5197,7 +5197,7 @@ import_all_from(PyThreadState *tstate, PyObject *locals, PyObject *v)
static int
check_args_iterable(PyThreadState *tstate, PyObject *func, PyObject *args)
{
- if (args->ob_type->tp_iter == NULL && !PySequence_Check(args)) {
+ if (Py_TYPE(args)->tp_iter == NULL && !PySequence_Check(args)) {
/* check_args_iterable() may be called with a live exception:
* clear it to prevent calling _PyObject_FunctionStr() with an
* exception set. */