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-41428: Implementation for PEP 604 by maggiemoss · Pull Request #21515 · python/cpython

Conversation

@maggiemoss

@maggiemoss maggiemoss commented Jul 17, 2020 •
edited by gvanrossum
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

PEP 604 - Proposed Implementation

https://www.python.org/dev/peps/pep-0604/

Building off of the comments left on this PR here: https://github.com/pprados/cpython/tree/PEP604

https://bugs.python.org/issue41428

Sorry, something went wrong.

Uh oh!

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

gwennlbh, javierhonduco, and antonagestam reacted with rocket emoji
All reactions
  • 🚀 3 reactions
maggiemoss added 10 commits July 10, 2020 15:31
@maggiemoss
Add new type object for union types
4c4c701
@maggiemoss
Add test.
07b5c29
@maggiemoss
Add basic tp_* fields to union object
32c207b
@maggiemoss
Squash this commit.
50b33c2
@maggiemoss
Squash this commit.
8901145
@maggiemoss
Add union_traverse method.
6450321
@maggiemoss
Handle Py_None in union.
8a09a92
@maggiemoss
Clean up syntax with Py_None
e3c80e9
@maggiemoss
Update getattro method.
165c323
@maggiemoss
Reduce code duplication when adding union types together.
7f0018e
@maggiemoss
maggiemoss requested review from a team, gvanrossum and ilevkivskyi as code owners July 17, 2020 00:07
@the-knights-who-say-ni

This comment has been minimized.

Sign in to view
@the-knights-who-say-ni the-knights-who-say-ni added the CLA not signed label Jul 17, 2020
@bedevere-bot bedevere-bot added the awaiting review label Jul 17, 2020
@maggiemoss
maggiemoss marked this pull request as draft July 17, 2020 00:07
maggiemoss referenced this pull request in pprados/cpython Jul 17, 2020
@pprados
Implement a POC of the specification describe in the PEP0604
e3e99bc
maggiemoss
maggiemoss commented Jul 17, 2020
View reviewed changes
Comment thread Objects/typeobject.c Resolved

Uh oh!

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

@maggiemoss maggiemoss changed the title Pep605 implementation Pep604 - Draft Implementation Jul 17, 2020
maggiemoss added 4 commits July 16, 2020 20:45
@maggiemoss
Add __or__ method to _SpecialGenericAlias
cd584d5
@maggiemoss
Add support for NewType with unions.
ba031c1
@maggiemoss
Remove old code from abstract.c
e62de73
@maggiemoss
Fix warning for incompatible pointer type.
f6ab05b
@gvanrossum

gvanrossum commented Jul 17, 2020

Copy link
Copy Markdown
Member

Thank you so much! Give me a few days to review this. Ping me if you haven't heard from me by Wednesday!

maggiemoss 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.

@gvanrossum gvanrossum changed the title Pep604 - Draft Implementation PEP 604 - Draft Implementation Jul 18, 2020
gvanrossum
gvanrossum reviewed Jul 18, 2020
View reviewed changes

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

Great start! Here's a boatload of review comments, from whitespace nits to feature requests.

Sorry, something went wrong.

Uh oh!

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

maggiemoss reacted with heart emoji
All reactions
  • ❤️ 1 reaction
Comment thread Lib/test/test_isinstance.py Resolved

Uh oh!

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

Comment thread Lib/test/test_types.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/typing.py Resolved

Uh oh!

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

Comment thread Objects/abstract.c Resolved

Uh oh!

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

Comment thread Objects/unionobject.c Resolved

Uh oh!

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

Comment thread Objects/unionobject.c Resolved

Uh oh!

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

Comment thread Objects/unionobject.c Resolved

Uh oh!

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

Comment thread Objects/unionobject.c Resolved

Uh oh!

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

Comment thread Objects/unionobject.c Resolved

Uh oh!

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

@maggiemoss
Add support for union use in subclasses.
9c20fbc
gvanrossum
gvanrossum reviewed Jul 19, 2020
View reviewed changes

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

(Presumably you were going to add more commits before asking for another review?)

Sorry, something went wrong.

Uh oh!

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

maggiemoss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Lib/test/test_isinstance.py Resolved

Uh oh!

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

Comment thread Objects/abstract.c Resolved

Uh oh!

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

Comment thread Objects/unionobject.c Resolved

Uh oh!

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

@maggiemoss

maggiemoss commented Jul 21, 2020

Copy link
Copy Markdown
Contributor Author

@gvanrossum thanks so much for the comments! I'll implement your suggestions and clean this up :)

All reactions

Sorry, something went wrong.

Uh oh!

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

@maggiemoss
maggiemoss requested a review from pablogsal August 18, 2020 22:32
@maggiemoss

maggiemoss commented Aug 20, 2020

Copy link
Copy Markdown
Contributor Author

@gvanrossum

I had thought of another case we might need to handle here, and was hoping to get your input. Should this:

typing.Union[int, str] is (int | str)

evaluate to true?

All reactions

Sorry, something went wrong.

Uh oh!

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

@maggiemoss

maggiemoss commented Aug 23, 2020

Copy link
Copy Markdown
Contributor Author

@pablogsal let me know if there are any other changes you'd like to see here.

All reactions

Sorry, something went wrong.

Uh oh!

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

@pablogsal

pablogsal commented Aug 23, 2020

Copy link
Copy Markdown
Member

