Description
Copied from a discuss discussion:
I’m looking into implementing
except*
in Cython. Most of it’s relatively straight-forward (I hope) but a big chunk of the important logic is in_PyExc_PrepReraiseStar
and it doesn’t seem possible to access that without including internal headers (which is never popular).It’d probably be possible to reimplement the logic for it myself, but it’s obviously quite a large chunk of code to be copying and trying to keep up to date.
Would it be possible to expose this more publicly? This is unlikely to be performance critical so, even something as simple as a method on
BaseExceptionGroup
that’s accessible from Python would do.(For the moment I’m probably just doing to do the internal header access, but it’d be nice to be able to do it right in future)
I was directed here:
I think this function, along with the other intrinsics (which are functions that implement an opcode) can be exposed as part of the ‘unstable API’. I’m not sure where we are on having that?
I'd slightly disagree with this interpretation - while it looks like _PyExc_PrepReraiseStar
is an intrinsic, it also seems like something that can be done to an instance of BaseExceptionGroup
independently of the bytecode (although practically I don't know why you'd want to except for reimplementing the interpreter).