Skip to content

Cannot copy class inheriting from generic #458

@mitar

Description

@mitar

Example:

Python 3.6.2 (default, Jul 17 2017, 16:44:32) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import typing
>>> class Foo(typing.Sequence):
...   pass
... 
>>> Foo.__copy__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/typing.py", line 1189, in __copy__
    self.__extra__, self.__orig_bases__)
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/typing.py", line 953, in __new__
    assert origin is not None
AssertionError
>>> typing.Sequence.__copy__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/typing.py", line 1189, in __copy__
    self.__extra__, self.__orig_bases__)
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/typing.py", line 953, in __new__
    assert origin is not None
AssertionError
>>> typing.Sequence[typing.T_co].__copy__()
typing.Sequence[+T_co]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions