monsoonsoldier / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

Missing "socket.makefile" - C++ compile error #117

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to compile socket.makefile('fb')

What is the expected output? What do you see instead?

gcc error:

httplib.cpp:525: error: `class __socket__::socket' has no member named 
`makefile'

What version of the product are you using? On what operating system?

Shed Skin 0.6, Cygwin, Windows 7

Please provide any additional information below.

Shed Skin recognizes "socket.makefile" in Shed Skin, but the necessary C++ 
function is missing during link.  This is the last thing that prevents 
"httplib.py" from working at all with Shed Skin. There's no easy workaround 
without going into the innards of the Shed Skin library.

Original issue reported on code.google.com by na...@animats.com on 18 Nov 2010 at 7:34

GoogleCodeExporter commented 8 years ago
ah, yes, this function is still missing, as discussed a long time ago in issue 
37. I'm not sure what it would take to implement it. I will ask the author of 
the socket implementation if he thinks this would be difficult to add. so 
perhaps an easy task, but I don't know.

Original comment by mark.duf...@gmail.com on 18 Nov 2010 at 7:45

GoogleCodeExporter commented 8 years ago
     Dealing with HTTP connections needs this.  Without it,
Python file I/O won't work on sockets.  All you can do is "recv",
which no higher level code uses.

     The HTTP library has to read the input up to the end of headers,
then return a Python file object which is ready to start returning the
"body" of the document.  Since the socket has no idea where that
boundary is, and you can't rewind a socket, everybody has to be using
the same buffering system for that handoff to work.

     (Converting "httplib.py" has been a big job.  It doesn't
look much like the stock module any more, even though it does
much the same things.  But it's close to working.  "makefile" is a
showstopper, but should be the last thing I can't work around.)

                John Nagle

Original comment by na...@animats.com on 18 Nov 2010 at 8:14

GoogleCodeExporter commented 8 years ago
thanks again for looking into httplib! I look forward to the result.

the cpython implementation of socket.makefile looks quite simple:

http://svn.python.org/view/python/trunk/Modules/socketmodule.c?revision=81029&vi
ew=markup

on UNIX it's just a call to 'dup' and 'fdopen'.. I'm not sure what 
_open_osfhandle does under WIN32.

Original comment by mark.duf...@gmail.com on 19 Nov 2010 at 7:07

GoogleCodeExporter commented 8 years ago
I hadn't realized that "fdopen" works on sockets.  That helps with the 
buffering problem.

The main thing that "makefile" does is to create a Python file object and 
connect it to "fdopen", I'm not clear on how to do that inside Shed Skin's 
library. (Actually, I'm trying to avoid going into the internals of Shed Skin.) 
Are you going to put "makefile" in the Shed Skin library soon?

Original comment by na...@animats.com on 19 Nov 2010 at 7:29

GoogleCodeExporter commented 8 years ago
I just did! could you please test if it at least compiles under WIN32..? :-)

Original comment by mark.duf...@gmail.com on 20 Nov 2010 at 1:40

GoogleCodeExporter commented 8 years ago
hello, hello. I just fixed some compiler errors for this under Windows, as part 
of building a windows package for 0.7 again..

Original comment by mark.duf...@gmail.com on 8 Dec 2010 at 7:51

GoogleCodeExporter commented 8 years ago
I've been busy on other stuff, and will get back to Shed Skin
shortly.  If you get 0.7 out, let me know; I don't have time
right now to build from the repository.

                John Nagle

Original comment by na...@animats.com on 8 Dec 2010 at 8:15

GoogleCodeExporter commented 8 years ago
sorry if I didn't let you know about the 0.7 release. 0.7.1 is out already by 
now.. not for Windows yet, though, but 0.7 should work. 

Original comment by mark.duf...@gmail.com on 27 Feb 2011 at 12:39

GoogleCodeExporter commented 8 years ago
I guess we can close this one. if it still a problem for someone, they can open 
a new issue. in any case, I will test if things at least compile as part of the 
release process for windows.

Original comment by mark.duf...@gmail.com on 25 May 2011 at 7:49