Title: Nested attribute lookup for improved error messages executes property code · Issue #145413 · python/cpython · GitHub
Open Graph Title: Nested attribute lookup for improved error messages executes property code · Issue #145413 · python/cpython
X Title: Nested attribute lookup for improved error messages executes property code · Issue #145413 · python/cpython
Description: Bug report Bug description: The new error messages for nested attributes will execute descriptors/property code Modified example from the change log. Gave the property a side effect (print) from dataclasses import dataclass from math imp...
Open Graph Description: Bug report Bug description: The new error messages for nested attributes will execute descriptors/property code Modified example from the change log. Gave the property a side effect (print) from da...
X Description: Bug report Bug description: The new error messages for nested attributes will execute descriptors/property code Modified example from the change log. Gave the property a side effect (print) from da...
Opengraph URL: https://github.com/python/cpython/issues/145413
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Nested attribute lookup for improved error messages executes property code","articleBody":"# Bug report\n\n### Bug description:\n\nThe new error messages for nested attributes will execute descriptors/property code\n\nModified example from the change log. Gave the property a side effect (print)\n```python\nfrom dataclasses import dataclass\nfrom math import pi\n\n@dataclass\nclass Circle:\n radius: float\n @property\n def area(self) -\u003e float:\n print(\"Property 'area' accessed\")\n return pi * self.radius**2\n\nclass Container:\n def __init__(self, inner: Circle) -\u003e None:\n self.inner = inner\n\ncircle = Circle(radius=4.0)\ncontainer = Container(circle)\nprint(container.area)\n```\n\nOutput\n```\nProperty 'area' accessed\nTraceback (most recent call last):\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n print(container.area)\n ^^^^^^^^^^^^^^\nAttributeError: 'Container' object has no attribute 'area'. Did you mean '.inner.area' instead of '.area'?\n```\n\nExpected would be to not execute the code. This does not happen when the `Container` class has a property suggested\n\nPR incoming\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nWindows\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-145414\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/Hiumee","@type":"Person","name":"Hiumee"},"datePublished":"2026-03-02T11:33:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/145413/cpython/issues/145413"}
| 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:e03fc17a-80c9-3a9e-ddda-408bda21ae6d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B678:204E27:AB133FE:AE87A20:6A50BA7B |
| html-safe-nonce | a504560382b2228118a4c6702b6862bbd3784eb5ada1750d30e9565b232b94d6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjc4OjIwNEUyNzpBQjEzM0ZFOkFFODdBMjA6NkE1MEJBN0IiLCJ2aXNpdG9yX2lkIjoiNTU3NTc3Mjk5MDEwMDQyNDkxIiwicmVnaW9uX2VkZ2UiOiJzZWEiLCJyZWdpb25fcmVuZGVyIjoic2VhIn0= |
| visitor-hmac | f3bd380f514411b40f38b0cd2627fae46baf12ba95b07ef8b24b61864ff3861f |
| hovercard-subject-tag | issue:4010781348 |
| 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/145413/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4dcc521bc8857bc52d99fee4d25b290317a7c7c1345e4fc4dc861f72e386c3cb/python/cpython/issues/145413 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4dcc521bc8857bc52d99fee4d25b290317a7c7c1345e4fc4dc861f72e386c3cb/python/cpython/issues/145413 |
| og:image:alt | Bug report Bug description: The new error messages for nested attributes will execute descriptors/property code Modified example from the change log. Gave the property a side effect (print) from da... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Hiumee |
| hostname | github.com |
| expected-hostname | github.com |
| None | 63772747707af4093f0d5fc7aa1bb3bb55f412a9865207c4f421aa34c64cc404 |
| 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 | ded53fe94e3ff1bb4dbf8cc77e285396c92580fb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width