Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1004

__signature__ attribute of a class is not writeable after importing pyside2

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.12.2
    • Fix Version/s: 5.12.3
    • Component/s: PySide, Shiboken
    • Labels:
      None
    • Commits:
      0fc54b04d6f47b74a35e4d13d5f62e459db20132 (pyside/pyside-setup/5.12)

      Description

      There was a recent report in CPython where importing pyside2 causes subsequent classes created after the import to have __signature__ as not writeable. This causes AttributeError when mocking objects where __signature__ is changed in the mocked object.  Since importing causes this problem I am filing this bug. Importing shiboken2 also causes same error where __signature__ could not be set. This has caused a regression in mock library and perhaps other programs that try to change __signature__. Any help in this is appreciated.

      # sample reproducer
      
      $ 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
      

       
      Bug reports :

        Attachments

        For Gerrit Dashboard: PYSIDE-1004
        # Subject Branch Project Status CR V

          Activity

            People

            • Assignee:
              ctismer Christian Tismer
              Reporter:
              xtreak Karthikeyan Singaravelan
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes