Skip to content

gh-103583: Isolate CJK codec modules - #103869

Merged
erlend-aasland merged 7 commits into
python:mainfrom
erlend-aasland:isolate-cjk-alt2
Apr 27, 2023
Merged

erlend-aasland merged 7 commits into
python:mainfrom
erlend-aasland:isolate-cjk-alt2

Conversation

@erlend-aasland

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

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

Copy link
Copy Markdown
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
Copy Markdown

🤖 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
Copy Markdown
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

erlend-aasland commented Apr 26, 2023 •

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor Author

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

@corona10

Copy link
Copy Markdown
Member

@erlend-aasland I will take a look by tomorrow

@erlend-aasland

Copy link
Copy Markdown
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
Copy Markdown

🤖 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 Apr 26, 2023
@erlend-aasland erlend-aasland linked an issue Apr 26, 2023 that may be closed by this pull request
Comment thread Modules/cjkcodecs/cjkcodecs.h Resolved

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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

vstinner commented May 4, 2023

Copy link
Copy Markdown
Member

Well done @erlend-aasland!

@erlend-aasland

Copy link
Copy Markdown
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

5 participants