Hi Ned,
I don't know much about coverage, but I'd start with figuring out if
it works with basic greenlet.
On Sat, Nov 17, 2012 at 2:04 PM, Ned Batchelder <
n...@nedbatchelder.com> wrote:
> I'd like to understand why my Python trace function fails while newbrough's
> succeeds. What assumption in my code is broken when running under gevent?
> I maintain my own stack data structure that should correspond to the Python
> call stack, and that clearly isn't right under gevent, but can someone
> explain concisely where that goes wrong?
Well, the whole point of greenlet is to switch call stack:
If you had function f that creates greenlet from function g() and
switches to it and then it calls function e() the call stack looks
like this:
f() -> g() -> e()
However, when a switch occurs the g() -> e() gets cut out from the
stack and saved on the heap so you're left with
f()
or, more likely, you switch into some other greenlet that also had a
call stack (previously saved):
f() -> bb() -> cc()
Basically call stack no longer changes incrementally, between it can
change much more drastically.
If you saved the data structures you maintain in greenlet-local object
(gevent.local.local) maybe that would help? (You can use thread-local
and under monkey patching they'll be greenlet-local).
Also, the recent greenlet version has tracing function that allow you
to hook into switching, this could be useful.
BTW, this list is a perfect place to discuss this, even if it's
greenlet-related.