Skip to content
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

4.1.0 error after relase in 2022.02.13 NameError: name '_UnpackAlias' is not defined #19

Closed
yt605155624 opened this issue Feb 13, 2022 · 11 comments · Fixed by python/typing#1076

Comments

@yt605155624
Copy link

yt605155624 commented Feb 13, 2022

File "/workspace/tools/venv/lib/python3.7/site-packages/typing_extensions.py", line 143, in _collect_type_vars
not isinstance(t, _UnpackAlias)
NameError: name '_UnpackAlias' is not defined

This bug was found in the CI of PaddleSpeech in the before dawn of 2022.02.14 (China), there are many python lib depends on typing, for exapmle, jsonlines, the error reporting stack is

2022-02-13 23:18:22 Traceback (most recent call last):
2022-02-13 23:18:22   File "/workspace/paddlespeech/t2s/exps/fastspeech2/../synthesize.py", line 18, in <module>
2022-02-13 23:18:22     import jsonlines
2022-02-13 23:18:22   File "/workspace/tools/venv/lib/python3.7/site-packages/jsonlines/__init__.py", line 6, in <module>
2022-02-13 23:18:22     from .jsonlines import (
2022-02-13 23:18:22   File "/workspace/tools/venv/lib/python3.7/site-packages/jsonlines/jsonlines.py", line 33, in <module>
2022-02-13 23:18:22     from typing_extensions import Literal  # pragma: no cover
2022-02-13 23:18:22   File "/workspace/tools/venv/lib/python3.7/site-packages/typing_extensions.py", line 494, in <module>
2022-02-13 23:18:22     OrderedDict = typing._alias(collections.OrderedDict, (KT, VT))
2022-02-13 23:18:22   File "/usr/local/lib/python3.7/typing.py", line 1191, in _alias
2022-02-13 23:18:22     return _GenericAlias(origin, params, special=True, inst=inst)
2022-02-13 23:18:22   File "/usr/local/lib/python3.7/typing.py", line 613, in __init__
2022-02-13 23:18:22     self.__parameters__ = _collect_type_vars(params)
2022-02-13 23:18:22   File "/workspace/tools/venv/lib/python3.7/site-packages/typing_extensions.py", line 143, in _collect_type_vars
2022-02-13 23:18:22     not isinstance(t, _UnpackAlias)
2022-02-13 23:18:22 NameError: name '_UnpackAlias' is not defined

Our CI works well with the new release typing_extensions 4.1.1, Thanks

@yt605155624 yt605155624 changed the title 4.1.0 error after relase in 2022.02.13 4.1.0 error after relase in 2022.02.13 NameError: name '_UnpackAlias' is not defined Feb 13, 2022
@sobolevn
Copy link
Member

Oh, looks like _UnpackAlias is not defined for this branch: https://github.com/python/typing/blob/16cf672885bbf1dfb44914b9f0f50929380b7b41/typing_extensions/src/typing_extensions.py#L2634-L2691

I will send a PR with:

  1. New tests
  2. _UnpackAlias -> _is_unpack

@JelleZijlstra
Copy link
Member

Thanks @yt605155624 for the report! Could you share the code that led to this error? I'd like to understand how our CI missed this case.

@carlogrisetti
Copy link

carlogrisetti commented Feb 13, 2022

@JelleZijlstra I have a TravisCI build failing due to this issue. It only happens on Python 3.7 and the stack starts at from typing import Protocol in importlib_metadata module
Another traceback is from pytest import console_main

This is the incriminated build: https://app.travis-ci.com/github/tensortrade-org/tensortrade/jobs/559499288

@JelleZijlstra
Copy link
Member

Thanks! I see you're using 3.7.1 there; let me see if the version of 3.7 makes a difference.

@carlogrisetti
Copy link

That was unintentional, TravisCI chose 3.7.1 when asked to test on 3.7 so I suppose this issue will arise in many other builds all over the GitHubverse :)
You could temporarily yank 4.1.0 waiting for a 4.1.1 release if times are not compact enough, otherwise I suppose that you'll receive a lot of complaints tomorrow with the start of the work week.

Regards!

@JelleZijlstra
Copy link
Member

typing.OrderedDict was new in 3.7.2, I suspect that has something to do with it. Unfortunately pyenv wasn't able to build 3.7.1 for me, but 3.7.10 is fine for me locally.

Sounds like Travis needs to update their 3.7 installation :)

But I'll release 4.1.1 later today to fix this.

JelleZijlstra referenced this issue in python/typing Feb 13, 2022
See if this reproduces #1073
@JelleZijlstra
Copy link
Member

We confirmed that it fails on 3.7.1. To make sure we don't get any other similar issues, I'm thinking of running CI on the .0 versions of all supported Python versions. That way, we run the earliest and latest bugfix release of each version, which will hopefully be enough to catch this sort of thing in general.

@JelleZijlstra
Copy link
Member

I just released https://pypi.org/project/typing-extensions/4.1.1/ with the fix. Thanks for reporting this bug!

@yt605155624
Copy link
Author

yt605155624 commented Feb 14, 2022

Thanks for your timely fix and release!

@cdce8p
Copy link
Contributor

cdce8p commented Feb 15, 2022

Would it make sense to yank the 4.1.0 release from PyPI?

@srittau
Copy link
Collaborator

srittau commented Feb 15, 2022

Python 3.7.1 is ancient, released in 2018, with 10 further versions released since then. I don't think yanking this is necessary.

@srittau srittau transferred this issue from python/typing May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants