Skip to content

gh-142029: Raise ValueError instead of crashing on empty name given to create_builtin() - #142033

Merged
kumaraditya303 merged 9 commits into
python:mainfrom
dr-carlos:importlib-create-builtin
Dec 10, 2025
Merged

gh-142029: Raise ValueError instead of crashing on empty name given to create_builtin()#142033
kumaraditya303 merged 9 commits into
python:mainfrom
dr-carlos:importlib-create-builtin

Conversation

@dr-carlos

@dr-carlosdr-carlos commented Nov 28, 2025

Copy link
Copy Markdown
Contributor

@dr-carlos

dr-carlos commented Nov 28, 2025

Copy link
Copy Markdown
ContributorAuthor

This function isn't documented or tested anywhere already, so I haven't added a test.

@sergey-miryanov

Copy link
Copy Markdown
Contributor

@dr-carlos Could you please add tests?

brettcannon
brettcannon previously requested changes Nov 28, 2025

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

Please add tests.

@bedevere-app

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@dr-carlos

dr-carlos commented Nov 28, 2025

Copy link
Copy Markdown
ContributorAuthor

I've added simple tests based on the errors thrown in create_builtin().

I have made the requested changes; please review again

@bedevere-app

Copy link
Copy Markdown

Thanks for making the requested changes!

@brettcannon: please review the changes made to this pull request.

Comment threadPython/import.c Outdated
Comment threadLib/test/test_import/__init__.py Outdated
Comment threadLib/test/test_import/__init__.py Outdated
Comment threadLib/test/test_import/__init__.py Outdated
@dr-carlosdr-carlos changed the title gh-142029: Raise TypeError instead of crashing on empty name given to create_builtin()gh-142029: Raise ValueError instead of crashing on empty name given to create_builtin()Dec 2, 2025

@vstinnervstinner 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

Comment threadPython/import.c Outdated
Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner
vstinner dismissed brettcannon’s stale reviewDecember 3, 2025 10:34

Tests have been added.

@dr-carlos

Copy link
Copy Markdown
ContributorAuthor

Anything blocking this PR?

@kumaraditya303
kumaraditya303 merged commit 7067126 into python:mainDec 10, 2025
46 checks passed
@kumaraditya303kumaraditya303 added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Dec 10, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @dr-carlos for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @dr-carlos for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @dr-carlos and @kumaraditya303, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 70671267c11c562c6ca682eebf863616b258c20a 3.13

@miss-islington-app

Copy link
Copy Markdown

Sorry, @dr-carlos and @kumaraditya303, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 70671267c11c562c6ca682eebf863616b258c20a 3.14

@kumaraditya303kumaraditya303 removed needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Dec 10, 2025
@kumaraditya303

Copy link
Copy Markdown
Contributor

The bug is present in main only, skipping backport.

@dr-carlos
dr-carlos deleted the importlib-create-builtin branch December 15, 2025 22:16
Sign up for freeto 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.

5 participants

@dr-carlos@sergey-miryanov@kumaraditya303@brettcannon@vstinner