Slight tagent but do you and many others here appear mere hours after their project is mentioned? Pure luck or a large percentage of HN users are querying the api to see who mentions their projects?
thank you so much! it wasn't a big deal (if you remembered to check after using py-spy, granted). i'd take py-spy with this bug vs not having py-spy at all any day :)
i've seen this multiple times, happens especially when detaching py-spy. have to be very careful to check if the process isn't stopped when debugging in prod ^_^
Does anyone know why Python chose linked list for its frames vs an array like Ruby? I imagine both choices have their own advantages and disadvantages.
No definitive answer, but educated guess: I'm not sure how things are in Ruby, but in Python frame object lifetime does not correspond to the C stack implementing the interpreter. If your code throws an exception, frames are returned as part of the public API of the exception object, and can thus indefinitely outlive the associated function execution.
You could still implement an array-oriented frame stack in Python, but I think that would mean exceptions become more expensive, as it means making a complete copy of the array any time an exception was thrown, even if the user never makes use of it.
It would be trivial to change from a linked list to an allocated vector if it were not for exposed APIs. In fact it would most likely be more efficient.
Most likely because it was easier. It's definitely not a good choice but unfortunately `PyFrame_GetBack(PyFrameObject *)` exists as an API which makes it tricky now to switch to something else as it must be possible to discover the previous frame from a frame. It's even exposed to userspace with `frameobject.f_back`.