-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-95754: Better error when script shadows a standard library or third party module #113769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
afe03da
Refactor to reduce nesting
hauntsaninja ae438a4
Check for script shadowing stdlib
hauntsaninja 0933591
Add What's New
hauntsaninja 7f24b99
Avoid calling into Python
hauntsaninja f073672
📜🤖 Added by blurb_it.
blurb-it[bot] 5e22968
just use wchar everywhere
hauntsaninja 4db6e6c
fix warning
hauntsaninja c8864e4
Merge remote-tracking branch 'upstream/main' into stdlib-error
hauntsaninja 2150dc5
do stdlib module name check via PySys
hauntsaninja 0e1e3d8
add back test case
hauntsaninja 2486d00
CleanImport sys is not enough
hauntsaninja 9f0955d
handle set error
hauntsaninja 24ccd8a
add substr test
hauntsaninja 47d7f6c
remove dedent, fix whitespace, use bool
hauntsaninja 5c0991d
Rework to handle third party shadowing
hauntsaninja dec51f3
Update test cases
hauntsaninja a32411b
Update What's New
hauntsaninja c1b79fa
Tweak test
hauntsaninja 1feabb0
Update news entry
hauntsaninja eaf08ac
Tweak test names
hauntsaninja d9eb424
Tweak What's New language
hauntsaninja 69df558
Tweak docstring, fix accidental commit
hauntsaninja ef30d33
Add hyphen in third-party
hauntsaninja f1c9ee9
Tweak test attribute
hauntsaninja a588c15
Fix nit
hauntsaninja ea0d2ad
Add missing static
hauntsaninja 61b5517
Fix test failures on Windows
hauntsaninja a6b3d83
Use Py_ssize_t
hauntsaninja fe25068
Add test case for bad sys.path
hauntsaninja 0981302
Further tweaks
hauntsaninja 5069b98
Tweak assert for +1 logic
hauntsaninja 9977cea
Use config->sys_path_0 / config->module_search_path + add test for sy…
hauntsaninja f742261
stack allocate
hauntsaninja 3d205f3
more cwd tests
hauntsaninja 8654c5c
Merge remote-tracking branch 'upstream/main' into stdlib-error
hauntsaninja 146d394
further tweak error message
hauntsaninja a38bad5
control flow feedback
hauntsaninja 822d8eb
handle has_location correctly
hauntsaninja 3ec37d1
remove explicit safe path check
hauntsaninja a87a91d
Merge remote-tracking branch 'upstream/main' into stdlib-error
hauntsaninja 64bb4fd
make regen-global-objects
hauntsaninja 786b74e
fix spacing
hauntsaninja d7f1bc0
Revert "remove explicit safe path check"
hauntsaninja e55576d
test the no origin case
hauntsaninja a388887
output param feedback
hauntsaninja 3d36032
test non-str origin
hauntsaninja 616ced2
add comment about module.__file__
hauntsaninja afbcd40
test package shadowing module
hauntsaninja 2890b6b
feedback
hauntsaninja 1d65725
try another error message variation
hauntsaninja 300c557
style nits
hauntsaninja File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Misc/NEWS.d/next/Core and Builtins/2024-01-07-03-38-34.gh-issue-95754.aPjEBG.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Improve the error message when a script shadowing a module from the standard | ||
library causes :exc:`AttributeError` to be raised. Similarly, improve the error | ||
message when a script shadowing a third party module attempts to access an | ||
attribute from that third party module while still initialising. |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.