Skip to content

Commit

Permalink
Use PyUnicode_EqualToUTF8().
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Nov 6, 2024
1 parent 378a095 commit b111e89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -5100,7 +5100,7 @@ static PyObject *
Pickler_getattr(PyObject *self, PyObject *name)
{
if (PyUnicode_Check(name)
&& PyUnicode_CompareWithASCIIString(name, "persistent_id") == 0
&& PyUnicode_EqualToUTF8(name, "persistent_id")
&& ((PicklerObject *)self)->persistent_id_attr)
{
return Py_NewRef(((PicklerObject *)self)->persistent_id_attr);
Expand All @@ -5113,7 +5113,7 @@ static int
Pickler_setattr(PyObject *self, PyObject *name, PyObject *value)
{
if (PyUnicode_Check(name)
&& PyUnicode_CompareWithASCIIString(name, "persistent_id") == 0)
&& PyUnicode_EqualToUTF8(name, "persistent_id"))
{
Py_XINCREF(value);
Py_XSETREF(((PicklerObject *)self)->persistent_id_attr, value);
Expand Down

0 comments on commit b111e89

Please sign in to comment.