Issue2273
Created on 2015-02-23.02:56:23 by jfroco, last changed 2015-09-22.17:28:12 by zyasoft.
msg9549 (view) |
Author: Juan Francisco Roco (jfroco) |
Date: 2015-02-23.02:56:22 |
|
import socket
w = socket.socket()
Per definition socket(family=None, type=None, proto=None)
As type=None, next call is: return _socketobject(None, None, None)
_socketobject:
def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None):
As type=None this is the value it will get, not the default value.
>>> def a(b=1):
... print b
...
>>> a(b=10)
10
>>> a()
1
>>> a(b=None)
None
So, type is still None when calling _realsocket, so self.proto = None
This causes w.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) to fail, as self.proto = None
Quick fix:
def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None):
print "_socketobject: type %s" % type
if not type:
type = SOCK_STREAM
if _sock is None:
_sock = _realsocket(family, type, proto)
self._sock = _sock
for method in _delegate_methods:
setattr(self, method, getattr(_sock, method))
|
msg9551 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-02-23.04:38:59 |
|
Makes sense.
|
msg10036 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-05-07.20:17:05 |
|
Currently this bug causes one failure in the WebOb test suite, due to code like so:
def _send_interrupted_req(server, path='/'):
sock = socket.socket()
sock.connect(('localhost', server.server_port))
f = sock.makefile('wb')
f.write(bytes_(_interrupted_req % path))
f.flush()
Time to fix!
|
msg10223 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-09-04.04:43:54 |
|
Fixed as of https://hg.python.org/jython/rev/b3b82ef080a9
|
msg10232 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-09-04.13:49:23 |
|
WebOb tests now working:
$ ~/jythondev/jython27/dist/bin/nosetests
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 1064 tests in 51.020s
OK
Jython startup time accounting for why it takes longer to test than with CPython? A separate issue at the very least!
|
|
Date |
User |
Action |
Args |
2015-09-22 17:28:12 | zyasoft | set | status: pending -> closed |
2015-09-04 13:49:23 | zyasoft | set | messages:
+ msg10232 |
2015-09-04 04:43:54 | zyasoft | set | status: open -> pending resolution: accepted -> fixed messages:
+ msg10223 |
2015-05-11 02:58:53 | zyasoft | set | assignee: zyasoft |
2015-05-07 20:17:05 | zyasoft | set | messages:
+ msg10036 |
2015-04-15 20:43:00 | zyasoft | set | assignee: zyasoft -> (no value) milestone: Jython 2.7.1 |
2015-02-23 04:38:59 | zyasoft | set | priority: high assignee: zyasoft resolution: accepted messages:
+ msg9551 nosy:
+ zyasoft |
2015-02-23 02:56:23 | jfroco | create | |
|