Skip to content

bpo-40389: Improve repr of typing.Optional#19714

Merged
gvanrossum merged 5 commits into
python:masterfrom
Endilll:master
Apr 30, 2020
Merged

bpo-40389: Improve repr of typing.Optional#19714
gvanrossum merged 5 commits into
python:masterfrom
Endilll:master

Conversation

@Endilll

@Endilll Endilll commented Apr 25, 2020

Copy link
Copy Markdown
Contributor

@the-knights-who-say-ni

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@Endilll

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

Comment thread Lib/typing.py Outdated

def __repr__(self):
if (self.__origin__ == Union and len(self.__args__) == 2
and self.__args__[1] is type(None)):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi @Endilll, thanks for opening a pull request for this. Notice that this does not work, when None is the first element:

>>> import typing
>>> typing.Union[None, int]
typing.Union[NoneType, int]
>>> typing.Union[None, int] == typing.Optional[int]
True

This change will also need some tests and an NEWS entry.

@Endilll Endilll Apr 25, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the feedback. Fixed.

@remilapeyre

remilapeyre commented Apr 25, 2020

Copy link
Copy Markdown

You can add a NEWS entry using https://blurb-it.herokuapp.com/

@aeros

aeros commented Apr 26, 2020

Copy link
Copy Markdown
Contributor

Thanks for the PR and welcome @Endilll.

FYI: assuming the idea is approved by the maintainers of typing, this change will most definitely require some updates to the tests in test_typing.py (in Lib/test).

@Endilll
Endilll requested a review from ericvsmith as a code owner April 26, 2020 06:25

@ilevkivskyi ilevkivskyi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, thanks! Also be sure to sign the CLA.

The Azure failure look like a flake, but I can't re-trigger it, and it is required for merging. @zooba do you know how to fix this?

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Please sign the CLA so we can merge.

@Endilll

Endilll commented Apr 27, 2020

Copy link
Copy Markdown
Contributor Author

I've submitted CLA back on Saturday, and bot says that one business day is needed to update the records, so I suppose we just need to wait a bit.

@gvanrossum

Copy link
Copy Markdown
Member

Closing and reopening to re-run the Azure pipelines.

@gvanrossum gvanrossum closed this Apr 30, 2020
@gvanrossum gvanrossum reopened this Apr 30, 2020
@gvanrossum
gvanrossum merged commit 138a9b9 into python:master Apr 30, 2020
@bedevere-bot

Copy link
Copy Markdown

@gvanrossum: Please replace # with GH- in the commit message next time. Thanks!

@gvanrossum

Copy link
Copy Markdown
Member

Congratulations!

@Endilll

Endilll commented Apr 30, 2020

Copy link
Copy Markdown
Contributor Author

I want to thank everybody for such a welcoming attitude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants