bpo-39465: Don't access directly _Py_Identifier members (GH-20043)

* Replace id->object with _PyUnicode_FromId(&id)
* Use _Py_static_string_init(str) macro to initialize statically
  name_op in typeobject.c.
This commit is contained in:
Victor Stinner 2020-05-12 01:43:38 +02:00 committed by GitHub
parent 27c0d9b54a
commit 4804b5b3df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View file

@ -4414,7 +4414,7 @@ special_lookup(PyThreadState *tstate, PyObject *o, _Py_Identifier *id)
PyObject *res;
res = _PyObject_LookupSpecial(o, id);
if (res == NULL && !_PyErr_Occurred(tstate)) {
_PyErr_SetObject(tstate, PyExc_AttributeError, id->object);
_PyErr_SetObject(tstate, PyExc_AttributeError, _PyUnicode_FromId(id));
return NULL;
}
return res;