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-105035: fix super() calls on unusual types (e.g. meta-types) by carljm · Pull Request #105094 · python/cpython

Conversation

@carljm

@carljm carljm commented May 30, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

The LOAD_SUPER_ATTR optimization was missing the check (found in _PyObject_GetMethod) to restrict the load-method optimization to lookups only against types that use PyObject_GenericGetAttr for their tp_getattro. This excludes, for example, meta-types, which have their own tp_getattro implementation (_Py_type_getattro).

  • Issue: 3.12.0b1 includes backwards incompatible change to operation of super() #105035

Sorry, something went wrong.

Uh oh!

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

All reactions
@carljm
pythongh-105035: fix super() calls on unusual types (e.g. meta-types)
4ef2316
@bedevere-bot bedevere-bot mentioned this pull request May 30, 2023
3.12.0b1 includes backwards incompatible change to operation of super() #105035
Closed
@carljm
add news entry
289d6a6
Fidget-Spinner
Fidget-Spinner approved these changes May 30, 2023
View reviewed changes
@bedevere-bot bedevere-bot added the awaiting merge label May 30, 2023
@carljm
carljm marked this pull request as ready for review May 30, 2023 16:18
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting merge labels May 30, 2023
@carljm
no need to deopt
8fff072
facebook-github-bot pushed a commit to facebookincubator/MetaPython that referenced this pull request May 30, 2023
Carl Meyer @facebook-github-bot
fix super() calls on unusual types (e.g. meta-types)
c638629
Summary:
This bug was discovered in the upstream `LOAD_SUPER_ATTR` implementation
in 3.12b1, and it also exists in the Cinder implementation.

`_PyObject_GetMethod` checks whether the type has a non-standard
`tp_getattro` (i.e. not `PyObject_GenericGetAttr`), and if so, refuses to attempt
the load-method optimization. We didn't have this check in the `super()`
optimization, causing incompatible behavior in the case of a `super()` lookup
on a type with unusual `tp_getattro`, e.g. meta-types.

Upstream fix is python/cpython#105094

Reviewed By: mpage

Differential Revision: D46281340

fbshipit-source-id: 41aba762d3e2925042a3d897a690317ba2767cf2
@carljm
Merge branch 'main' into superbadgetattro
24e1159
* main:
  CI: Temporarily skip paths with spaces to avoid error (python#105110)
  pythongh-105071: add missing versionadded directive (python#105097)
  pythongh-80064: Fix is_valid_wide_char() return type (python#105099)
  Small speedup for dataclass __eq__ and __repr__ (python#104904)
  pythongh-103921: Minor PEP-695 fixes to the `ast` module docs (python#105093)
  pythongh-105091: stable_abi.py: Remove "Unixy" check from --all on other platforms (pythonGH-105092)
@carljm
carljm merged commit 68c75c3 into python:main May 30, 2023
@bedevere-bot bedevere-bot removed the awaiting core review label May 30, 2023
@carljm carljm added the needs backport to 3.12 only security fixes label May 30, 2023
@miss-islington

miss-islington commented May 30, 2023

Copy link
Copy Markdown
Contributor

Thanks @carljm for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 30, 2023
@carljm @miss-islington
pythongh-105035: fix super() calls on unusual types (e.g. meta-types) (…
8eef8d4
…pythonGH-105094)

(cherry picked from commit 68c75c3)

Co-authored-by: Carl Meyer <[email protected]>
@bedevere-bot

bedevere-bot commented May 30, 2023

Copy link
Copy Markdown

GH-105117 is a backport of this pull request to the 3.12 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label May 30, 2023
carljm added a commit that referenced this pull request May 30, 2023
@miss-islington @carljm
[3.12] gh-105035: fix super() calls on unusual types (e.g. meta-types) (
5fff491
GH-105094) (#105117)

gh-105035: fix super() calls on unusual types (e.g. meta-types) (GH-105094)
(cherry picked from commit 68c75c3)

Co-authored-by: Carl Meyer <[email protected]>
@carljm
carljm deleted the superbadgetattro branch June 5, 2023 01:19
@erlend-aasland erlend-aasland mentioned this pull request Jun 6, 2023
3.12 backport gh 105236 #105358
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Fidget-Spinner Fidget-Spinner Fidget-Spinner approved these changes

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.

4 participants

@carljm @miss-islington @bedevere-bot @Fidget-Spinner
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.