Title: Instance attr error suggestions can execute `__getattr__` · Issue #132385 · python/cpython · GitHub
Open Graph Title: Instance attr error suggestions can execute `__getattr__` · Issue #132385 · python/cpython
X Title: Instance attr error suggestions can execute `__getattr__` · Issue #132385 · python/cpython
Description: Bug report >>> class A: ... def __getattr__(self, key): ... if key == 'foo': raise SystemExit('bye') ... def bar(self): ... foo ... >>> A().bar() bye # interperter exits :( Originally found by @millerdev in #99140 (comment) I think that ...
Open Graph Description: Bug report >>> class A: ... def __getattr__(self, key): ... if key == 'foo': raise SystemExit('bye') ... def bar(self): ... foo ... >>> A().bar() bye # interperter exits :( Originally found by @mil...
X Description: Bug report >>> class A: ... def __getattr__(self, key): ... if key == 'foo': raise SystemExit('bye') ... def bar(self): ... foo ... >>> A().bar() bye # interperter...
Opengraph URL: https://github.com/python/cpython/issues/132385
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Instance attr error suggestions can execute `__getattr__`","articleBody":"# Bug report\n\n```python\n\u003e\u003e\u003e class A:\n... def __getattr__(self, key):\n... if key == 'foo': raise SystemExit('bye')\n... def bar(self):\n... foo\n... \n\u003e\u003e\u003e A().bar()\nbye\n# interperter exits :(\n```\n\nOriginally found by @millerdev in https://github.com/python/cpython/pull/99140#issuecomment-2794364711\n\nI think that this is not ideal. We probably want to silence all errors. I have a PR ready.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-132387\n* gh-133297\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2025-04-11T09:19:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/132385/cpython/issues/132385"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:04d58c32-2e76-85dd-929c-40f1f415550b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B55E:311995:E1D923:125C694:696B05CE |
| html-safe-nonce | ffab4619d770823226eb6cad3b1c51fa87f031efef932c36233838f5fbef1921 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTVFOjMxMTk5NTpFMUQ5MjM6MTI1QzY5NDo2OTZCMDVDRSIsInZpc2l0b3JfaWQiOiI1NTYwMDgzMDQ2MTgzMTQyODYyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f593ee149d39142abea9736a580c5aed93a847b7e275fc7f583a5884b87faa36 |
| hovercard-subject-tag | issue:2988078925 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/132385/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7c0ac230d3b91629f81b12de08f6c63ab9cd3b30630ceb09f4f89334b0d89c62/python/cpython/issues/132385 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7c0ac230d3b91629f81b12de08f6c63ab9cd3b30630ceb09f4f89334b0d89c62/python/cpython/issues/132385 |
| og:image:alt | Bug report >>> class A: ... def __getattr__(self, key): ... if key == 'foo': raise SystemExit('bye') ... def bar(self): ... foo ... >>> A().bar() bye # interperter exits :( Originally found by @mil... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width