]> granicus.if.org Git - python/commitdiff
Issue #29190: Fixed possible errors in comparing strings in the pickle module.
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 9 Jan 2017 08:09:43 +0000 (10:09 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 9 Jan 2017 08:09:43 +0000 (10:09 +0200)
1  2 
Modules/_pickle.c

index 79113e0a93bb770ad747dabb5e188285529b5ca7,0f62b1c019c9785ac3e68698d4657115336bd365..920b46fc28595f1f1166ac7551ee64883c728869
@@@ -3551,13 -3530,14 +3546,12 @@@ save_reduce(PicklerObject *self, PyObje
              PyErr_Clear();
          }
          else if (PyUnicode_Check(name)) {
 -            if (self->proto >= 4) {
 -                _Py_IDENTIFIER(__newobj_ex__);
 -                use_newobj_ex = _PyUnicode_EqualToASCIIId(
 -                        name, &PyId___newobj_ex__);
 -            }
 +            _Py_IDENTIFIER(__newobj_ex__);
-             use_newobj_ex = PyUnicode_Compare(
-                     name, _PyUnicode_FromId(&PyId___newobj_ex__)) == 0;
++            use_newobj_ex = _PyUnicode_EqualToASCIIId(
++                    name, &PyId___newobj_ex__);
              if (!use_newobj_ex) {
                  _Py_IDENTIFIER(__newobj__);
-                 use_newobj = PyUnicode_Compare(
-                         name, _PyUnicode_FromId(&PyId___newobj__)) == 0;
+                 use_newobj = _PyUnicode_EqualToASCIIId(name, &PyId___newobj__);
              }
          }
          Py_XDECREF(name);