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

gh-103583: Isolate CJK codec modules #103869

Merged
merged 7 commits into from
Apr 27, 2023

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Apr 26, 2023

@erlend-aasland erlend-aasland marked this pull request as ready for review April 26, 2023 13:15
@erlend-aasland
Copy link
Contributor Author

This approach exploits the dependency introduced in gh-103589; we know for sure that the _codec* extension modules will outlive _multibytecodec. This means we can store the cjk codec module state safely in the codec struct and modify the various codec handlers to accept the codec struct (iso. void *config). Then we add custom cjk module state where needed, and conveniently fetch it from the codec struct. (Quick and dirty explanation; see the code if what I wrote does not make sense 😎)

@erlend-aasland erlend-aasland added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 26, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @erlend-aasland for commit ef983c4 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 26, 2023
@erlend-aasland
Copy link
Contributor Author

BTW, I removed the initialized guards. I'm pretty sure we can do that, but I haven't verified it yet.

@erlend-aasland
Copy link
Contributor Author

erlend-aasland commented Apr 26, 2023

Also, we can split out cb2c9e7 as a separate PR. That may be beneficial regarding to future bisects; it will also make this PR easier to review.

Similarly, f6ed5df can be split up to do the arg spec changes first, and then move stuff to module state afterwards.

@erlend-aasland
Copy link
Contributor Author

@vstinner, you want to take a look? :)

@corona10
Copy link
Member

@erlend-aasland I will take a look by tomorrow

@erlend-aasland
Copy link
Contributor Author

(Pulling in main to get the latest ref. leak fixes by Jelle)

@erlend-aasland erlend-aasland added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 26, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @erlend-aasland for commit dec79a7 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 26, 2023
@erlend-aasland erlend-aasland changed the title gh-103583: Isolate CJK modules, alternative 2 gh-103583: Isolate CJK codec modules Apr 26, 2023
@erlend-aasland erlend-aasland linked an issue Apr 26, 2023 that may be closed by this pull request
Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

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

LGTM, This is quite a complicated but nice approach. But nothing can be better than this.
Thanks for the hard work!

@erlend-aasland
Copy link
Contributor Author

Thanks for the review, Dong-hee! Yes, it is complicated, but as shown in my competing PRs, other approaches are even more complicated.

@erlend-aasland erlend-aasland merged commit 8a0c7f1 into python:main Apr 27, 2023
@erlend-aasland erlend-aasland deleted the isolate-cjk-alt2 branch April 27, 2023 13:02
@vstinner
Copy link
Member

vstinner commented May 4, 2023

Well done @erlend-aasland!

@erlend-aasland
Copy link
Contributor Author

Well done @erlend-aasland!

Thanks, Victor :) This was a tricky one!

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.

Isolate _multibytecodec
5 participants