diff options
| author | Victor Stinner <vstinner@python.org> | 2020-05-12 01:43:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-12 01:43:38 +0200 |
| commit | 4804b5b3df82e7892ca0550b02f902bcfc16bb48 (patch) | |
| tree | a5c199a893d417fcce434e4412373e9a3ecd557f /Objects/typeobject.c | |
| parent | 27c0d9b54abaa4112d5a317b8aa78b39ad60a808 (diff) | |
| download | cpython-git-4804b5b3df82e7892ca0550b02f902bcfc16bb48.tar.gz | |
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.
Diffstat (limited to 'Objects/typeobject.c')
| -rw-r--r-- | Objects/typeobject.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a36b4dcc46..243f8811b6 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1519,7 +1519,7 @@ lookup_method(PyObject *self, _Py_Identifier *attrid, int *unbound) { PyObject *res = lookup_maybe_method(self, attrid, unbound); if (res == NULL && !PyErr_Occurred()) { - PyErr_SetObject(PyExc_AttributeError, attrid->object); + PyErr_SetObject(PyExc_AttributeError, _PyUnicode_FromId(attrid)); } return res; } @@ -6864,12 +6864,12 @@ slot_tp_setattro(PyObject *self, PyObject *name, PyObject *value) } static _Py_Identifier name_op[] = { - {0, "__lt__", 0}, - {0, "__le__", 0}, - {0, "__eq__", 0}, - {0, "__ne__", 0}, - {0, "__gt__", 0}, - {0, "__ge__", 0} + _Py_static_string_init("__lt__"), + _Py_static_string_init("__le__"), + _Py_static_string_init("__eq__"), + _Py_static_string_init("__ne__"), + _Py_static_string_init("__gt__"), + _Py_static_string_init("__ge__"), }; static PyObject * |
