Skip to content

bpo-41798: Allocate unicodedata CAPI on the heap #24128

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

Merged
merged 3 commits into from
Jan 20, 2021

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Jan 5, 2021

@erlend-aasland
Copy link
Contributor Author

cc @shihai1991

PyMem_Free(capi);
return -1;
}
if (PyModule_AddObject(module, "_ucnhash_CAPI", capsule) < 0) {
Copy link
Member

Choose a reason for hiding this comment

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

How about using PyModule_AddObjectRef in here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could do that, but I'm not sure it would improve this code. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

PyModule_AddObjectRef() is more easy to understand than PyModule_AddObject(), because PyModule_AddObject() will steal the refs sometimes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After thinking about it, I do agree. It's easier to follow the ref count when reading the code. I'll change it. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I change the other PyModule_AddObject in unicodedata_exec() while we're there?

@erlend-aasland
Copy link
Contributor Author

@vstinner, would you mind reviewing this?

@vstinner
Copy link
Member

vstinner commented Jan 8, 2021

@vstinner, would you mind reviewing this?

Not yet. I'm fixing the second regression caused by your latest change :-D https://bugs.python.org/issue42866 I'm not blaming you, regressions are common, and I'm fine with dealing with them. It's just that I prefer to fix all known regressions before taking the risk of adding new ones ;-)

@erlend-aasland
Copy link
Contributor Author

Not yet. I'm fixing the second regression caused by your latest change :-D https://bugs.python.org/issue42866 I'm not blaming you, regressions are common, and I'm fine with dealing with them. It's just that I prefer to fix all known regressions before taking the risk of adding new ones ;-)

I totally understand that, and I appreciate you helping out fixing the regressions :)

@erlend-aasland
Copy link
Contributor Author

PTAL, @vstinner

@vstinner vstinner merged commit 61d2639 into python:master Jan 20, 2021
@vstinner
Copy link
Member

Merged, thanks.

@erlend-aasland erlend-aasland deleted the bpo-41798/unicodedata branch January 20, 2021 11:04
@erlend-aasland
Copy link
Contributor Author

Merged, thanks.

Thanks for reviewing!

adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants