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

Roger Binns rogerb at rogerbinns.com
Tue May 3 07:04:38 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/02/2011 03:51 PM, exarkun at twistedmatrix.com wrote:
> On 07:09 pm, amauryfa at gmail.com wrote:
>> Fortunately, there are not so many of them:
>> - PyFile_AsFile(), PyFile_FromFile, because files opened by pypy don't
>> use a FILE* (like python3)
> 
> Do fdopen(3) and fileno(3) not help here?

That gets you the OS handle but the FILE* has a whole bunch of other crud
inside like a buffer, current offsets and eol handling.  If it is just a one
time transfer from Python to C or vice versa then it could work, but if both
use the file/FILE concurrently then chances are you'll end up with file
corruption.

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

iEYEARECAAYFAk2/jOEACgkQmOOfHg372QTLWACdHs8UC5UBeby+kONqFV9Q8Jar
sKAAn1EB8cXK8wZYWjOEnInTAYcSSXIQ
=9/ZX
-----END PGP SIGNATURE-----



More information about the pypy-dev mailing list