[Python-Dev] Re: Intended invariants for signals in CPython

2020-06-29 Thread Yonatan Zunger via Python-Dev
e of thumb: If your Python code has comments talking about specific opcodes, you are writing some Really Interesting Python Code. :) Yonatan On Sat, Jun 27, 2020 at 10:26 PM Nick Coghlan wrote: > On Fri., 26 Jun. 2020, 7:02 am Chris Jerdonek, > wrote: > >> On Wed, Jun 24, 2020 at

[Python-Dev] Re: Intended invariants for signals in CPython

2020-06-25 Thread Yonatan Zunger via Python-Dev
limb that particular mountain yet, but I figured I'd see what obvious holes other people could poke in it. Thanks for your help! On Thu, Jun 25, 2020 at 1:27 PM Antoine Pitrou wrote: > On Thu, 25 Jun 2020 11:18:13 -0700 > Yonatan Zunger via Python-Dev wrote: > > Also, just to

[Python-Dev] Re: Intended invariants for signals in CPython

2020-06-25 Thread Yonatan Zunger via Python-Dev
e to say it's a damned clever solution to the problem. On Thu, Jun 25, 2020 at 6:35 PM Yonatan Zunger wrote: > I had not -- thank you! > > On Thu, Jun 25, 2020 at 1:49 PM Chris Jerdonek > wrote: > >> On Wed, Jun 24, 2020 at 5:15 PM Yonatan Zunger via Python-Dev < >&

[Python-Dev] Re: Intended invariants for signals in CPython

2020-06-25 Thread Yonatan Zunger via Python-Dev
I had not -- thank you! On Thu, Jun 25, 2020 at 1:49 PM Chris Jerdonek wrote: > On Wed, Jun 24, 2020 at 5:15 PM Yonatan Zunger via Python-Dev < > python-dev@python.org> wrote: > >> That said, the meta-question still applies: Are there things which are >> gen

[Python-Dev] Re: Intended invariants for signals in CPython

2020-06-25 Thread Yonatan Zunger via Python-Dev
Also, just to sanity-check that I understand things correctly: Python signal handlers *are* reentrant, in that a signal handler can be interrupted by another signal, is that right? Is there any general recommendation on how to write signal handlers in order to manage that? (Antoine, I *so* wish I

[Python-Dev] Re: Intended invariants for signals in CPython

2020-06-25 Thread Yonatan Zunger via Python-Dev
I'm taking it from this thread that suppressing signals in a small window is not something anyone in their right mind would really want to attempt. :) (Or that if they did, it would have to be through a proper change to the runtime, not something higher-level) On Thu, Jun 25, 2020 at 7:14 AM Antoi

[Python-Dev] Re: Intended invariants for signals in CPython

2020-06-24 Thread Yonatan Zunger via Python-Dev
... Reading through more of the code, I realized that I greatly underestimated the number of interruptible operations. That said, the meta-question still applies: Are there things which are generally intended *not* to be interruptible by signals, and if so, is there some consistent way of indicati

[Python-Dev] Intended invariants for signals in CPython

2020-06-24 Thread Yonatan Zunger via Python-Dev
Hi everyone, I'm in the process of writing some code to defer signals during critical regions, which has involved a good deal of reading through the CPython implementation to understand the behaviors. Something I've found is that there appears to be a lot of thoughtfulness about where the signal h