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-1635741: prepare for multi-phase init for unicodedata #21418

Closed

Conversation

koubaa
Copy link
Contributor

@koubaa koubaa commented Jul 9, 2020

See this PR for a discussion of this change

@vstinner
Copy link
Member

cc @corona10 @shihai1991

@shihai1991
Copy link
Member

shihai1991 commented Jul 11, 2020

ucnhash_CAPI is a C API, it means other users could calling `PyCapsule_Import()' to use it. We never know the user how to use it.

@koubaa
Copy link
Contributor Author

koubaa commented Jul 27, 2020

@shihai1991 In CPython source code, all of the usages are accounted for. Technically you are right that extension modules outside of CPython could be calling these capsule methods. I don't know how to measure the likelyhood of that but it would be a runtime error.

I can turn it into a compile-time error by replacing the capsule methods with small wrappers that have one fewer argument. Then those extension modules if they exist can conditionally compile based on the cpython version.

@shihai1991
Copy link
Member

@shihai1991 In CPython source code, all of the usages are accounted for. Technically you are right that extension modules outside of CPython could be calling these capsule methods. I don't know how to measure the likelyhood of that but it would be a runtime error.

I can turn it into a compile-time error by replacing the capsule methods with small wrappers that have one fewer argument. Then those extension modules if they exist can conditionally compile based on the cpython version.

We need to be careful to break the backward compatibility. Hi, victor, what's your opinion?

@vstinner
Copy link
Member

vstinner commented Aug 3, 2020

Hi, victor, what's your opinion?

Leave C extensions which expose a capsule unchanged, until the capsule API is modified to pass the module to functions exported as capsule.

I suggest to open an issue to propose to enhance the capsule API for that.

@koubaa
Copy link
Contributor Author

koubaa commented Aug 4, 2020

@vstinner In that case I think this PR is ready to be merged

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

I dislike this approach and would prefer to enhance the capsule API to pass the module instance to function exported as a capsule API.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@koubaa koubaa closed this Aug 9, 2020
@koubaa koubaa deleted the bpo-1635741-unicodedata-ucd-check branch August 28, 2020 00:21
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