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 — bpo-43693: Group the code in codeobject.c logically. by ericsnowcurrently · Pull Request #26216 · python/cpython

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented May 18, 2021 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

At the moment the code in codeobject.c is a bit scattered around, relative to the logical grouping of the code. This PR addresses that by moving various functions (and types) into logical groups, with a comment dividing them and identifying each group. With this change, subsequent changes I'm planning on making become cleaner, which is the main motivation here.

https://bugs.python.org/issue43693

Sorry, something went wrong.

Uh oh!

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

All reactions
@ericsnowcurrently
Group the code in codeobject.c logically, with a divider per comment.
842d522
@ericsnowcurrently ericsnowcurrently added the skip news label May 18, 2021
@ericsnowcurrently
ericsnowcurrently requested a review from markshannon as a code owner May 18, 2021 19:14
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label May 18, 2021
@bedevere-bot bedevere-bot added the awaiting core review label May 18, 2021
@gvanrossum gvanrossum mentioned this pull request May 18, 2021
bpo-43693: Compute deref offsets in compiler #25152
Merged
@gvanrossum

gvanrossum commented May 18, 2021

Copy link
Copy Markdown
Member

Can you confirm that this is a pure refactoring that doesn't change any APIs or semantics? (That's what it sounds like, but there's a lot of code in the diff...)

All reactions

Sorry, something went wrong.

Uh oh!

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

@ericsnowcurrently

ericsnowcurrently commented May 19, 2021

Copy link
Copy Markdown
Member Author

Yeah, it is almost exclusively only moving code around in the file. The only 2 exceptions are the addition of decode_linetable() and new_linesiterator(), which are just code_getlnotab() and code_linesiterator() (respectively) with tighter signatures.

All reactions

Sorry, something went wrong.

Uh oh!

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

@gvanrossum

gvanrossum commented May 19, 2021

Copy link
Copy Markdown
Member

Looks like you broke the argument clinic?

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon

markshannon commented May 19, 2021

Copy link
Copy Markdown
Member

This is almost certain to cause merge conflicts with work on PEP 657.
We will be removing all the opcache stuff in a month or two (PEP 659) so I wouldn't bother moving that around.

Given that the line number table is likely to grow and change with PEP 657, how about moving that code to it's own file?
@pablogsal thoughts?

All reactions

Sorry, something went wrong.

Uh oh!

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

@pablogsal

pablogsal commented May 19, 2021

Copy link
Copy Markdown
Member

Given that the line number table is likely to grow and change with PEP 657, how about moving that code to it's own file?
@pablogsal thoughts?

I think having it in the same file is fine, as it will cause merge conflicts for us in any case. There is some benefit of having fewer compilation units. In the other hand maybe it will result in a better organisation of the code so if you think it makes sense I would be fine too :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@ericsnowcurrently
Appease argument clinic.
86dc12a
pablogsal
pablogsal reviewed May 19, 2021
View reviewed changes
Comment thread Objects/codeobject.c
item = PyTuple_GET_ITEM(tup, i);
if (PyUnicode_CheckExact(item)) {
Py_INCREF(item);
static PyTypeObject LineIterator = {

@pablogsal pablogsal May 19, 2021

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.

Now that we are here, we could transform these initializers to C99 :)

Sorry, something went wrong.

Uh oh!

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

All reactions
@gvanrossum

gvanrossum commented May 19, 2021

Copy link
Copy Markdown
Member

Let's not sit on this longer. LGTM, if either Mark or Pablo approves then just land it.

All reactions

Sorry, something went wrong.

Uh oh!

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

pablogsal
pablogsal approved these changes May 19, 2021
View reviewed changes

@pablogsal pablogsal 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.

Looks good for me, but @markshannon should review the function renames

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels May 19, 2021
@ericsnowcurrently
ericsnowcurrently merged commit 6830748 into python:main May 19, 2021
@bedevere-bot bedevere-bot removed the awaiting merge label May 19, 2021
@ericsnowcurrently
ericsnowcurrently deleted the code-object-cleanup-move-code-around branch May 19, 2021 22:45
@markshannon markshannon mentioned this pull request May 2, 2022
Logically merge cell and locals array. They are already contiguous in memory #87859
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal approved these changes
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

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

Assignees

No one assigned

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.

6 participants

@ericsnowcurrently @gvanrossum @markshannon @pablogsal @the-knights-who-say-ni @bedevere-bot
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.