Closed yaelmi3 closed 3 years ago
Good job.
@yaelmi3 : As you can see, your test is failing on Python 2 because the exception message is different. Please change your test to not check the exception message at all. Confirming it's a TypeError
is sufficient.
@alexmojaki : It looks like Yael took the thread_global.__dict__.setdefault('depth', -1)
line to the top of trace
, which solved the problem. Do you think it'll make more sense to put it in __enter__
instead? Any other insights would be appreciated.
@yaelmi3 Great, now waiting for Alex's input.
Do you think it'll make more sense to put it in
__enter__
instead?
I guess so. Should be a bit faster.
@yaelmi3 mind moving that line?
Done
@yaelmi3 Congrats on your first contribution. I added you to the list of authors and made a new release with your bugfix :+1:
Fix '_thread._local' object has no attribute 'depth' raised by snooper if there's exception upon calling snooped func by initializing thread_global dict with depth when entering the trace() func