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 — bpo-43838: Use a copy to delegate `types.MappingProxyType` operators by brandtbucher · Pull Request #27300 · python/cpython

Conversation

@brandtbucher

@brandtbucher brandtbucher commented Jul 23, 2021 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This keeps us from breaking encapsulation and (in 3.11) possibly segfaulting.

Should this be backported to 3.9 as a bugfix? If so, the docs should be updated to read .. versionchanged:: 3.9.7.

https://bugs.python.org/issue43838

Sorry, something went wrong.

Uh oh!

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

All reactions
brandtbucher added 5 commits July 22, 2021 17:43
@brandtbucher
Add regression tests
72c6e63
@brandtbucher
Delegate mappingproxy ops to copies, not originals
1c28035
@brandtbucher
Update docs
1735453
@brandtbucher
blurb add
6f8fdaf
@brandtbucher
Fix refleaks
8f9dc09
@brandtbucher brandtbucher added the needs backport to 3.10 label Jul 23, 2021
@bedevere-bot bedevere-bot added the awaiting core review label Jul 23, 2021
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Jul 23, 2021
@brandtbucher brandtbucher changed the title bpo-43838: Use a copy to delegate type.MappingProxyType operators bpo-43838: Use a copy to delegate types.MappingProxyType operators Jul 23, 2021
@brandtbucher

brandtbucher commented Jul 23, 2021

Copy link
Copy Markdown
Member Author

Closing and reopening to trigger CI.

All reactions

Sorry, something went wrong.

Uh oh!

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

@brandtbucher brandtbucher closed this Jul 23, 2021
@brandtbucher brandtbucher reopened this Jul 23, 2021
@ambv

ambv commented Jul 23, 2021

Copy link
Copy Markdown
Contributor

Note @ncoghlan's comment on the issue:

We don't want to implicitly copy though, as the performance hit can be non-trivial for large mappings, even if the algorithmic complexity doesn't change.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ncoghlan

ncoghlan commented Aug 1, 2021

Copy link
Copy Markdown
Contributor

@brandtbucher pointed out on the ticket that my alternative proposal was based on a flawed assumption: that the dict method implementations would play well with others even without the coercion dance. They don't, they rely on the coercion dance and the fact that every other mapping type plays well with builtin dicts.

So it's either make a copy of the underlying object and expose that instead, or reimplement generic union and comparison operations that work for any mapping type.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions

github-actions Bot commented Sep 1, 2021

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Sep 1, 2021
@brandtbucher brandtbucher closed this Sep 1, 2021
@serhiy-storchaka serhiy-storchaka mentioned this pull request Apr 10, 2022
There is a way to access an underlying mapping in MappingProxyType #88004
Closed
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 stale Stale PR or inactive for long period of time.

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.

5 participants

@brandtbucher @ambv @ncoghlan @the-knights-who-say-ni @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.