Re: [IronPython] IronPython and file descriptors

2008-12-18 Thread Tom Wright
t to that: http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20242 Michael *From:* [email protected] [mailto:[email protected]] *On Behalf Of *Michael Foord *Sent:* Monday, December 15, 2008 12:53 PM *To:* Discussion of IronPython *Subject:*

Re: [IronPython] IronPython and file descriptors

2008-12-17 Thread William Reade
on.com [mailto:[email protected]] *On Behalf Of *Michael Foord *Sent:* Monday, December 15, 2008 12:53 PM *To:* Discussion of IronPython *Subject:* Re: [IronPython] IronPython and file descriptors 2008/12/15 Dino Viehland <mailto:[email protected]>> Presumably CPytho

Re: [IronPython] IronPython and file descriptors

2008-12-16 Thread Tom Wright
Python *Subject:* Re: [IronPython] IronPython and file descriptors 2008/12/15 Dino Viehland <mailto:[email protected]>> Presumably CPython is linking against msvcrt and is using the C abstraction rather than calling the Win32 APIs which return handles directly. As Curt said the

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Michael Foord
n.com] *On Behalf Of *Michael Foord *Sent:* Monday, December 15, 2008 12:53 PM *To:* Discussion of IronPython *Subject:* Re: [IronPython] IronPython and file descriptors 2008/12/15 Dino Viehland <mailto:[email protected]>> Presumably CPython is linking against msvcrt and is using the

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Dino Viehland
.ironpython.com [mailto:[email protected]] On Behalf Of Michael Foord Sent: Monday, December 15, 2008 12:53 PM To: Discussion of IronPython Subject: Re: [IronPython] IronPython and file descriptors 2008/12/15 Dino Viehland mailto:[email protected]>> Presumably CPython is linking agai

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Michael Foord
gt; From: [email protected] [mailto: > [email protected]] On Behalf Of Slide > Sent: Monday, December 15, 2008 10:21 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython and file descriptors > > On Mon, Dec 15, 2008 at 11:18 AM, To

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Curt Hagenlocher
[email protected]] On Behalf Of Slide > Sent: Monday, December 15, 2008 10:21 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IronPython and file descriptors > > On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright > wrote: > > Agreed. It is certainly poss

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Dino Viehland
de Sent: Monday, December 15, 2008 10:21 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython and file descriptors On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright wrote: > Agreed. It is certainly possible with some work to get a file descriptor and > pass it to C code. > > This

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Curt Hagenlocher
I think I understand the motivation pretty well; what I'm saying is that I don't see that this is possible. IronPython has no access to the table being used by the C library to map between Windows HANDLEs and clib file descriptors, so we can't return a clib-compatible fd. Even if we were to retur

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Slide
On Mon, Dec 15, 2008 at 11:18 AM, Tom Wright wrote: > Agreed. It is certainly possible with some work to get a file descriptor and > pass it to C code. > > This is not the problem, however. Ironclad's aim (eventually) is to allow > *arbitrary* C extensions to work with Ironpython without changing

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Tom Wright
Agreed. It is certainly possible with some work to get a file descriptor and pass it to C code. This is not the problem, however. Ironclad's aim (eventually) is to allow *arbitrary* C extensions to work with Ironpython without changing the extensions. Ctypes aim is to allow arbitrary C code t

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Curt Hagenlocher
Ah, that was the function I was looking for. Sure, the file descriptor exists in the C library under Windows. But the C library is basically doing exactly the same thing as IronPython is; it's maintaining the file descriptor number as an abstraction on top of the HANDLE that the operating system

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Tom Wright
Not so: Though admittedly you have to do quite a bit of work to get the file descriptor into .NET. http://msdn.microsoft.com/en-us/library/bdts1c9x(VS.71).aspx To clarify - the C library was written to work with Python (not IronPython) and is not my code. Thanks, Tom Curt Hagenlocher wrot

Re: [IronPython] IronPython and file descriptors

2008-12-15 Thread Curt Hagenlocher
There's no such thing as a file descriptor number in .NET -- or, for that matter, in Windows itself! :) (The latter is something of a semantic point, of course, as a HANDLE serves something of the same role in Win32 as a file descriptor number does in Unix.) If you have a FileStream, I think you c

[IronPython] IronPython and file descriptors

2008-12-15 Thread Tom Wright
Hi, At the moment file.fileno() returns an arbitrary identifier of a python file rather than a true file descriptor. This is semi-blocking the Ironclad port of PIL. Code in PIL gets an integer using fileno() and passes it directly to C code where a call to write() is made. To fix this one w