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 — gh-78997: AttributeError if loading fails in LibraryLoader.__getattr__ by farfella · Pull Request #25177 · python/cpython

Conversation

@farfella

@farfella farfella commented Apr 4, 2021 •
edited by terryjreedy
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor
  • Issue: raise AttributeError if loading fails in ctypes.LibraryLoader.__getattr__ #78997

Sorry, something went wrong.

Uh oh!

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

All reactions
@the-knights-who-say-ni

the-knights-who-say-ni commented Apr 4, 2021

Copy link
Copy Markdown

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 Missing

Our records indicate the following people have not signed the CLA:

@farfella

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
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

All reactions

Sorry, something went wrong.

Uh oh!

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

@the-knights-who-say-ni the-knights-who-say-ni added the CLA not signed label Apr 4, 2021
@bedevere-bot bedevere-bot added the awaiting review label Apr 4, 2021
@the-knights-who-say-ni the-knights-who-say-ni added CLA signed and removed CLA not signed labels Apr 5, 2021
FFY00
FFY00 approved these changes May 13, 2021
View reviewed changes
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels May 13, 2021
@github-actions

github-actions Bot commented Jun 13, 2021

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jun 13, 2021
@jacobtylerwalls

jacobtylerwalls commented Jun 14, 2021 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

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 Lib/ctypes/test/test_loader.py would be a reasonable place to start.

All reactions

Sorry, something went wrong.

Uh oh!

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

@jacobtylerwalls

jacobtylerwalls commented Jun 14, 2021

Copy link
Copy Markdown
Contributor

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

class LoaderTest(unittest.TestCase):

All reactions

Sorry, something went wrong.

Uh oh!

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

@farfella
farfella force-pushed the bpo-34816 branch from 1b831e2 to 0e35bb8 Compare June 14, 2021 21:55
@farfella

farfella commented Jun 14, 2021

Copy link
Copy Markdown
Contributor Author

Thanks for your all your help and feedback, @jacobtylerwalls! :) Hoping style-checks passes this time.

All reactions

Sorry, something went wrong.

Uh oh!

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

jacobtylerwalls
jacobtylerwalls reviewed Jun 14, 2021
View reviewed changes
Comment thread Lib/ctypes/test/test_loading.py Resolved

Uh oh!

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

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jun 15, 2021
@farfella

farfella commented Jun 15, 2021

Copy link
Copy Markdown
Contributor Author

Thanks! Fewer lines of code. :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
eric-wieser
eric-wieser reviewed Dec 15, 2022
View reviewed changes
Comment thread Misc/NEWS.d/next/Windows/2021-04-08-00-36-37.bpo-34816.4Xe0id.rst Outdated
@@ -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

@eric-wieser eric-wieser Dec 15, 2022

Copy link
Copy Markdown
Contributor

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.

