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-112281: Allow `Union` with unhashable `Annotated` metadata by sobolevn · Pull Request #112283 · python/cpython

Conversation

@sobolevn

@sobolevn sobolevn commented Nov 20, 2023 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This should not affect performance that much:

  1. I tried to keep the fast path as it is
  2. Slow path is only used when TypeError happens on unhashable items (it should not affect code with only hashable parts)
  • Issue: Unioned types should be hashable: not documented? #112281

Sorry, something went wrong.

Uh oh!

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

faph reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@sobolevn
pythongh-112281: Allow Union with unhashable Annotated metadata
c13aa09
@sobolevn
sobolevn requested review from AlexWaygood and JelleZijlstra as code owners November 20, 2023 13:18
@bedevere-app bedevere-app Bot added the awaiting review label Nov 20, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Nov 20, 2023
Unioned types should be hashable: not documented? #112281
Closed
faph
faph reviewed Nov 20, 2023
View reviewed changes
Comment thread Lib/typing.py Resolved

Uh oh!

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

@sobolevn
Add one more test case
0ff7f84
AlexWaygood
AlexWaygood reviewed Nov 20, 2023
View reviewed changes
Comment thread Lib/test/test_typing.py Resolved

Uh oh!

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

sobolevn added 2 commits November 20, 2023 17:42
@sobolevn
Fix ordering issues, use consistent hash check
d348b74
@sobolevn
More tests
8dff1c4
JelleZijlstra
JelleZijlstra reviewed Nov 25, 2023
View reviewed changes
Comment thread Lib/typing.py Resolved

Uh oh!

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

Comment thread Lib/typing.py Resolved

Uh oh!

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

Comment thread Lib/test/test_typing.py Resolved

Uh oh!

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

Comment thread Lib/test/test_typing.py Resolved

Uh oh!

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

Comment thread Misc/NEWS.d/next/Library/2023-11-20-16-15-44.gh-issue-112281.gH4EVk.rst Resolved

Uh oh!

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

@sobolevn
Address review
968dd18
AlexWaygood
AlexWaygood reviewed Dec 2, 2023
View reviewed changes
Comment thread Lib/typing.py Resolved

Uh oh!

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

@sobolevn
Address review
9f8b665
AlexWaygood
AlexWaygood reviewed Dec 2, 2023
View reviewed changes
Comment thread Lib/typing.py Resolved

Uh oh!

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

@sobolevn
Address review
a9c1700
AlexWaygood
AlexWaygood reviewed Dec 2, 2023
View reviewed changes
Comment thread Lib/typing.py Resolved

Uh oh!

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

@sobolevn
Address review
4622bc8
AlexWaygood
AlexWaygood reviewed Dec 2, 2023
View reviewed changes
Comment thread Lib/test/test_typing.py Resolved

Uh oh!

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

AlexWaygood
AlexWaygood reviewed Dec 2, 2023
View reviewed changes
Comment thread Lib/test/test_types.py Resolved

Uh oh!

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

@sobolevn @AlexWaygood
Apply suggestions from code review
cadb2df
Co-authored-by: Alex Waygood <[email protected]>
AlexWaygood
AlexWaygood reviewed Dec 2, 2023
View reviewed changes
Comment thread Lib/test/test_typing.py Resolved

Uh oh!

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

Comment thread Lib/test/test_typing.py Resolved

Uh oh!

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

@sobolevn @AlexWaygood
Apply suggestions from code review
7293ad7
Co-authored-by: Alex Waygood <[email protected]>
@sobolevn

sobolevn commented Dec 2, 2023

Copy link
Copy Markdown
Member Author

We just did 6 rounds of nitpicks :)

AlexWaygood reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

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

AlexWaygood
AlexWaygood approved these changes Dec 2, 2023
View reviewed changes

@AlexWaygood AlexWaygood left a comment

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.

LGTM. @JelleZijlstra, anything more from you?

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Lib/test/test_typing.py Resolved

Uh oh!

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

@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Dec 2, 2023
sobolevn and others added 2 commits December 2, 2023 18:05
@sobolevn @AlexWaygood
Update Lib/test/test_typing.py
449f114
Co-authored-by: Alex Waygood <[email protected]>
@sobolevn
Merge branch 'main' into issue-112281
da80e22
@sobolevn
sobolevn requested a review from JelleZijlstra February 7, 2024 07:06
@sobolevn
sobolevn requested a review from AlexWaygood February 7, 2024 07:06
@AlexWaygood

AlexWaygood commented Feb 7, 2024

