Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PR feedback
  • Loading branch information
csm10495 committed May 11, 2023
commit e08e2175fac239a1ff8a4e701e31090ca2c669d1
3 changes: 1 addition & 2 deletions Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,7 @@ def testAttributes(self):
try:
e = exc(*args, **kwargs)
except:
print("\nexc=%r, args=%r, kwargs=%r" %
(exc, args, kwargs), file=sys.stderr)
print(f"\nexc={exc!r}, args={args!r}", file=sys.stderr)
# raise
else:
# Verify module name
Expand Down
6 changes: 1 addition & 5 deletions Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2292,7 +2292,7 @@ static PyObject *
AttributeError_getstate(PyAttributeErrorObject *self, PyObject *Py_UNUSED(ignored))
{
PyObject *dict = ((PyAttributeErrorObject *)self)->dict;
if (self->name || self->obj || self->args) {
if (self->name || self->args) {
dict = dict ? PyDict_Copy(dict) : PyDict_New();
if (dict == NULL)
return NULL;
Expand All @@ -2302,10 +2302,6 @@ AttributeError_getstate(PyAttributeErrorObject *self, PyObject *Py_UNUSED(ignore
}
/* We specifically are not pickling the obj attribute since there are many
cases where it is unlikely to be picklable. See GH-103352.
if (self->obj && PyDict_SetItemString(dict, "obj", self->obj) < 0) {
Py_DECREF(dict);
return NULL;
}
*/
if (self->args && PyDict_SetItemString(dict, "args", self->args) < 0) {
Py_DECREF(dict);
Expand Down