@pablogsal let me know if there are any other changes you'd like to see here.

I just need to find some time to do another iteration 😉 Will try to do another pass by tomorrow, but we are very close! Thanks for the patience and tye good work :)

maggiemoss 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.

pablogsal
pablogsal reviewed Sep 8, 2020
View reviewed changes
Comment thread Objects/unionobject.c Resolved

Uh oh!

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

pablogsal
pablogsal reviewed Sep 8, 2020
View reviewed changes
Comment thread Include/unionobject.h Resolved

Uh oh!

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

@pablogsal
General cleanup, fix reference leaks, add new test for possible crashes
8c06c1d
@pablogsal

pablogsal commented Sep 8, 2020

Copy link
Copy Markdown
Member

@maggiemoss I have pushed a new commit (8c06c1d) to do some simplifications and to fix some minor reference count issues and crashes. Please, check out that everything seems ok in that commit :)

All reactions

Sorry, something went wrong.

Uh oh!

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

pablogsal added 2 commits September 9, 2020 00:52
@pablogsal
Add newline
37699f1
@pablogsal
Make unionobject APIs private
47a4cb3
pablogsal
pablogsal approved these changes Sep 9, 2020
View reviewed changes

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

This looks good to me!

Thanks for all the work and patience @maggiemoss! Great job :)

@gvanrossum I won't land it myself in case you or Maggie want to take a last check.

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting changes labels Sep 9, 2020
pablogsal
pablogsal reviewed Sep 9, 2020
View reviewed changes
Comment thread Objects/unionobject.c Resolved

Uh oh!

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

@pablogsal
Add minor test for GenericAlias
7f89abd
gvanrossum
gvanrossum approved these changes Sep 9, 2020
View reviewed changes

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

I think it's good! Thanks so much Maggie for all your work.

Sorry, something went wrong.

Uh oh!

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

All reactions
@maggiemoss
Remove ellipsis from repr.
d0be56f
@maggiemoss

maggiemoss commented Sep 9, 2020

Copy link
Copy Markdown
Contributor Author

Thanks so much for all of your reviews and comments, I've really appreciated it. 🎉

All reactions

Sorry, something went wrong.

Uh oh!

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

@maggiemoss
Remove commented out test code.
59f06f7
@gvanrossum

gvanrossum commented Sep 9, 2020

Copy link
Copy Markdown
Member

@maggiemoss
I noticed that some tests failed on Windows. Could it be that you need to rebase to the latest master?

"test.test_asyncio.test_sendfile.ProactorEventLoopTests.test_sendfile_close_peer_in_the_middle_of_receiving"

All reactions

Sorry, something went wrong.

Uh oh!

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

@pablogsal

pablogsal commented Sep 9, 2020

Copy link
Copy Markdown
Member

@maggiemoss
I noticed that some tests failed on Windows. Could it be that you need to rebase to the latest master?

"test.test_asyncio.test_sendfile.ProactorEventLoopTests.test_sendfile_close_peer_in_the_middle_of_receiving"

That's an unrelated race condition in asyncio in Windows, we can ignore it and just land

maggiemoss 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.

@pablogsal
pablogsal merged commit 1b4552c into python:master Sep 9, 2020
@bedevere-bot bedevere-bot removed the awaiting merge label Sep 9, 2020
@gvanrossum

gvanrossum commented Sep 9, 2020 via email

Copy link
Copy Markdown
Member
Congrats Maggie!!
maggiemoss, RealA10N, and breqdev reacted with heart emoji gwennlbh and RealA10N reacted with rocket emoji
All reactions
  • ❤️ 3 reactions
  • 🚀 2 reactions

Sorry, something went wrong.

Uh oh!

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

xzy3 pushed a commit to xzy3/cpython that referenced this pull request Oct 18, 2020
@maggiemoss @pablogsal @xzy3-cdc
bpo-41428: Implementation for PEP 604 (pythonGH-21515)
293703d
See https://www.python.org/dev/peps/pep-0604/ for more information.

Co-authored-by: Pablo Galindo <[email protected]>
@Fidget-Spinner Fidget-Spinner mentioned this pull request Jul 19, 2021
bpo-44662: Add ability to annotate types.Union #27214
Merged
AlexWaygood added a commit to AlexWaygood/typeshed that referenced this pull request Dec 4, 2021
@AlexWaygood
Add __(r)or__ to various typing classes
2794d7f
- `__or__` was added to `TypeVar` in Python 3.10: https://bugs.python.org/issue41428 (this PR: python/cpython#21515)
- `__or__` was added to `ForwardRef` in Python 3.11: https://bugs.python.org/issue45489
JelleZijlstra pushed a commit to python/typeshed that referenced this pull request Dec 5, 2021
@AlexWaygood
Add __(r)or__ to various typing classes (#6498)
ff4bd7c
- `__or__` was added to `TypeVar` in Python 3.10: https://bugs.python.org/issue41428 (this PR: python/cpython#21515)
- `__or__` was added to `ForwardRef` in Python 3.11: https://bugs.python.org/issue45489
@furkanonder furkanonder mentioned this pull request Mar 28, 2023
gh-60712: Include the "object" type in the lists of documented types #103036
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal approved these changes
@gvanrossum gvanrossum gvanrossum 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.

5 participants

@maggiemoss @the-knights-who-say-ni @gvanrossum @pablogsal @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.