Wednesday 4 May 2011 — This is over 13 years old. Be careful.
It all started innocently enough, as it always does. A coverage.py bug said that the coverage trace function wasn’t properly re-installed if this apparently innocuous line was executed:
sys.settrace(sys.gettrace())
I knew enough about trace functions to see that it was not going to be trivial to fix, but I didn’t know how involved it was going to get. I certainly didn’t expect that it would include finding a 10-year-old bug in Python itself!
Read all the details in How C trace functions really work.
I hope it’s helpful or at least interesting. I don’t know how many people are trying to write C trace functions, or care if they round-trip properly. Coverage.py’s function works well now, and in a few years when I’m baffled by this again, I’ll be able to come back and read it to remind myself of the details at least.
Comments
Add a comment: