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 — Fix subclass `__getattribute__` being dropped after `del Base.__getattr__` by Copilot · Pull Request #9800 · RustPython/RustPython

Conversation

Copilot AI commented Nov 11, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

__getattribute__ and __getattr__ share the getattro slot. When one of them was removed from a class, the slot update re-inherited from the first base with a getattro slot. It never looked at a __getattribute__ in the class's own dict, so a subclass's override was silently lost. This is what happens to subclasses after mock.patch.object(Base, "__getattr__", ..., create=True) exits.

class Base: pass
class Proxy(Base):
    def __getattribute__(self, name):
        print("Proxy.__getattribute__", name)
        return object.__getattribute__(self, name)

p = Proxy(); p.x = 1
Base.__getattr__ = lambda self, name: "fallback"
del Base.__getattr__
p.x  # CPython: calls Proxy.__getattribute__; RustPython (before): skipped it

Changes

  • crates/vm/src/types/slot.rs (SlotAccessor::TpGetattro): when no __getattr__ is in the MRO, always resolve the slot through lookup_slot_in_mro on __getattribute__, for both add and remove. Previously this happened only on add, and it used the changed name rather than __getattribute__. The inherit_from_mro fallback on removal is gone, so this now matches how TpSetattro resolves __setattr__/__delattr__.
  • extra_tests/snippets/builtin_object.py: regression test for the add-then-delete sequence above.
  • Fixes Deleting __getattr__ from a base class stops a subclass's own __getattribute__ from being called #9796

Sorry, something went wrong.

Uh oh!

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

All reactions
Initial plan
7a01bc1
Copilot AI assigned Copilot and youknowone Nov 11, 2026
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: RustPython/RustPython
  • Branch: main
  • File: .coderabbit.yml
  • Commit: 4242849
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a15fc3ae-d0df-487f-a73a-bdba201da486

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

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

Copilot started work on behalf of youknowone November 11, 2026 14:28
View session
Copilot AI linked an issue Nov 11, 2026 that may be closed by this pull request
Deleting __getattr__ from a base class stops a subclass's own __getattribute__ from being called #9796
Open
@youknowone
Apply remaining changes
8cc118f
Co-authored-by: youknowone <[email protected]>
Copilot AI changed the title [WIP] Fix subclass __getattribute__ not being called after deleting __getattr__ Fix subclass __getattribute__ being dropped after del Base.__getattr__ Nov 11, 2026
Copilot finished work on behalf of youknowone November 11, 2026 14:38
Copilot AI requested a review from youknowone November 11, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone Awaiting requested review from youknowone

At least 1 approving review is required to merge this pull request.

Uh oh!

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

Assignees

@youknowone youknowone

Copilot code review Copilot

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Deleting __getattr__ from a base class stops a subclass's own __getattribute__ from being called

Uh oh!

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

2 participants

@youknowone
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.