From 1ae8c4273a8438f6b9f3438668e0722bfb1bce9b Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 19 Aug 2018 16:39:09 -0500 Subject: [PATCH 1/2] Enable dynamic attribute support for Pypy >= 6 --- include/pybind11/detail/class.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/detail/class.h b/include/pybind11/detail/class.h index 7a5dd0130d..961f48479a 100644 --- a/include/pybind11/detail/class.h +++ b/include/pybind11/detail/class.h @@ -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 From 61466f406947271a5fcbb4965d651b469b1c650a Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Tue, 28 Aug 2018 16:39:36 -0500 Subject: [PATCH 2/2] Add pypy 6.0 travis config --- .travis.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 928f517fcf..54c272a477 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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