Commit 85d7b102 authored by Julian Taylor's avatar Julian Taylor

New upstream version 17.1.2

parent 07f4c84f
......@@ -25,5 +25,7 @@ examples/security/private_keys
wheelhouse
.coverage
.cache
.pytest_cache
win-dist
*.pickle
.ipynb_checkpoints
......@@ -70,10 +70,6 @@ matrix:
env:
- ZMQ=
- TORNADO=master
- python: 2.7
env:
- ZMQ=
- TORNADO=master
- python: 3.5
env: ZMQ=libzmq
- python: 3.4
......
......@@ -17,6 +17,7 @@ import os
import logging
import platform
from distutils import ccompiler
from distutils.sysconfig import customize_compiler
from subprocess import Popen, PIPE
from .misc import get_compiler, get_output_error
......@@ -108,6 +109,7 @@ def detect_zmq(basedir, compiler=None, **compiler_attrs):
# check if we need to link against Realtime Extensions library
if sys.platform.startswith('linux'):
cc = ccompiler.new_compiler(compiler=compiler)
customize_compiler(cc)
cc.output_dir = basedir
if not cc.has_function('timer_create'):
compiler_attrs['libraries'].append('rt')
......
......@@ -9,6 +9,16 @@ Changes in PyZMQ
This is a coarse summary of changes in pyzmq versions.
For a full changelog, consult the `git log <https://github.com/zeromq/pyzmq/commits>`_.
17.1.2
======
- Fix possible hang when working with asyncio
- Remove some outdated workarounds for old Cython versions
- Fix some compilation with custom compilers
- Remove unneeded link of libstdc++ on PyPy
17.1.0
======
......
......@@ -40,6 +40,7 @@ from distutils.ccompiler import new_compiler
from distutils.extension import Extension
from distutils.command.build_ext import build_ext
from distutils.command.sdist import sdist
from distutils.sysconfig import customize_compiler
from distutils.version import LooseVersion as V
from glob import glob
......@@ -602,6 +603,7 @@ class Configure(build_ext):
# check if we need to link against Realtime Extensions library
cc = new_compiler(compiler=self.compiler_type)
customize_compiler(cc)
cc.output_dir = self.build_temp
if not sys.platform.startswith(('darwin', 'freebsd')):
line()
......@@ -612,11 +614,6 @@ class Configure(build_ext):
else:
info("ok")
if pypy:
# seem to need explicit libstdc++ on linux + pypy
# not sure why
libzmq.libraries.append("stdc++")
# copy the header files to the source tree.
bundledincludedir = pjoin('zmq', 'include')
if not os.path.exists(bundledincludedir):
......
......@@ -254,7 +254,7 @@ def release(ctx, vs, upload=False):
for v in py_exes:
bdist(ctx, v, wheel=True, egg=(v in egg_pys))
if upload:
py = make_env('3.5', 'twine')
py = make_env(default_py, 'twine')
run(['twine', 'upload', 'dist/*'])
manylinux(ctx, vs, upload=upload)
......
......@@ -334,7 +334,7 @@ class _AsyncSocket(_zmq.Socket):
if self._recv_futures:
self._add_io_state(POLLIN)
return f
def _add_send_event(self, kind, msg=None, kwargs=None, future=None):
"""Add a send event, returning the corresponding Future"""
f = future or self._Future()
......@@ -365,10 +365,16 @@ class _AsyncSocket(_zmq.Socket):
if self._shadow_sock.EVENTS & POLLOUT:
# send immediately if we can
self._handle_send()
# make sure we schedule pending events
# if we are taking this shortcut
# only if not _send_futures because `_add_io_state`
# does the same thing below
if not self._send_futures:
self._schedule_remaining_events()
if self._send_futures:
self._add_io_state(POLLOUT)
return f
def _handle_recv(self):
"""Handle recv events"""
if not self._shadow_sock.EVENTS & POLLIN:
......@@ -383,13 +389,13 @@ class _AsyncSocket(_zmq.Socket):
f = None
else:
break
if not self._recv_futures:
self._drop_io_state(POLLIN)
if f is None:
return
if kind == 'poll':
# on poll event, just signal ready, nothing else.
f.set_result(None)
......
......@@ -23,23 +23,17 @@
# Imports
#-----------------------------------------------------------------------------
# allow const char*
cdef extern from *:
ctypedef char* const_char_ptr "const char*"
from cpython.version cimport PY_MAJOR_VERSION
from .libzmq cimport zmq_strerror, zmq_errno as zmq_errno_c
from zmq.utils.strtypes import bytes
def strerror(int errno):
"""strerror(errno)
Return the error string given the error number.
"""
cdef const_char_ptr str_e
# char * will be a bytes object:
# This is a const char *
str_e = zmq_strerror(errno)
if str is bytes:
if PY_MAJOR_VERSION <= 2:
# Python 2: str is bytes, so we already have the right type
return str_e
else:
......
......@@ -27,10 +27,6 @@
# Import the C header files
#-----------------------------------------------------------------------------
cdef extern from *:
ctypedef void* const_void_ptr "const void *"
ctypedef char* const_char_ptr "const char *"
# were it not for Windows,
# we could cimport these from libc.stdint
cdef extern from "zmq_compat.h":
......@@ -46,7 +42,7 @@ cdef extern from "zmq.h" nogil:
ctypedef int fd_t "ZMQ_FD_T"
enum: errno
char *zmq_strerror (int errnum)
const char *zmq_strerror (int errnum)
int zmq_errno()
void *zmq_ctx_new ()
......@@ -75,8 +71,8 @@ cdef extern from "zmq.h" nogil:
int zmq_msg_more (zmq_msg_t *msg)
int zmq_msg_get (zmq_msg_t *msg, int option)
int zmq_msg_set (zmq_msg_t *msg, int option, int optval)
const_char_ptr zmq_msg_gets (zmq_msg_t *msg, const_char_ptr property)
int zmq_has (const_char_ptr capability)
const char *zmq_msg_gets (zmq_msg_t *msg, const char *property)
int zmq_has (const char *capability)
void *zmq_socket (void *context, int type)
int zmq_close (void *s)
......@@ -90,7 +86,7 @@ cdef extern from "zmq.h" nogil:
int zmq_socket_monitor (void *s, char *addr, int flags)
# send/recv
int zmq_sendbuf (void *s, const_void_ptr buf, size_t n, int flags)
int zmq_sendbuf (void *s, const void *buf, size_t n, int flags)
int zmq_recvbuf (void *s, void *buf, size_t n, int flags)
ctypedef struct zmq_pollitem_t:
......@@ -108,10 +104,10 @@ cdef extern from "zmq.h" nogil:
int zmq_curve_public (char *z85_public_key, char *z85_secret_key)
# 4.2 draft
int zmq_join (void *s, const_char_ptr group)
int zmq_leave (void *s, const_char_ptr group)
int zmq_join (void *s, const char *group)
int zmq_leave (void *s, const char *group)
int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id);
uint32_t zmq_msg_routing_id(zmq_msg_t *msg);
int zmq_msg_set_group(zmq_msg_t *msg, const_char_ptr group);
const_char_ptr zmq_msg_group(zmq_msg_t *msg);
int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id)
uint32_t zmq_msg_routing_id(zmq_msg_t *msg)
int zmq_msg_set_group(zmq_msg_t *msg, const char *group)
const char *zmq_msg_group(zmq_msg_t *msg)
......@@ -61,7 +61,6 @@ except (ImportError, AttributeError):
import zmq
from zmq.error import _check_version
from .checkrc cimport _check_rc
from zmq.utils.strtypes import bytes,unicode,basestring
#-----------------------------------------------------------------------------
# Code
......@@ -347,7 +346,6 @@ cdef class Frame:
"""
cdef int rc
cdef uint32_t routing_id
cdef const_char_ptr buf
if option == 'routing_id':
routing_id = value
......@@ -357,8 +355,7 @@ cdef class Frame:
elif option == 'group':
if isinstance(value, unicode):
value = value.encode('utf8')
buf = value
rc = zmq_msg_set_group(&self.zmq_msg, buf)
rc = zmq_msg_set_group(&self.zmq_msg, value)
_check_rc(rc)
return
......@@ -387,7 +384,6 @@ cdef class Frame:
cdef char *property_c = NULL
cdef Py_ssize_t property_len_c = 0
cdef uint32_t routing_id
cdef const_char_ptr buf
# zmq_msg_get
if isinstance(option, int):
......
......@@ -39,7 +39,6 @@ from zmq.utils.buffers cimport asbuffer_r, viewfromobject_r
from .libzmq cimport (
fd_t,
int64_t,
const_char_ptr,
zmq_errno,
......@@ -105,7 +104,6 @@ import zmq
from zmq.backend.cython import constants
from .checkrc cimport _check_rc
from zmq.error import ZMQError, ZMQBindError, InterruptedSystemCall, _check_version
from zmq.utils.strtypes import bytes,unicode,basestring
#-----------------------------------------------------------------------------
# Code
......@@ -116,14 +114,14 @@ IPC_PATH_MAX_LEN = get_ipc_path_max_len()
# inline some small socket submethods:
# true methods frequently cannot be inlined, acc. Cython docs
cdef inline int nbytes(buf):
cdef inline Py_ssize_t nbytes(buf) except -1:
"""get n bytes"""
if PY_VERSION_HEX >= 0x03030000:
return buf.nbytes
cdef int n = buf.itemsize
cdef int ndim = buf.ndim
cdef int dim = 0
cdef Py_ssize_t n = buf.itemsize
cdef Py_ssize_t ndim = buf.ndim
cdef Py_ssize_t i
for i in range(ndim):
n *= buf.shape[i]
return n
......@@ -699,8 +697,7 @@ cdef class Socket:
raise RuntimeError("libzmq must be built with draft support")
if isinstance(group, unicode):
group = group.encode('utf8')
cdef const_char_ptr c_group = group
cdef int rc = zmq_join(self.handle, c_group)
cdef int rc = zmq_join(self.handle, group)
_check_rc(rc)
def leave(self, group):
......@@ -717,8 +714,7 @@ cdef class Socket:
_check_version((4,2), "RADIO-DISH")
if not zmq.has('draft'):
raise RuntimeError("libzmq must be built with draft support")
cdef const_char_ptr c_group = group
cdef int rc = zmq_leave(self.handle, c_group)
cdef int rc = zmq_leave(self.handle, group)
_check_rc(rc)
......
......@@ -22,10 +22,9 @@
from .libzmq cimport (
zmq_curve_keypair,
zmq_curve_public,
zmq_has, const_char_ptr,
zmq_has,
)
from zmq.error import ZMQError, _check_rc, _check_version
from zmq.utils.strtypes import unicode
def has(capability):
"""Check for zmq capability by name (e.g. 'ipc', 'curve')
......
......@@ -9,7 +9,7 @@ from zmq.backend import zmq_version_info
VERSION_MAJOR = 17
VERSION_MINOR = 1
VERSION_PATCH = 0
VERSION_PATCH = 2
VERSION_EXTRA = ""
__version__ = '%i.%i.%i' % (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
......
......@@ -67,10 +67,9 @@ cdef extern from "Python.h":
# Python 2 buffer interface (legacy)
cdef extern from "Python.h":
ctypedef void const_void "const void"
Py_ssize_t Py_END_OF_BUFFER
int PyObject_CheckReadBuffer(object)
int PyObject_AsReadBuffer (object, const_void **, Py_ssize_t *) except -1
int PyObject_AsReadBuffer (object, const void **, Py_ssize_t *) except -1
int PyObject_AsWriteBuffer(object, void **, Py_ssize_t *) except -1
object PyBuffer_FromMemory(void *ptr, Py_ssize_t s)
......@@ -168,7 +167,7 @@ cdef inline object asbuffer(object ob, int writable, int format,
if writable:
PyObject_AsWriteBuffer(ob, &bptr, &blen)
else:
PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
PyObject_AsReadBuffer(ob, <const void **>&bptr, &blen)
if format:
try: # numpy.ndarray
dtype = ob.dtype
......
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