Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

pypy compatibility #273

Open
ernado opened this Issue · 0 comments

1 participant

@ernado

For pypy 2.2.1 (at python 2.7.3), for example, echo_client.py will raise an unhandled exception:

Traceback (most recent call last):
  File "app_main.py", line 72, in run_toplevel
  File "sleek.py", line 157, in <module>
    if xmpp.connect():
  File "build/bdist.linux-x86_64/egg/sleekxmpp/clientxmpp.py", line 160, in connect
    reattempt=reattempt)
  File "build/bdist.linux-x86_64/egg/sleekxmpp/xmlstream/xmlstream.py", line 443, in connect
    args=(reattempt,))
  File "build/bdist.linux-x86_64/egg/sleekxmpp/thirdparty/statemachine.py", line 70, in transition
    func=func, args=args, kwargs=kwargs)
  File "build/bdist.linux-x86_64/egg/sleekxmpp/thirdparty/statemachine.py", line 111, in transition_any
    return_val = func(*args,**kwargs) if func is not None else True
  File "build/bdist.linux-x86_64/egg/sleekxmpp/xmlstream/xmlstream.py", line 572, in _connect
    self.set_socket(self.socket, ignore=True)
  File "build/bdist.linux-x86_64/egg/sleekxmpp/xmlstream/xmlstream.py", line 796, in set_socket
    self.filesocket = FileSocket(self.socket)
  File "/home/ernado/pypy-2.2.1-src/lib-python/2.7/socket.py", line 300, in __init__
    sock._reuse()
AttributeError: 'Socket26' object has no attribute '_reuse'

Workaround::

#... 
import import sleekxmpp

if "__pypy__" in sys.builtin_module_names:
    def _reuse(self):
        self._sock._reuse()
    def _drop(self):
        self._sock._drop()

    sleekxmpp.xmlstream.xmlstream.Socket26._reuse = _reuse
    sleekxmpp.xmlstream.xmlstream.Socket26._drop = _drop

# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.