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 yselivanov
Recipients gvanrossum, ncoghlan, oconnor663, vstinner, yselivanov
Date 2015-12-02.20:42:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1449088928.24.0.557699402309.issue25779@psf.upfronthosting.co.za>
In-reply-to
Content
> Yury, can you help me understand why `hasattr("foo", "bar")` triggers the infinite loop there, but not `print("foo")`?


hasattr uses getattr under the hood. getattr raises an AttributeError, and that triggers PyErr_SetError, which has an infinite "while" loop.  Instead of "hasattr" you can use anything that raises an error.
History
Date User Action Args
2015-12-02 20:42:08yselivanovsetrecipients: + yselivanov, gvanrossum, ncoghlan, vstinner, oconnor663
2015-12-02 20:42:08yselivanovsetmessageid: <1449088928.24.0.557699402309.issue25779@psf.upfronthosting.co.za>
2015-12-02 20:42:08yselivanovlinkissue25779 messages
2015-12-02 20:42:08yselivanovcreate