Skip to content

Enable dynamic attribute support for Pypy >= 6 #1494

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

Closed
wants to merge 2 commits into from
Closed
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
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,18 @@ matrix:
- os: osx
osx_image: xcode9
env: PYTHON=3.7 CPP=14 CLANG DEBUG=1
# Test a PyPy 2.7 build
# Test a PyPy 2.7 v5.8 build
- os: linux
env: PYPY=5.8 PYTHON=2.7 CPP=11 GCC=4.8
addons:
apt:
packages: [libblas-dev, liblapack-dev, gfortran]
# Test a PyPy 2.7 v6.0 build
- os: linux
env: PYPY=6.0 PYTHON=2.7 CPP=11 GCC=4.8
addons:
apt:
packages: [libblas-dev, liblapack-dev, gfortran]
# Build in 32-bit mode and tests against the CMake-installed version
- sudo: true
services: docker
Expand Down Expand Up @@ -134,6 +140,10 @@ before_install:
curl -fSL https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.8.0-linux64.tar.bz2 | tar xj
PY_CMD=$(echo `pwd`/pypy2-v5.8.0-linux64/bin/pypy)
CMAKE_EXTRA_ARGS+=" -DPYTHON_EXECUTABLE:FILEPATH=$PY_CMD"
elif [ "$PYPY" = "6.0" ]; then
curl -fSL https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-linux64.tar.bz2 | tar xj
PY_CMD=$(echo `pwd`/pypy2-v6.0.0-linux64/bin/pypy)
CMAKE_EXTRA_ARGS+=" -DPYTHON_EXECUTABLE:FILEPATH=$PY_CMD"
else
PY_CMD=python$PYTHON
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
Expand Down
4 changes: 2 additions & 2 deletions include/pybind11/detail/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,10 @@ extern "C" inline int pybind11_clear(PyObject *self) {
/// Give instances of this type a `__dict__` and opt into garbage collection.
inline void enable_dynamic_attributes(PyHeapTypeObject *heap_type) {
auto type = &heap_type->ht_type;
#if defined(PYPY_VERSION)
#if defined(PYPY_VERSION) && (PYPY_VERSION_NUM < 0x06000000)
pybind11_fail(std::string(type->tp_name) + ": dynamic attributes are "
"currently not supported in "
"conjunction with PyPy!");
"conjunction with PyPy before 6.0!");
#endif
type->tp_flags |= Py_TPFLAGS_HAVE_GC;
type->tp_dictoffset = type->tp_basicsize; // place dict at the end
Expand Down