Skip to content

bpo-32873: Remove a name hack for generic aliases in typing module #6376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 5, 2018

Conversation

ilevkivskyi
Copy link
Member

@ilevkivskyi ilevkivskyi commented Apr 4, 2018

This removes a hack and replaces it with a proper mapping {'list': 'List', 'dict': 'Dict', ...}.

https://bugs.python.org/issue32873

Lib/typing.py Outdated
@@ -629,7 +642,10 @@ def __init__(self, origin, params, *, inst=True, special=False, name=None):
self._special = special
if special and name is None:
orig_name = origin.__name__
name = orig_name[0].title() + orig_name[1:]
if orig_name in _normalize_alias:
name = _normalize_alias[orig_name]
Copy link
Member

Choose a reason for hiding this comment

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

name = _normalize_alias.get(orig_name, orig_name)

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, interesting suggestion, let's go with it.

@ilevkivskyi ilevkivskyi merged commit 2a363d2 into python:master Apr 5, 2018
@miss-islington
Copy link
Contributor

Thanks @ilevkivskyi for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@ilevkivskyi ilevkivskyi deleted the fix-name-hack branch April 5, 2018 00:25
@bedevere-bot
Copy link

GH-6378 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 5, 2018
…ythonGH-6376)

This removes a hack and replaces it with a proper
mapping {'list': 'List', 'dict': 'Dict', ...}.
(cherry picked from commit 2a363d2)

Co-authored-by: Ivan Levkivskyi <[email protected]>
miss-islington added a commit that referenced this pull request Apr 5, 2018
…H-6376)

This removes a hack and replaces it with a proper
mapping {'list': 'List', 'dict': 'Dict', ...}.
(cherry picked from commit 2a363d2)

Co-authored-by: Ivan Levkivskyi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants