Created
September 29, 2017 03:21
-
-
Save altendky/9f942709dfc2f33019723ffff43260b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sys.version: 3.6.2 (default, Sep 15 2017, 22:53:56) | |
[GCC 5.4.0 20160609] | |
sys.platform: linux | |
QT_VERSION_STR: 5.9.1 | |
PYQT_VERSION_STR: 5.9 | |
weak ref succeeded for <PyQt5.QtCore.QObject object at 0x7f97002be0d8> | |
Traceback (most recent call last): | |
File "pyqtweakref.py", line 27, in <module> | |
weakref.ref(it) | |
TypeError: cannot create weak reference to 'PyQt5.QtCore.pyqtBoundSignal' object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import traceback | |
import weakref | |
import PyQt5.QtCore | |
import PyQt5.QtWidgets | |
print('sys.version:', sys.version) | |
print('sys.platform:', sys.platform) | |
print('QT_VERSION_STR:', PyQt5.QtCore.QT_VERSION_STR) | |
print('PYQT_VERSION_STR:', PyQt5.QtCore.PYQT_VERSION_STR) | |
class C(PyQt5.QtCore.QObject): | |
signal = PyQt5.QtCore.pyqtSignal() | |
c = C() | |
them = ( | |
PyQt5.QtCore.QObject(), | |
c.signal, | |
) | |
for it in them: | |
sys.stdout.flush() | |
try: | |
weakref.ref(it) | |
except: | |
traceback.print_exc() | |
else: | |
print('weak ref succeeded for', it) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment