Yury Selivanov added the comment: > 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25779> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com