Skip to content

extract fixes from limited api tests #2083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tools/install_libzmq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ LIBZMQ_VERSION=$(python buildutils/bundle.py)
PYZMQ_DIR="$PWD"
LICENSE_DIR="$PYZMQ_DIR/licenses"
test -d "$LICENSE_DIR" || mkdir "$LICENSE_DIR"

SHLIB_EXT=".so"
if [[ "$(uname)" == "Darwin" ]]; then
SHLIB_EXT=".dylib"
# make sure deployment target is set
echo "${MACOSX_DEPLOYMENT_TARGET=}"
test ! -z "${MACOSX_DEPLOYMENT_TARGET}"
Expand Down Expand Up @@ -44,6 +45,12 @@ if [[ "$(uname)" == "Darwin" ]]; then
fi

PREFIX="${ZMQ_PREFIX:-/usr/local}"

if [ -f "$PREFIX/lib/libzmq${SHLIB_EXT}" ]; then
echo "using $PREFIX/lib/libzmq${SHLIB_EXT}"
exit 0
fi

# add rpath so auditwheel patches it
export LDFLAGS="${LDFLAGS} -Wl,-rpath,$PREFIX/lib"

Expand Down
18 changes: 8 additions & 10 deletions zmq/backend/cython/_zmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,20 @@
size_t,
sizeof,
)
from cython.cimports.cpython import (
PyBytes_AsString,
PyBytes_FromStringAndSize,
PyBytes_Size,
PyErr_CheckSignals,
)
from cython.cimports.cpython.buffer import (
Py_buffer,
PyBUF_ANY_CONTIGUOUS,
PyBUF_WRITABLE,
PyBuffer_Release,
PyObject_GetBuffer,
)
from cython.cimports.cpython.bytes import (
PyBytes_AsString,
PyBytes_FromStringAndSize,
PyBytes_Size,
)
from cython.cimports.cpython.exc import PyErr_CheckSignals
from cython.cimports.libc.errno import EAGAIN, EINTR, ENAMETOOLONG, ENOENT, ENOTSOCK

# cimports require Cython 3
from cython.cimports.libc.stdint import uint32_t
from cython.cimports.libc.stdio import fprintf
from cython.cimports.libc.stdio import stderr as cstderr
Expand Down Expand Up @@ -367,10 +365,10 @@ def __init__(
_check_rc(rc)
self._failed_init = False

def __del__(self):
def __dealloc__(self):
if self._failed_init:
return
# This simply decreases the 0MQ ref-count of zmq_msg.
# decrease the 0MQ ref-count of zmq_msg
with nogil:
rc: C.int = zmq_msg_close(address(self.zmq_msg))
_check_rc(rc)
Expand Down
2 changes: 2 additions & 0 deletions zmq/utils/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#pragma once

#include <stdlib.h>

#if defined(_WIN32)
# include <windows.h>
#else
Expand Down
Loading