En Mon, 10 Nov 2008 11:44:44 -0200, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> escribió:
On Nov 10, 2:23 pm, Floris Bruynooghe <[EMAIL PROTECTED]>
wrote:
Sorry, I probably should have mentioned you want to cast the object to
PyFileObject and then use the PyFile_AsFile() function to get the
FILE*
[EMAIL PROTECTED] wrote:
Sadly this doesn't work on "file-like"
objects like those that are created by opening bz2 files (using the
bz2 lib).
If the C code you're calling requires a FILE *, then you're
out of luck. There's no way of getting a FILE * from an object
that's not based on an actual
On Nov 11, 12:55 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Mon, 10 Nov 2008 05:44:44 -0800, [EMAIL PROTECTED] wrote:
> > All in all I must say that implementing a C extension is a piece of
> > cake. Had I known that it was this straightforward I wouldn't have asked
> > my questio
On Mon, 10 Nov 2008 05:44:44 -0800, [EMAIL PROTECTED] wrote:
> All in all I must say that implementing a C extension is a piece of
> cake. Had I known that it was this straightforward I wouldn't have asked
> my questions in the first place. Making the whole thing more robust will
> be a bit more d
On Mon, 10 Nov 2008 05:36:58 -0800, [EMAIL PROTECTED] wrote:
> On Nov 10, 1:16 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>> On Mon, 10 Nov 2008 03:11:06 -0800, [EMAIL PROTECTED] wrote:
>> > 1. How can I pass a file-like object into the C part? The PyArg_*
>> > functions can convert o
On Nov 10, 2:23 pm, Floris Bruynooghe <[EMAIL PROTECTED]>
wrote:
> Sorry, I probably should have mentioned you want to cast the object to
> PyFileObject and then use the PyFile_AsFile() function to get the
> FILE* handle.
Yes, I figured that out by now. Sadly this doesn't work on "file-like"
obje
On Nov 10, 1:16 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Mon, 10 Nov 2008 03:11:06 -0800, [EMAIL PROTECTED] wrote:
> > 1. How can I pass a file-like object into the C part? The PyArg_*
> > functions can convert objects to all sort of types, but not FILE*.
>
> http://docs.python.
On Nov 10, 1:18 pm, Floris Bruynooghe <[EMAIL PROTECTED]>
wrote:
> On Nov 10, 11:11 am, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > 1. How can I pass a file-like object into the C part? The PyArg_*
> > functions can convert objects to all sort of types, but not FILE*.
>
> Parse it as a g
Hi
On Nov 10, 11:11 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> 1. How can I pass a file-like object into the C part? The PyArg_*
> functions can convert objects to all sort of types, but not FILE*.
Parse it as a generic PyObject object (format string of "O" in
PyArg_*), check the type a
On Mon, 10 Nov 2008 03:11:06 -0800, [EMAIL PROTECTED] wrote:
> 1. How can I pass a file-like object into the C part? The PyArg_*
> functions can convert objects to all sort of types, but not FILE*.
http://docs.python.org/c-api/file.html#PyFile_AsFile
> 2. How can I preserve information needed in
[EMAIL PROTECTED] wrote:
Hello,
I'm trying to write a Python extension module in C for the first time.
I have two questions:
I have a much better suggestion:
Use Cython!
Although I'm pretty experienced with the Python C API, I prefer Cython
over hand written C code for most stuff. It's s
11 matches
Mail list logo