Commit c93c89fa authored by Jason Madden's avatar Jason Madden

Fix test__server.py for pypy3

parent afa27cf4
...@@ -13,6 +13,7 @@ import sys ...@@ -13,6 +13,7 @@ import sys
import time import time
from gevent import _socketcommon from gevent import _socketcommon
from gevent._util import copy_globals from gevent._util import copy_globals
from gevent._compat import PYPY
import _socket import _socket
from os import dup from os import dup
...@@ -50,6 +51,13 @@ class _wrefsocket(_socket.socket): ...@@ -50,6 +51,13 @@ class _wrefsocket(_socket.socket):
__slots__ = ("__weakref__", ) __slots__ = ("__weakref__", )
if PYPY:
# server.py unwraps the socket object to get the raw _sock;
# it depends on having a timeout property alias, which PyPy does not
# provide.
timeout = property(lambda s: s.gettimeout(),
lambda s, nv: s.settimeout(nv))
class socket(object): class socket(object):
""" """
...@@ -467,10 +475,10 @@ class socket(object): ...@@ -467,10 +475,10 @@ class socket(object):
howlong = f() howlong = f()
if howlong < 0.0: if howlong < 0.0:
raise ValueError('Timeout value out of range') raise ValueError('Timeout value out of range')
self.timeout = howlong self.__dict__['timeout'] = howlong
def gettimeout(self): def gettimeout(self):
return self.timeout return self.__dict__['timeout']
def shutdown(self, how): def shutdown(self, how):
if how == 0: # SHUT_RD if how == 0: # SHUT_RD
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment