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

Stefan Behnel stefan_ml at behnel.de
Sun Feb 26 08:47:36 CET 2012


Stefan Behnel, 23.02.2012 09:01:

"Martin v. Löwis", 19.02.2012 23:24:

When compiling for PyPy, Cython therefore needs a way to tell PyPy about any changes. For the tstate->curexc* fields, there are the two functions PyErrFetch() and PyErrRestore(). Could we have two similar "official" functions for the exc* fields? Maybe PyErrFetchLast() and PyErrRestoreLast()?

I wouldn't call the functions *Last, as this may cause confusion with sys.last*. I'm also unsure why the current API uses this Fetch/Restore pair of functions where Fetch clears the variables. A Get/Set pair of functions would be more natural, IMO (where Get returns "new" references). This would give PyErrGetExcInfo/PyErrSetExcInfo. Ok, I added a tracker ticket and I'm working on a patch. http://bugs.python.org/issue14098

The patch is attached to the ticket, including documentation and test. I'd be happy if someone could review it and apply it.

Thanks!

Stefan



More information about the Python-Dev mailing list