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 — Nested attribute lookup for improved error messages executes property code · Issue #145413 · python/cpython

Nested attribute lookup for improved error messages executes property code #145413

New issue
Copy link
New issue
Copy link
Closed
Closed
Nested attribute lookup for improved error messages executes property code#145413
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@Hiumee
Hiumee
opened on Mar 2, 2026
Issue body actions

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 import pi

@dataclass
class Circle:
   radius: float
   @property
   def area(self) -> float:
      print("Property 'area' accessed")
      return pi * self.radius**2

class Container:
   def __init__(self, inner: Circle) -> None:
      self.inner = inner

circle = Circle(radius=4.0)
container = Container(circle)
print(container.area)

Output

Property 'area' accessed
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    print(container.area)
          ^^^^^^^^^^^^^^
AttributeError: 'Container' object has no attribute 'area'. Did you mean '.inner.area' instead of '.area'?

Expected would be to not execute the code. This does not happen when the Container class has a property suggested

PR incoming

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

  • gh-145413: Fix nested attribute suggestions executing property code #145414

Activity

  1. Hiumee
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Mar 2, 2026
  2. StanFromIreland
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Mar 2, 2026
  3. Hiumee commented on Mar 26, 2026

    @Hiumee
    Hiumee
    on Mar 26, 2026
    Author
    More actions

    fixed by #146188

  4. Hiumee
    closed this as completedon Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.