[pypy-dev] cpyext reference counting and other gc's
Amaury Forgeot d'Arc
amauryfa at gmail.com
Tue May 3 00:08:42 CEST 2011
Hi,
2011/5/2 Roger Binns <rogerb at rogerbinns.com>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>> - Some trace and Traceback management functions that are not even
>> documented (but used by Cython :-))
>
> I use them too. One of the problems with the standard documented C api is
> that tracebacks do not include any methods implemented in C. For example if
> a Python method calls a C method which calls a Python method which errors
> then the traceback won't include the C code. This is very confusing if you
> don't know why the C code called a Python method.
>
> I show this in the doc for my project:
>
> http://apidoc.apsw.googlecode.com/hg/exceptions.html#augmented-stack-traces
>
> As the doc shows I end up adding in synthetic stack frames so you can
> clearly see the C code. I also augment the synthetic frames with local
> variables that can be introspected to find out what is going on. The very
> bottom of the page shows what a difference that makes.
>
> You can see the C code to do it here:
>
> http://code.google.com/p/apsw/source/browse/src/traceback.c
>
> Note use of functions like PyThreadState_Get() and PyTraceback_here. As
> long as the signature of AddTraceBackHere can remain the same then I don't
> care what the body inside is for pypy.
Yes, we've implemented PyTraceback_here so that it works exactly for this usage.
Can you check whether pypy does the right thing for you as well?
--
Amaury Forgeot d'Arc
More information about the pypy-dev
mailing list