GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-103583: Add codecs and maps to _codecs_* module state by erlend-aasland · Pull Request #103540 · python/cpython

Conversation

@erlend-aasland

@erlend-aasland erlend-aasland commented Apr 14, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Isolate Stdlib Extension Modules #103092
  • Isolate _multibytecodec #103583

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
erlend-aasland added 2 commits April 13, 2023 21:07
@erlend-aasland
Rename module state struct
ed80fe3
The current naming is too confusing, since we've also got MultibyteCodec_State
@erlend-aasland
Add codec and mapping lists to codec module states
f5b906f
@bedevere-bot bedevere-bot mentioned this pull request Apr 14, 2023
Isolate Stdlib Extension Modules #103092
Closed
24 of 25 tasks
@bedevere-bot bedevere-bot added the awaiting core review label Apr 14, 2023
@erlend-aasland

erlend-aasland commented Apr 14, 2023

Copy link
Copy Markdown
Contributor Author

I've done a couple of experiments with isolating the codec submodules, but it gets hairy pretty quickly. If any of you see an elegant solution, please shout out.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Apr 14, 2023

Copy link
Copy Markdown
Contributor Author

Also: this is very much WIP. With this PR, I've tried to keep the diff small, but I really do not like all these macro templates. It all feels very fragile to me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Apr 14, 2023

Copy link
Copy Markdown
Contributor Author

Most of the remaining globals are just static data, as far as I can see. Perhaps the solution is as easy as making sure they all live in the const data segment and forget about module state.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Silence unused variable warnings
9973a7d
@erlend-aasland

erlend-aasland commented Apr 14, 2023

Copy link
Copy Markdown
Contributor Author

@corona10, as the code owner for these modules: what do you think about the approach taken in this PR? IMO, I'm not too fond of using macros for so much templating, but I went for it nonetheless since that's the approach already taken by this part of the code base.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@corona10

corona10 commented Apr 15, 2023

Copy link
Copy Markdown
Member

@erlend-aasland Will take a look by this weekend :) Thanks

erlend-aasland reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

corona10
corona10 reviewed Apr 16, 2023
View reviewed changes
Comment thread Modules/cjkcodecs/cjkcodecs.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

corona10
corona10 reviewed Apr 16, 2023
View reviewed changes
Comment thread Modules/cjkcodecs/cjkcodecs.h
static const MultibyteCodec *codec_list = \
(const MultibyteCodec *)_codec_list;

#define CODEC_STATEFUL(enc) \

@corona10 corona10 Apr 16, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Wow, readability will be frustrating (it's not your fault), I will think about a better way.. :(

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@erlend-aasland erlend-aasland Apr 16, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I know, readability is already frustrating with these modules. If we are to keep the diff down, we just have to go with the macro template style already used. An alternative is to refactor the modules first, but that bears a risk.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@corona10 corona10 added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 16, 2023
@bedevere-bot

bedevere-bot commented Apr 16, 2023

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @corona10 for commit 9973a7d 🤖

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 16, 2023
@corona10 corona10 self-assigned this Apr 16, 2023
@erlend-aasland erlend-aasland changed the title gh-103092: Isolate _multibytecodec gh-103583: Isolate _multibytecodec Apr 16, 2023
@bedevere-bot bedevere-bot mentioned this pull request Apr 16, 2023
Isolate _multibytecodec #103583
Closed
@erlend-aasland
erlend-aasland marked this pull request as ready for review April 16, 2023 21:51
@erlend-aasland

erlend-aasland commented Apr 16, 2023

Copy link
Copy Markdown
Contributor Author

Are you happy with these changes as they stand, @corona10?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland erlend-aasland added the skip news label Apr 16, 2023
corona10
corona10 approved these changes Apr 16, 2023
View reviewed changes

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lgtm :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Apr 16, 2023
erlend-aasland
erlend-aasland commented Apr 16, 2023
View reviewed changes
Comment thread Modules/cjkcodecs/_codecs_iso2022.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland added 2 commits April 16, 2023 17:31
@erlend-aasland
Pull in main
605c4fb
@erlend-aasland
Hide ugly code in macro
65af110
@erlend-aasland erlend-aasland added the 🤖 automerge label Apr 16, 2023
@erlend-aasland

erlend-aasland commented Apr 16, 2023

Copy link
Copy Markdown
Contributor Author

Thanks for the review, Dong-hee! :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland erlend-aasland changed the title gh-103583: Isolate _multibytecodec gh-103583: Add codecs and maps to _codecs_* module state Apr 16, 2023
@erlend-aasland erlend-aasland added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 16, 2023
@bedevere-bot

bedevere-bot commented Apr 16, 2023

Copy link
Copy Markdown

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

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 16, 2023
@miss-islington

miss-islington commented Apr 17, 2023

Copy link
Copy Markdown
Contributor

Status check is done, and it's a success ✅.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
erlend-aasland merged commit 217911e into python:main Apr 17, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Apr 17, 2023
carljm added a commit to carljm/cpython that referenced this pull request Apr 17, 2023
@carljm
Merge branch 'main' into superopt
5136459
* main:
  Remove `expert-*` from `project-updater` GH workflow (python#103579)
  pythongh-103583: Add codecs and maps to _codecs_* module state (python#103540)
  pythongh-48330: address review comments to PR-12271 (python#103209)
  pythongh-103527: Add multibytecodec.h as make dep for _codecs_* (python#103567)
  pythongh-103553: Improve `test_inspect`: add more assertions, remove unused (python#103554)
  pythonGH-103517: Improve tests for `pathlib.Path.walk()` (pythonGH-103518)
  pythongh-102114: Make dis print more concise tracebacks for syntax errors in str inputs (python#102115)
  pythonGH-78079: Fix UNC device path root normalization in pathlib (pythonGH-102003)
  pythongh-101517: Add regression test for a lineno bug in try/except* impacting pdb (python#103547)
  pythongh-103527: Add make deps for _codecs_* and _multibytecodec (python#103528)
  pythongh-103532: Fix reST syntax in NEWS entry (pythonGH-103544)
  pythongh-103532: Add NEWS entry (python#103542)
carljm added a commit to carljm/cpython that referenced this pull request Apr 17, 2023
@carljm
Merge branch 'superopt' into superopt_spec
079c65a
* superopt:
  update generated cases with new comment
  review comments
  Remove `expert-*` from `project-updater` GH workflow (python#103579)
  pythongh-103583: Add codecs and maps to _codecs_* module state (python#103540)
  pythongh-48330: address review comments to PR-12271 (python#103209)
  pythongh-103527: Add multibytecodec.h as make dep for _codecs_* (python#103567)
  pythongh-103553: Improve `test_inspect`: add more assertions, remove unused (python#103554)
  pythonGH-103517: Improve tests for `pathlib.Path.walk()` (pythonGH-103518)
  pythongh-102114: Make dis print more concise tracebacks for syntax errors in str inputs (python#102115)
  pythonGH-78079: Fix UNC device path root normalization in pathlib (pythonGH-102003)
  pythongh-101517: Add regression test for a lineno bug in try/except* impacting pdb (python#103547)
  pythongh-103527: Add make deps for _codecs_* and _multibytecodec (python#103528)
  pythongh-103532: Fix reST syntax in NEWS entry (pythonGH-103544)
  pythongh-103532: Add NEWS entry (python#103542)
@erlend-aasland
erlend-aasland deleted the isolate-multibytecodec branch July 4, 2023 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@corona10 corona10 corona10 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@corona10 corona10

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@erlend-aasland @corona10 @bedevere-bot @miss-islington
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.