This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hakril
Recipients Asdger Gdsfe, Dave Jones, eryksun, hakril, ncoghlan, serhiy.storchaka
Date 2020-01-18.22:14:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1579385691.22.0.176717486255.issue29270@roundup.psfhosted.org>
In-reply-to
Content
Hello,

As this issue may never be fixed for python3.6. I wanted to post a solution to bypass the bug. It may be useful for the next person stumbling on this as I have.

The __class__ closure is only created if a function use the word super(). This closure allow to call super() without argument.

By using another name than super() the closure is not created and your code can work. Only downside is that you need to call super in its explicit form super(Cls, self). But it is better that not working at all (and it is compatible python2).

Here is a sample:


super_bypass_issue29270 = super

class Something(ctypes.c_ulong):
  def __repr__(self):
    return "BYPASS: " + super_bypass_issue29270(Something, self).__repr__()

s = Something(42)
print(s)

BYPASS: <Something object at 0x00000134C9BA6848>
History
Date User Action Args
2020-01-18 22:14:51hakrilsetrecipients: + hakril, ncoghlan, serhiy.storchaka, eryksun, Dave Jones, Asdger Gdsfe
2020-01-18 22:14:51hakrilsetmessageid: <1579385691.22.0.176717486255.issue29270@roundup.psfhosted.org>
2020-01-18 22:14:51hakrillinkissue29270 messages
2020-01-18 22:14:50hakrilcreate