[pypy-dev] cpyext reference counting and other gc's

Roger Binns rogerb at rogerbinns.com
Mon May 2 23:21:46 CEST 2011


-----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.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk2/IGYACgkQmOOfHg372QRzAgCglUdQlOoF3fQBJAAQ7Lf8vRs2
4OMAn1weWlNDNtHHcccB1vjxSvn7wk59
=jTAS
-----END PGP SIGNATURE-----



More information about the pypy-dev mailing list