Setting a flag is another approach. There's already an extension mechanism for storing arbitrary per-thread state in a dictionary object, accessible via `PyThreadState_GetDict`.
However, implementing the parallel code-path turned out to be easier (just a bit of cut & paste) and a bit saner to debug. `PyObject_Dir` tries to look up a few attributes on the object (`__dir__`, `__bases__`, &c.) which may not exist. There's a high likelihood of multiple AttributeErrors each time through.
Any documentation on Mac OS patches? Would be very curious to learn more about how these worked out in practice!
That old MacOS stuff is hard to find on the Internet. One thing I did find that gets a bit close is http://www.mactech.com/articles/develop/issue_16/Radcliffe_f.... Problem is that it likely is a bit hard to follow if you do not know about the stuff. Moreover, it doesn't really show patching itself.
I am fairly sure there is some article about patching in those archives of Develop, but I couldn't find it.
https://hg.python.org/cpython/file/1d708436831a/Python/pysta...
However, implementing the parallel code-path turned out to be easier (just a bit of cut & paste) and a bit saner to debug. `PyObject_Dir` tries to look up a few attributes on the object (`__dir__`, `__bases__`, &c.) which may not exist. There's a high likelihood of multiple AttributeErrors each time through.
Any documentation on Mac OS patches? Would be very curious to learn more about how these worked out in practice!