Giter Club home page Giter Club logo

asynctb's People

Contributors

oremanj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

asynctb's Issues

Notes to self about pypy object layout

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.

Support cross-thread tracebacking better by using a C extension

  • 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.