[3.13] gh-122311: Fix some error messages in pickle (GH-122386) (GH-122387)

(cherry picked from commit 3b034d26eb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-07-29 11:27:14 +02:00 committed by GitHub
parent d113359341
commit c26dd270f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 7 deletions

View file

@ -1817,10 +1817,10 @@ get_dotted_path(PyObject *obj, PyObject *name)
if (_PyUnicode_EqualToASCIIString(subpath, "<locals>")) {
if (obj == NULL)
PyErr_Format(PyExc_AttributeError,
"Can't pickle local object %R", name);
"Can't get local object %R", name);
else
PyErr_Format(PyExc_AttributeError,
"Can't pickle local attribute %R on %R", name, obj);
"Can't get local attribute %R on %R", name, obj);
Py_DECREF(dotted_path);
return NULL;
}
@ -2507,7 +2507,7 @@ save_picklebuffer(PickleState *st, PicklerObject *self, PyObject *obj)
{
if (self->proto < 5) {
PyErr_SetString(st->PicklingError,
"PickleBuffer can only pickled with protocol >= 5");
"PickleBuffer can only be pickled with protocol >= 5");
return -1;
}
const Py_buffer* view = PyPickleBuffer_GetBuffer(obj);