[IronPython] IronPython and CPython httplib and ssl modules produce IOError

Bill Janssen janssen at parc.com
Sun Jun 12 19:34:37 CEST 2011

Lukáš Duběda <loocas at duber.cz> wrote:

> Hi there,
> I hope someone out there could help me out with this problem.
> I have a API written in Python (CPython that is) that relies on
> some of the CPython modules, such as ssl and httplib.
> The problem is, when I call the API and its methods via IronPython
> I get IOError: "System.IO.IOException: Unable to write data to the
> transport connection: Cannot access a disposed object."

I re-wrote the SSL module for CPython back in 2007, and as part of that
delved into the socket and httplib modules, further than I wanted to go.
The httplib module relies on the socket module's not actually closing
the socket when it gets GC'd.  It passes the file descriptor off to a
callback function, and drops the socket object, assuming that the file
descriptor will stay open so the callback function can read from it,
until someone (presumably the callback function) closes it.  (This
apparently was originally done to work around the absence of dup() on
Windows.)  I believe it was re-engineered in py3, but am not sure what
the status is in py2.  I could easily see this leading to something
similar to what you're seeing.


More information about the Ironpython-users mailing list