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

Test regression on Python 3.12: AttributeError: type object 'Foo' has no attribute '_is_protocol' #199

Closed
mgorny opened this issue May 26, 2023 · 2 comments · Fixed by #200

Comments

@mgorny
Copy link

mgorny commented May 26, 2023

On 4.6.2 (e84f909):

$ tox -e py312
.pkg: install_requires> python -I -m pip install 'flit_core<4,>=3.4'
.pkg: _optional_hooks> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: get_requires_for_build_sdist> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: build_sdist> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True flit_core.buildapi
py312: install_package> python -I -m pip install --force-reinstall --no-deps /tmp/typing_extensions/.tox/.tmp/package/1/typing_extensions-4.6.2.tar.gz
py312: commands[0] /tmp/typing_extensions/src> python -m unittest discover
.........................................................................................................................................s..s..s........................................................................................E.................................................................................................s.........
======================================================================
ERROR: test_protocols_isinstance_generic_classes (test_typing_extensions.ProtocolTests.test_protocols_isinstance_generic_classes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/typing_extensions/src/test_typing_extensions.py", line 2287, in test_protocols_isinstance_generic_classes
    self.assertIsInstance(foo, HasX)
  File "/usr/lib/python3.12/unittest/case.py", line 1292, in assertIsInstance
    if not isinstance(obj, cls):
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/typing.py", line 1815, in __instancecheck__
    if super().__instancecheck__(instance):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen abc>", line 119, in __instancecheck__
  File "/usr/lib/python3.12/typing.py", line 1799, in __subclasscheck__
    return super().__subclasscheck__(other)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen abc>", line 123, in __subclasscheck__
  File "/usr/lib/python3.12/typing.py", line 1902, in _proto_hook
    issubclass(other, Generic) and other._is_protocol):
                                   ^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Foo' has no attribute '_is_protocol'

----------------------------------------------------------------------
Ran 340 tests in 0.149s

FAILED (errors=1, skipped=4)
py312: exit 1 (0.38 seconds) /tmp/typing_extensions/src> python -m unittest discover pid=116427
.pkg: _exit> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True flit_core.buildapi
  py312: FAIL code 1 (7.63=setup[7.26]+cmd[0.38] seconds)
  evaluation failed :( (7.85 seconds)
@JelleZijlstra
Copy link
Member

Fixed by python/cpython@2b7027d

@mgorny
Copy link
Author

mgorny commented May 26, 2023

Thank you!

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 a pull request may close this issue.

2 participants