Skip to content

gh-121272: move __future__ import validation from compiler to symtable - #121273

Merged
iritkatriel merged 2 commits into
python:mainfrom
iritkatriel:shrink_compiler
Jul 2, 2024
Merged

gh-121272: move __future__ import validation from compiler to symtable#121273
iritkatriel merged 2 commits into
python:mainfrom
iritkatriel:shrink_compiler

Conversation

@iritkatriel

@iritkatrieliritkatriel commented Jul 2, 2024

Copy link
Copy Markdown
Member

@AraHaanAraHaan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree, this could be a good performance improvement when using a ton of c extensions with python scripts that use import from statements on them.

Comment threadPython/symtable.c Outdated
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@iritkatriel

Copy link
Copy Markdown
MemberAuthor

I agree, this could be a good performance improvement when using a ton of c extensions with python scripts that use import from statements on them.

This shouldn't impact performance.

This is about simplifying code in compile.c (in this case, making compiler_from_import no longer access the internals of struct compiler). This is part of a longer term plan to break up the compiler.

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

Looks good. This is thoroughly tested in test_future_stmt/test_future.py and I confirmed that the code in future.c that sets ff_location makes sense.

@iritkatriel
iritkatriel enabled auto-merge (squash) July 2, 2024 16:14
@iritkatriel
iritkatriel merged commit 1ac2732 into python:mainJul 2, 2024
Akasurde pushed a commit to Akasurde/cpython that referenced this pull request Jul 3, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@iritkatriel@JelleZijlstra@picnixz@AraHaan