-
-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-30732: json.dumps() lacks information about RecursionError relate… #2857
base: main
Are you sure you want to change the base?
Conversation
…d to default function
Modules/_json.c
Outdated
@@ -1503,6 +1503,13 @@ encoder_listencode_obj(PyEncoderObject *s, _PyAccu *acc, | |||
} | |||
} | |||
newobj = PyObject_CallFunctionObjArgs(s->defaultfn, obj, NULL); | |||
if (obj != NULL && newobj != NULL && newobj->ob_type == obj->ob_type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about if (PyObject_IsInstance(newobj, (PyObject *) Py_TYPE(obj))) {
?
Also, I think this can put above the check of if (newobj == NULL)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't PyObject_IsInstance raise false positives for our condition? For this fix, we would want the exact types to match, isn't it?
…d to default function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the right solution. Here are just style comments.
…d to default function
Ignore the identation changes please, its still not aligned. |
…d to default function
This PR is stale because it has been open for 30 days with no activity. |
This PR is stale because it has been open for 30 days with no activity. |
I was not able to modify the original PR, so I created a new one: #113458. |
This PR is stale because it has been open for 30 days with no activity. |
Please review.
https://bugs.python.org/issue30732
#74917