Skip to content

Commit ced7c27

Browse files
committed
[py3] Use __bool__ instead of __nonzero__
1 parent 7e11384 commit ced7c27

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

python/PyQt/PyQt5/QtCore.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
_QVariant__hash__ = QVariant.__hash__
99

1010

11-
def __nonzero__(self):
12-
if self.isNull():
13-
return False
14-
else:
15-
return True
11+
def __bool__(self):
12+
return not self.isNull()
1613

1714

1815
def __repr__(self):
@@ -42,7 +39,7 @@ def __hash__(self):
4239
else:
4340
return _QVariant__hash__(self)
4441

45-
QVariant.__nonzero__ = __nonzero__
42+
QVariant.__bool__ = __bool__
4643
QVariant.__repr__ = __repr__
4744
QVariant.__eq__ = __eq__
4845
QVariant.__ne__ = __ne__

0 commit comments

Comments
 (0)