[Python-Dev] C-API functions for reading/writing tstate->exc_* ?

Nick Coghlan ncoghlan at gmail.com
Sun Feb 19 15:31:04 CET 2012


On Mon, Feb 20, 2012 at 12:18 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> Of course, you could always go through the Python API, getting the sys
> module, extracting the relevant functions and calling them using the
> abstract API. That's what I'd recommend if this were purely a CPython
> question. But I assume that (for some reason) that's not appropriate
> for PyPy.

I had the same thought, but it actually only works cleanly for the
"fetch" half of the equation. You'd have to muck around with actually
raising an exception to handle *setting* those fields, which is
*really* relying on implementation details). That said, it may be
worth further exploring the idea of invoking appropriate snippets of
Python code to get the desired effect.

My other question would be whether there's an existing *private* C API
with the desired behaviour that could be made public, or if this would
be a genuinely new addition to the API.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list