Hi Brett, On Mon, Apr 17, 2006 at 05:34:16PM -0700, Brett Cannon wrote: > + if (meth == self) { > + PyErr_SetString(PyExc_RuntimeError, > + "recursive __call__ definition"); > + return NULL; > + } This is not the proper way, as it can be worked around with a pair of objects whose __call__ point to each other. The solution is to use the counter of Py_{Enter,Leave}RecursiveCall(), as was done for old-style classes (see classobject.c). By the way, this is a known problem: the example you show is Lib/test/crashers/infinite_rec_3.py, and the four other infinite_rec_*.py are all slightly more subtle ways to trigger a similar infinite loop in C. They point to the SF bug report at http://python.org/sf/1202533, where we discuss the problem in general. Basically, someone should try to drop many Py_{Enter,Leave}RecursiveCall() pairs in the source until all the currently-known bugs go away, and then measure if this has a noticeable performance impact. A bientot, Mr. 8 Of The 12 Files In That Directory
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4