-
-
Save anonymous/c3bb858cf1684c643271 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r --exclude='*.so' --exclude='*.pyc' gevent-zeromq/gevent_zeromq/__init__.py pyzmq/zmq/green/__init__.py | |
2c2,12 | |
< """gevent_zmq - gevent compatibility with zeromq. | |
--- | |
> #----------------------------------------------------------------------------- | |
> # Copyright (c) 2011-2012 Travis Cline | |
> # | |
> # This file is part of pyzmq | |
> # It is adapted from upstream project zeromq_gevent under the New BSD License | |
> # | |
> # Distributed under the terms of the New BSD License. The full license is in | |
> # the file COPYING.BSD, distributed as part of this software. | |
> #----------------------------------------------------------------------------- | |
> | |
> """zmq.green - gevent compatibility with zeromq. | |
11c21 | |
< from gevent_zeromq import zmq | |
--- | |
> import zmq.green as zmq | |
22,39c32,36 | |
< import gevent_zeromq.core as zmq | |
< zmq.Context = zmq._Context | |
< zmq.Socket = zmq._Socket | |
< | |
< def monkey_patch(test_suite=False): | |
< """ | |
< Monkey patches `zmq.Context` and `zmq.Socket` | |
< | |
< If test_suite is True, the pyzmq test suite will be patched for | |
< compatibility as well. | |
< """ | |
< ozmq = __import__('zmq') | |
< ozmq.Socket = zmq.Socket | |
< ozmq.Context = zmq.Context | |
< | |
< if test_suite: | |
< from gevent_zeromq.tests import monkey_patch_test_suite | |
< monkey_patch_test_suite() | |
--- | |
> from zmq import * | |
> from zmq.green.core import _Context, _Socket | |
> Context = _Context | |
> Socket = _Socket | |
> | |
Only in pyzmq/zmq/green/: core.c | |
diff -r --exclude='*.so' --exclude='*.pyc' gevent-zeromq/gevent_zeromq/core.py pyzmq/zmq/green/core.py | |
0a1,10 | |
> #----------------------------------------------------------------------------- | |
> # Copyright (c) 2011-2012 Travis Cline | |
> # | |
> # This file is part of pyzmq | |
> # It is adapted from upstream project zeromq_gevent under the New BSD License | |
> # | |
> # Distributed under the terms of the New BSD License. The full license is in | |
> # the file COPYING.BSD, distributed as part of this software. | |
> #----------------------------------------------------------------------------- | |
> | |
2a13 | |
> | |
18a30 | |
> _socket_class = _Socket | |
20,29d31 | |
< def socket(self, socket_type): | |
< """Overridden method to ensure that the green version of socket is used | |
< | |
< Behaves the same as :meth:`zmq.core.context.Context.socket`, but ensures | |
< that a :class:`Socket` with all of its send and recv methods set to be | |
< non-blocking is returned | |
< """ | |
< if self.closed: | |
< raise ZMQError(ENOTSUP) | |
< return _Socket(self, socket_type) | |
53c55 | |
< def close(self): | |
--- | |
> def close(self, linger=None): | |
61c63 | |
< super(_Socket, self).close() | |
--- | |
> super(_Socket, self).close(linger) | |
diff -r --exclude='*.so' --exclude='*.pyc' gevent-zeromq/gevent_zeromq/core.pyx pyzmq/zmq/green/core.pyx | |
0a1,10 | |
> #----------------------------------------------------------------------------- | |
> # Copyright (c) 2011-2012 Travis Cline | |
> # | |
> # This file is part of pyzmq | |
> # It is adapted from upstream project zeromq_gevent under the New BSD License | |
> # | |
> # Distributed under the terms of the New BSD License. The full license is in | |
> # the file COPYING.BSD, distributed as part of this software. | |
> #----------------------------------------------------------------------------- | |
> | |
2a13 | |
> | |
21,31c32,35 | |
< | |
< def socket(self, int socket_type): | |
< """Overridden method to ensure that the green version of socket is used | |
< | |
< Behaves the same as :meth:`zmq.core.context.Context.socket`, but ensures | |
< that a :class:`Socket` with all of its send and recv methods set to be | |
< non-blocking is returned | |
< """ | |
< if self.closed: | |
< raise ZMQError(ENOTSUP) | |
< return _Socket(self, socket_type) | |
--- | |
> @property | |
> def _socket_class(self): | |
> """overridden to ensure green Sockets are created by this Context""" | |
> return _Socket | |
58c62 | |
< def close(self): | |
--- | |
> def close(self, linger=None): | |
66c70 | |
< super(_Socket, self).close() | |
--- | |
> super(_Socket, self).close(linger) | |
Only in gevent-zeromq/gevent_zeromq/: tests.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment