[issue36848] autospec fails with AttributeError when mocked class has __signature__ non-writeable

Karthikeyan Singaravelan report at bugs.python.org
Wed May 8 08:22:35 EDT 2019


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

As noted in https://github.com/testing-cabal/mock/issues/464#issuecomment-490381389 just importing PySide2 makes __signature__ not writeable for any class defined after the import.

$ python
Python 3.8.0a4+ (heads/master:b1c3167c23, May  8 2019, 05:17:38)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo: pass
...
>>> Foo.__signature__ = 1
>>> import PySide2
>>> class Bar: pass
...
>>> Bar.__signature__ = 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: attribute '__signature__' of 'type' objects is not writable

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36848>
_______________________________________


More information about the Python-bugs-list mailing list