Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a275c98 commit 03ca1a9Copy full SHA for 03ca1a9
1 file changed
Doc/whatsnew/3.2.rst
@@ -456,7 +456,18 @@ Some smaller changes made to the core Python language are:
456
would otherwise be absent from the class dictionary. Formerly, *hasattr*
457
would catch any exception, possibly masking genuine errors. Now, *hasattr*
458
has been tightened to only catch :exc:`AttributeError` and let other
459
- exceptions pass through.
+ exceptions pass through::
460
+
461
+ >>> class A:
462
+ @property
463
+ def f(self):
464
+ return 1 // 0
465
466
+ >>> a = A()
467
+ >>> hasattr(a, 'f')
468
+ Traceback (most recent call last):
469
+ ...
470
+ ZeroDivisionError: integer division or modulo by zero
471
472
(Discovered by Yury Selivanov and fixed by Benjamin Peterson; :issue:`9666`.)
473
0 commit comments