oremanj / asynctb Goto Github PK
View Code? Open in Web Editor NEWTraceback tools for Python async programming
License: Other
Traceback tools for Python async programming
License: Other
We should support running this without interpreter-specific hacks. But I think interpreter-specific hacks are required to get the line number and name of the nursery object (or the other context manager that wraps a nursery), so here's some notes on how to implement them on pypy.
In principle, we can determine the current greenlet in another thread by looking at the "__greenlet_ts_curkey"
entry in the thread state dict. In practice, the thread state structure is impossible to access safely from Python because there's no way to keep it from being freed while you're looking at it. (In C, you can just refuse to release the GIL.)
We can also use C's ability to hold the GIL to extract consistent tracebacks from other threads in general, avoiding the thing where we think the coroutine is running but it gets suspended before we call sys._current_frames().
We could read thread-locals of other threads, which would help with "where even is the Trio runner anyway" for cross-thread task tree dumping (eg on infinite loop).
Most of this won't work on pypy. pypy greenlet is a thoroughly non-magical module that uses a threading.local for its "current" knowledge, so knowing how to read other threads' locals would solve both 1 and 3, and we might be able to solve 2 using setcheckinterval(), since pypy uses a different GIL approach than cpython does (it's like old cpython). Also, we don't have as much of a need to identify the current greenlet on pypy anyway, since pypy's greenlets don't break f_back like cpython's do.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.