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-94808: Cover `LOAD_GLOBAL` for custom dict subtypes by sobolevn · Pull Request #96767 · python/cpython

Conversation

@sobolevn

@sobolevn sobolevn commented Sep 12, 2022 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

I've covered several missing conditions in TARGET(LOAD_GLOBAL):

  • The one where custom globals() dict subtype raises non KeyError:

    cpython/Python/ceval.c

    Lines 2445 to 2447 in 53a54b7

    if (!_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
    goto error;
    }
  • Similar case where __builtins__ dict subtype raises non KeyError:

    cpython/Python/ceval.c

    Line 2458 in 53a54b7

    goto error;
  • Regular NameError in a custom __builtins__ dict subtype:

    cpython/Python/ceval.c

    Lines 2453 to 2457 in 53a54b7

    if (_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
    format_exc_check_arg(
    tstate, PyExc_NameError,
    NAME_ERROR_MSG, name);
    }
  • Issue: Metabug: Improving C-level coverage #94808

Sorry, something went wrong.

Uh oh!

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

All reactions
@sobolevn
pythongh-94808: Cover LOAD_GLOBAL for custom dict subtypes
d7310bd
@bedevere-bot bedevere-bot added awaiting review tests Tests in the Lib/test dir labels Sep 12, 2022
@sobolevn sobolevn added the skip news label Sep 12, 2022
@sobolevn
sobolevn requested review from brandtbucher and mdboom September 12, 2022 09:57
mdboom
mdboom approved these changes Sep 12, 2022
View reviewed changes

@mdboom mdboom left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution.

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Sep 12, 2022
@sobolevn
Add regex to the last test
51412c2
iritkatriel
iritkatriel reviewed Nov 3, 2022
View reviewed changes
Comment thread Lib/test/test_builtin.py Outdated
def __getitem__(self, key):
raise setonlyerror

class customdict(dict): # this one should not do anything fancy

@iritkatriel iritkatriel Nov 3, 2022

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be defined just before the test that uses it (below). Ideally this function would be broken up - it's testing a lot of things.

Sorry, something went wrong.

Uh oh!

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

All reactions

@sobolevn sobolevn Nov 4, 2022

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Thanks!

Sorry, something went wrong.

Uh oh!

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

All reactions
@sobolevn
Address review
911bca1
@bedevere-bot bedevere-bot mentioned this pull request Nov 4, 2022
Metabug: Improving C-level coverage #94808
Open
iritkatriel
iritkatriel approved these changes Nov 4, 2022
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Nov 4, 2022
@iritkatriel iritkatriel added needs backport to 3.10 needs backport to 3.11 only security fixes labels Nov 4, 2022
@iritkatriel
iritkatriel merged commit 044bcc1 into python:main Nov 4, 2022
@miss-islington

miss-islington commented Nov 4, 2022

Copy link
Copy Markdown
Contributor

Thanks @sobolevn for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the awaiting merge label Nov 4, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 4, 2022
@sobolevn @miss-islington
pythongh-94808: Cover LOAD_GLOBAL for custom dict subtypes (pythonG…
6c30789
…H-96767)

(cherry picked from commit 044bcc1)

Co-authored-by: Nikita Sobolev <[email protected]>
@miss-islington

miss-islington commented Nov 4, 2022

Copy link
Copy Markdown
Contributor

Sorry, @sobolevn and @iritkatriel, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 044bcc1771fe7e2f8eba21793a72ba15e75e6715 3.10

All reactions

Sorry, something went wrong.

Uh oh!

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

@miss-islington miss-islington assigned iritkatriel Nov 4, 2022
@bedevere-bot

bedevere-bot commented Nov 4, 2022

Copy link
Copy Markdown

GH-99091 is a backport of this pull request to the 3.11 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.11 only security fixes label Nov 4, 2022
iritkatriel pushed a commit that referenced this pull request Nov 4, 2022
@miss-islington
[3.11] gh-94808: Cover LOAD_GLOBAL for custom dict subtypes (GH-96767…
2b79f4e
…) (GH-99091)
@ZeroIntensity ZeroIntensity removed the needs backport to 3.10 label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mdboom mdboom mdboom approved these changes
@iritkatriel iritkatriel iritkatriel approved these changes
@brandtbucher brandtbucher Awaiting requested review from brandtbucher

Uh oh!

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

Assignees

@iritkatriel iritkatriel

Labels

skip news tests Tests in the Lib/test dir

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.

6 participants

@sobolevn @miss-islington @bedevere-bot @mdboom @iritkatriel @ZeroIntensity
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.