|
Mapping a stdio-FILE to a Python-file: msg#00052python.pyrex
Some time ago, Joachim Saul <saul@xxxxxxxxxxxxxx> wrote: > Ideally, I would like Pyrex to directly map the file object to a > FILE, since both are standard types in their respective languages. I > suspect there is probably a much more "beautiful" way to achieve the > mapping than explicitly referring to the 'f_fp'. Did I perhaps just > overlook something really trivial? One way to do it is this: cdef extern from "Python.h": FILE *PyFile_AsFile(object) except NULL Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@xxxxxxxxxxxxxxxxxxxxx +--------------------------------------+ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | (no subject): 00052, Patrick Maupin |
|---|---|
| Next by Date: | too much work in c function: 00052, Bryan Weingarten |
| Previous by Thread: | (no subject)i: 00052, Patrick Maupin |
| Next by Thread: | too much work in c function: 00052, Bryan Weingarten |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |