Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

soolabettu
Copy link
Contributor

@soolabettu soolabettu commented Jul 25, 2017

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) {
Copy link
Contributor

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)

Copy link
Contributor Author

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?

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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.

Modules/_json.c Outdated Show resolved Hide resolved
Modules/_json.c Outdated Show resolved Hide resolved
@soolabettu
Copy link
Contributor Author

Ignore the identation changes please, its still not aligned.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Feb 20, 2022
@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Jul 29, 2022
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Aug 29, 2022
@serhiy-storchaka
Copy link
Member

I was not able to modify the original PR, so I created a new one: #113458.

Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review stale Stale PR or inactive for long period of time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants