Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-78997: AttributeError if loading fails in LibraryLoader.__getattr__#25177
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
the-knights-who-say-ni commented Apr 4, 2021
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
This PR is stale because it has been open for 30 days with no activity. |
jacobtylerwalls commented Jun 14, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Hi @farfella, thanks for this, do you think you could add a brief test to verify the original use case? I'm not an expert, but I would assume |
jacobtylerwalls commented Jun 14, 2021
Ah, sorry I was referring to an existing file and meant "test_loading.py", not "test_loader.py", my mistake: cpython/Lib/ctypes/test/test_loading.py Line 26 in 507ed6f
|
farfella commented Jun 14, 2021
Thanks for your all your help and feedback, @jacobtylerwalls! :) Hoping style-checks passes this time. |
Uh oh!
There was an error while loading. Please reload this page.
farfella commented Jun 15, 2021
Thanks! Fewer lines of code. :) |
| @@ -0,0 +1 @@ | |||
| Fix issue where hasattr(ctypes.windll, 'somefunction') raises OSError instead of the expected behavior: returning False No newline at end of file | |||
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.
| Fix issue where hasattr(ctypes.windll, 'somefunction') raises OSError instead of the expected behavior: returning False | |
| `hasattr(ctypes.windll, 'nonexistant')` now returns `False` instead of raising `OSError`. |
Lib/ctypes/test/test_loading.py Outdated
| # This test case verifies that | ||
| # ctypes.LoadLibrary.__getattr__ raises AttributeError | ||
| # when name cannot be resolved |
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.
| # This test case verifies that | |
| # ctypes.LoadLibrary.__getattr__ raises AttributeError | |
| # when name cannot be resolved | |
| # bpo-34816: shouldn't raise OSError |
eric-wieser left a comment
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!
netlifybot commented Dec 15, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
✅ Deploy Preview for python-cpython-preview canceled.
|
FFY00 commented Dec 15, 2022
@farfella I am now in a position where I can merge this, could you update the PR to resolve the conflicts? |
bedevere-bot commented Dec 15, 2022
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
ghost commented Dec 15, 2022 • edited by ghost
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by ghost
Uh oh!
There was an error while loading. Please reload this page.
eric-wieser commented Dec 15, 2022
@farfella, it looks like you just discarded all your changes... |
farfella commented Dec 15, 2022
Yeah.... I saw this "Sync fork" button (that is new to me) for my branch on GitHub web UI and clicked it. This is the consequence.... My local copy still has everything. I'll push that up. |
farfella commented Dec 15, 2022
Updated PR to resolve conflicts |
terryjreedy commented Dec 15, 2022
force-pushing may be the reason for the review-request spamming. Please use simple update merges. |
FFY00 commented Dec 15, 2022
Alright, thank you @farfella for getting this back into shape! Can you just apply the feedback from code-review from @eric-wieser? After that, we can go ahead and merge this 👍 |
Misc/NEWS.d/next/Windows/2021-04-08-00-36-37.bpo-34816.4Xe0id.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Misc/NEWS.d/next/Windows/2021-04-08-00-36-37.bpo-34816.4Xe0id.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Misc/NEWS.d/next/Windows/2021-04-08-00-36-37.bpo-34816.4Xe0id.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
FFY00 commented Dec 15, 2022
Thanks @farfella for the fix, and @eric-wieser for the review! |
During the process of merging in a year and a half of changes, the modified test file `test_loading.py` accidentally got converted to a newly added file in an old location, rather than an existing test file with an updated test. Merge the changes in this file into the new canonical location since pythongh-93839, and delete the old file.
eli-schwartz commented Dec 22, 2022
Minor rebase issue in the test file. :) |
Uh oh!
There was an error while loading. Please reload this page.