mirror of
https://github.com/oxen-io/oxen-pyoxenmq.git
synced 2023-12-13 20:50:34 +01:00
b0edf998f8
This fixes a segfault in the reply handling code, where the destructor of a `py::function` wasn't necessarily happening with the GIL held, which could make Python segfault. The solution that was here to address this didn't work because it was relying on std::optionals, but it is possible (and apparently sometimes happens) that the std::function this lambda gets stuffed into gets moved (or maybe copied?), which then results in *two* lambda destructions: we were correctly dealing with the one that eventually gets called by clearing things properly when it gets called, but the temporary destructor also fires, and that is the one that broke. This changes it to instead leak bare pointers into the lambda and then recapture them inside when we get called; since we are guaranteed to be called exactly once, this recaptures them without losing them but doesn't incur destruction of a py::function deep in oxenmq (outside of GIL scope).
30 lines
773 B
Python
30 lines
773 B
Python
from setuptools import setup
|
|
|
|
# Available at setup time due to pyproject.toml
|
|
from pybind11.setup_helpers import Pybind11Extension, build_ext
|
|
|
|
__version__ = "1.0.5"
|
|
|
|
# Note:
|
|
# Sort input source files if you glob sources to ensure bit-for-bit
|
|
# reproducible builds (https://github.com/pybind/python_example/pull/53)
|
|
|
|
ext_modules = [Pybind11Extension(
|
|
"oxenmq",
|
|
["src/oxenmq.cpp"],
|
|
cxx_std=17,
|
|
libraries=["oxenmq"],
|
|
),
|
|
]
|
|
|
|
setup(
|
|
name="oxenmq",
|
|
version=__version__,
|
|
author="Jason Rhinelander",
|
|
author_email="jason@oxen.io",
|
|
url="https://github.com/oxen-io/oxen-mq",
|
|
description="Python wrapper for oxen-mq message passing library",
|
|
long_description="",
|
|
ext_modules=ext_modules,
|
|
zip_safe=False,
|
|
)
|