Suggested change
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`.

Sorry, something went wrong.

Uh oh!

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

All reactions
eric-wieser
eric-wieser reviewed Dec 15, 2022
View reviewed changes
Comment thread Lib/ctypes/test/test_loading.py Outdated
Comment on lines +122 to +124
# This test case verifies that
# ctypes.LoadLibrary.__getattr__ raises AttributeError
# when name cannot be resolved

@eric-wieser eric-wieser Dec 15, 2022

Copy link
Copy Markdown
Contributor

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.

Suggested change
# This test case verifies that
# ctypes.LoadLibrary.__getattr__ raises AttributeError
# when name cannot be resolved
# bpo-34816: shouldn't raise OSError

Sorry, something went wrong.

Uh oh!

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

All reactions
eric-wieser
eric-wieser approved these changes Dec 15, 2022
View reviewed changes

@eric-wieser eric-wieser left a comment

Copy link
Copy Markdown
Contributor

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!

Sorry, something went wrong.

Uh oh!

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

All reactions
@netlify

netlify Bot commented Dec 15, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

✅ Deploy Preview for python-cpython-preview canceled.

Name Link
🔨 Latest commit f151341
🔍 Latest deploy log https://app.netlify.com/sites/python-cpython-preview/deploys/639b9b8d57bbf700082c03c5
All reactions

Sorry, something went wrong.

Uh oh!

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

@FFY00

FFY00 commented Dec 15, 2022

Copy link
Copy Markdown
Member

@farfella I am now in a position where I can merge this, could you update the PR to resolve the conflicts?

All reactions

Sorry, something went wrong.

Uh oh!

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

@farfella
farfella requested review from a team, Fidget-Spinner, brettcannon, encukou, ethanfurman, gvanrossum and jaraco as code owners December 15, 2022 11:53
@AlexWaygood
AlexWaygood removed request for AlexWaygood, brandtbucher, ezio-melotti, kumaraditya303, lysnikolaou, markshannon and pablogsal December 15, 2022 11:56
@farfella farfella closed this Dec 15, 2022
@farfella
farfella force-pushed the bpo-34816 branch from 9a9743e to b7e4f1d Compare December 15, 2022 11:57
@bedevere-bot

bedevere-bot commented Dec 15, 2022

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Dec 15, 2022 •
edited by ghost
Loading

Uh oh!

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

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

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

@eric-wieser

eric-wieser commented Dec 15, 2022

Copy link
Copy Markdown
Contributor

@farfella, it looks like you just discarded all your changes...

All reactions

Sorry, something went wrong.

Uh oh!

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

@farfella

farfella commented Dec 15, 2022

Copy link
Copy Markdown
Contributor Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

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

farfella added 2 commits December 15, 2022 09:40
@farfella
bpo-34816: Raise AttributeError if loading fails in ctypes.LibraryLoa…
aa340b8
…der.__get_attr__
@farfella
merging in 3.11 updates
b8aaba9
@farfella

farfella commented Dec 15, 2022

Copy link
Copy Markdown
Contributor Author

Updated PR to resolve conflicts

All reactions

Sorry, something went wrong.

Uh oh!

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

@farfella farfella reopened this Dec 15, 2022
@farfella
adding new line at end of file for docs
f7487c4
@terryjreedy

terryjreedy commented Dec 15, 2022

Copy link
Copy Markdown
Member

force-pushing may be the reason for the review-request spamming. Please use simple update merges. git merge upstream/main last I knew.

FFY00 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@FFY00

FFY00 commented Dec 15, 2022

Copy link
Copy Markdown
Member

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 👍

All reactions

Sorry, something went wrong.

Uh oh!

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

@farfella
updating news per feedback
76f0039
FFY00
FFY00 reviewed Dec 15, 2022
View reviewed changes
Comment thread Misc/NEWS.d/next/Windows/2021-04-08-00-36-37.bpo-34816.4Xe0id.rst Resolved

Uh oh!

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

@FFY00
Update Misc/NEWS.d/next/Windows/2021-04-08-00-36-37.bpo-34816.4Xe0id.rst
12d77d2
FFY00
FFY00 reviewed Dec 15, 2022
View reviewed changes
Comment thread Misc/NEWS.d/next/Windows/2021-04-08-00-36-37.bpo-34816.4Xe0id.rst Resolved

Uh oh!

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

@FFY00
Update Misc/NEWS.d/next/Windows/2021-04-08-00-36-37.bpo-34816.4Xe0id.rst
6c66904
zware
zware reviewed Dec 15, 2022
View reviewed changes
Comment thread Misc/NEWS.d/next/Windows/2021-04-08-00-36-37.bpo-34816.4Xe0id.rst Resolved

Uh oh!

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

@FFY00 @zware
Update Misc/NEWS.d/next/Windows/2021-04-08-00-36-37.bpo-34816.4Xe0id.rst
f151341
Co-authored-by: Zachary Ware <[email protected]>
@FFY00

FFY00 commented Dec 15, 2022

Copy link
Copy Markdown
Member

Thanks @farfella for the fix, and @eric-wieser for the review!

All reactions

Sorry, something went wrong.

Uh oh!

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

@eli-schwartz

eli-schwartz commented Dec 22, 2022

Copy link
Copy Markdown
Contributor

Minor rebase issue in the test file. :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@lfriedri lfriedri mannequin mentioned this pull request Apr 10, 2022
raise AttributeError if loading fails in ctypes.LibraryLoader.__getattr__ #78997
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@zware zware zware left review comments
@FFY00 FFY00 FFY00 approved these changes
@jaraco jaraco Awaiting requested review from jaraco
@brettcannon brettcannon Awaiting requested review from brettcannon
@encukou encukou Awaiting requested review from encukou
@ethanfurman ethanfurman Awaiting requested review from ethanfurman
@gvanrossum gvanrossum Awaiting requested review from gvanrossum
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner
@JelleZijlstra JelleZijlstra Awaiting requested review from JelleZijlstra
@terryjreedy terryjreedy Awaiting requested review from terryjreedy
@ericvsmith ericvsmith Awaiting requested review from ericvsmith
@rhettinger rhettinger Awaiting requested review from rhettinger
@berkerpeksag berkerpeksag Awaiting requested review from berkerpeksag
@gpshead gpshead Awaiting requested review from gpshead
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland
@isidentical isidentical Awaiting requested review from isidentical
+2 more reviewers
@jacobtylerwalls jacobtylerwalls jacobtylerwalls left review comments
@eric-wieser eric-wieser eric-wieser approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

10 participants

@farfella @the-knights-who-say-ni @jacobtylerwalls @FFY00 @bedevere-bot @eric-wieser @terryjreedy @eli-schwartz @zware @ezio-melotti
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.