Copy link
Copy Markdown
Member

I already approved this one :)

sobolevn reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@AlexWaygood
AlexWaygood removed their request for review February 7, 2024 12:48
JelleZijlstra
JelleZijlstra approved these changes Mar 1, 2024
View reviewed changes
@JelleZijlstra

JelleZijlstra commented Mar 1, 2024

Copy link
Copy Markdown
Member

Thanks, and sorry for the wait!

Do you think this should be backported? I lean yes because the old behavior feels like a bug.

All reactions

Sorry, something went wrong.

Uh oh!

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

@AlexWaygood

AlexWaygood commented Mar 1, 2024

Copy link
Copy Markdown
Member

Do you think this should be backported? I lean yes because the old behavior feels like a bug.

Yeah, agreed

All reactions

Sorry, something went wrong.

Uh oh!

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

@AlexWaygood AlexWaygood added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Mar 1, 2024
@AlexWaygood
Merge branch 'main' into issue-112281
98cf0ff
@AlexWaygood
AlexWaygood enabled auto-merge (squash) March 1, 2024 15:46
@AlexWaygood
AlexWaygood merged commit a7549b0 into python:main Mar 1, 2024
@miss-islington-app

miss-islington-app Bot commented Mar 1, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting merge label Mar 1, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 1, 2024
@sobolevn @AlexWaygood @miss-islington
pythongh-112281: Allow Union with unhashable Annotated metadata (p…
21cad08
…ythonGH-112283)

(cherry picked from commit a7549b0)

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

miss-islington-app Bot commented Mar 1, 2024

Copy link
Copy Markdown

Sorry, @sobolevn and @AlexWaygood, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker a7549b03cec1699b5342cddf292c179315433fa2 3.11
All reactions

Sorry, something went wrong.

Uh oh!

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

@miss-islington-app miss-islington-app Bot assigned AlexWaygood Mar 1, 2024
@bedevere-app

bedevere-app Bot commented Mar 1, 2024

Copy link
Copy Markdown

GH-116213 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-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Mar 1, 2024
AlexWaygood added a commit that referenced this pull request Mar 1, 2024
@miss-islington @sobolevn @AlexWaygood
[3.12] gh-112281: Allow Union with unhashable Annotated metadata (G…
90f75e1
…H-112283) (#116213)

Co-authored-by: Nikita Sobolev <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
@AlexWaygood AlexWaygood assigned sobolevn and unassigned AlexWaygood Mar 1, 2024
sobolevn added a commit to sobolevn/cpython that referenced this pull request Mar 3, 2024
@sobolevn @AlexWaygood
[3.11] pythongh-112281: Allow Union with unhashable Annotated met…
5612315
…adata (pythonGH-112283)

(cherry picked from commit a7549b0)

Co-authored-by: Nikita Sobolev <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
@bedevere-app

bedevere-app Bot commented Mar 3, 2024

Copy link
Copy Markdown

GH-116288 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-app bedevere-app Bot removed the needs backport to 3.11 only security fixes label Mar 3, 2024
AlexWaygood added a commit that referenced this pull request Mar 3, 2024
@sobolevn @AlexWaygood
[3.11] gh-112281: Allow Union with unhashable Annotated metadata (G…
8bfbeeb
…H-112283) (#116288)

Co-authored-by: Alex Waygood <[email protected]>
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
@sobolevn @AlexWaygood @woodruffw
pythongh-112281: Allow Union with unhashable Annotated metadata (p…
326fad4
…ython#112283)

Co-authored-by: Alex Waygood <[email protected]>
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
@sobolevn @AlexWaygood @adorilson
pythongh-112281: Allow Union with unhashable Annotated metadata (p…
6b0c1c2
…ython#112283)

Co-authored-by: Alex Waygood <[email protected]>
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
@sobolevn @AlexWaygood @diegorusso
pythongh-112281: Allow Union with unhashable Annotated metadata (p…
2b44ae1
…ython#112283)

Co-authored-by: Alex Waygood <[email protected]>
@JelleZijlstra JelleZijlstra mentioned this pull request Apr 26, 2024
gh-105499: Merge typing.Union and types.UnionType #105511
Merged
@Maxinho96 Maxinho96 mentioned this pull request Jul 18, 2026
Literal[...] deduplication silently skips when values are unhashable #153896
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes
@AlexWaygood AlexWaygood AlexWaygood approved these changes
+1 more reviewer
@faph faph faph left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

@sobolevn sobolevn

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

@sobolevn @AlexWaygood @JelleZijlstra @faph
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.