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-40077: Convert _jsonmodule to use PyType_FromSpec. #19177

Merged
merged 6 commits into from
Mar 27, 2020

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Mar 26, 2020

Modules/_json.c Outdated Show resolved Hide resolved
Modules/_json.c Outdated Show resolved Hide resolved
Modules/_json.c Show resolved Hide resolved
Modules/_json.c Outdated Show resolved Hide resolved
Modules/_json.c Outdated Show resolved Hide resolved
Modules/_json.c Outdated Show resolved Hide resolved
Modules/_json.c Outdated Show resolved Hide resolved
Modules/_json.c Outdated Show resolved Hide resolved
@corona10 corona10 requested a review from vstinner March 26, 2020 19:23
encoder_clear(self);
Py_TYPE(self)->tp_free(self);
encoder_clear((PyEncoderObject *)self);
tp->tp_free(self);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current code is just fine, no? I don't see the value of tp. It seems like it comes from a previous change that you reverted.

Suggested change
tp->tp_free(self);
Py_TYPE(self)->tp_free(self);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vstinner
Py_DECREF(tp);is needed if not test is leaked.
This is why I declared tp ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_json leaked [114, 114, 114] references, sum=342
test_json failed in 35.6 sec

Modules/_json.c Outdated Show resolved Hide resolved
Modules/_json.c Outdated Show resolved Hide resolved
Modules/_json.c Show resolved Hide resolved
Modules/_json.c Outdated Show resolved Hide resolved
@corona10 corona10 requested a review from vstinner March 27, 2020 03:16
@corona10
Copy link
Member Author

@vstinner
Thanks for the review. :)
I 've applied all of your comment except #19177 (comment) :)

Please take a look

@vstinner vstinner merged commit 33f15a1 into python:master Mar 27, 2020
@vstinner
Copy link
Member

Thanks @corona10, this change was interesting. I learnt a few things :-) I merged your PR, but I completed the commit message to elaborate on changes that you wrote.

@vstinner
Copy link
Member

vstinner commented Apr 1, 2020

I mentioned the removed assertions in bpo-40137 that I just created: TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants