Bugs item #1732662, was opened at 2007-06-07 11:50
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732662&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jan Ondrej (ondrejj)
Assigned to: Nobody/Anonymous (nobody)
Summary: socket makefile objects are not independent

Initial Comment:
Running some python 2.4 code on python 2.5 does not work properly. Python 
documentation for socket library says:

makefile(       [mode[, bufsize]])
    Return a file object associated with the socket. (File objects are 
described in 3.9, ``File Objects.'') The file object references a dup()ped 
version of the socket file descriptor, so the file object and socket object may 
be closed or garbage-collected independently.

It is true for python 2.4, but not for python 2.5 (at least not one in Fedora 
7). Closing socket and then using file descriptor does not work. Here is an 
example code:

import socket
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(('salstar.sk', 25))
f=s.makefile('rw')
s.shutdown(1)
s.close()
print f.readline()

It writes "220 work.salstar.sk ESMTP Postfix" in python 2.4 but raises an 
exception for python 2.5:

Traceback (most recent call last):
  File "socktest.py", line 9, in <module>
    print f.readline()
  File "/usr/lib/python2.5/socket.py", line 345, in readline
    data = self._sock.recv(self._rbufsize)
socket.error: (9, 'Bad file descriptor')

Is it a bug of python 2.5 or a bug in documentation?
Or is it Fedora specific? Can somebody test it on other systems?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732662&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to