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-98963: Add a note to the error for property subclasses without __doc__ by encukou · Pull Request #99058 · python/cpython

Conversation

@encukou

@encukou encukou commented Nov 3, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Subclasses created using the C API don't get __dict__, which means their __doc__ can't be set for each property separately. The __doc__ descriptor from property itself is shadowed by the subclass's docstring.

This edge case isn't really worth mentioning in the docs. This adds a note that should guide anyone encountering the issue to the right fix.

The newfangled __notes__ mechanism is as non-invasive as it gets -- it even retains the original exception object -- while getting the information to the surprised user.
(The message is longer than typical error messages, but IMO it's better to explain here than in the docs, where 99%+ of the readers don't need it.)

  • Issue: property assumes that its subclasses have __dict__ #98963

Sorry, something went wrong.

Uh oh!

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

All reactions
@encukou
pythongh-98963: Add a note to the error for property subclasses witho…
f530eaf
…ut __doc__

Subclasses created using the C API don't get __dict__, which means their
__doc__ can't be set for each property separately. The __doc__
descriptor from `property` itself is shadowed by the subclass's docstring.

This edge case isn't really worth mentioning in the docs. This adds a note
that should guide anyone encountering the issue to the right fix.
@bedevere-bot bedevere-bot mentioned this pull request Nov 3, 2022
property assumes that its subclasses have __dict__ #98963
Closed
@bedevere-bot bedevere-bot added the awaiting core review label Nov 3, 2022
encukou added 2 commits November 3, 2022 17:15
@encukou
Fix ReST syntax
2d79454
@encukou
Move the note check to an existing test
66428bc
@encukou
encukou marked this pull request as ready for review May 25, 2023 14:49
@gpshead

gpshead commented Jun 3, 2023

Copy link
Copy Markdown
Member

See #105262 - I'm restoring the previous behavior.

All reactions

Sorry, something went wrong.

Uh oh!

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

@gpshead gpshead added the DO-NOT-MERGE label Jun 3, 2023
@gpshead

gpshead commented Jun 5, 2023

Copy link
Copy Markdown
Member

we've reverted the behavior. if we re-attempt this behavior change it'll presumably be a deprecation cycle first (warning) followed ultimately by an error in which something like this note would make sense. (good idea!)

All reactions

Sorry, something went wrong.

Uh oh!

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

@gpshead gpshead closed this Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

awaiting core review DO-NOT-MERGE

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.

3 participants

@encukou @gpshead @bedevere-bot
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.