mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-13 09:46:10 +00:00
PyPy3 support (#2146)
* Error out eval_file * Enable dynamic attribute support for Pypy >= 6 * Add a test for dynamic attribute support * Skip test for eval_file on pypy * Workaround for __qualname__ on PyPy3 * Add a PyPy3.6 7.3.0 build * Only disable in PyPy3 * Fix travis testing * No numpy and scipy for pypy * Enable test on pypy2 * Fix logic in eval_file * Skip a few tests due to bugs in PyPy * scipy wheels are broken. make pypy2 a failrue Co-authored-by: Andreas Kloeckner <inform@tiker.net>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
||||
NAMESPACE_BEGIN(detail)
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03030000
|
||||
#if PY_VERSION_HEX >= 0x03030000 && !defined(PYPY_VERSION)
|
||||
# define PYBIND11_BUILTIN_QUALNAME
|
||||
# define PYBIND11_SET_OLDPY_QUALNAME(obj, nameobj)
|
||||
#else
|
||||
@@ -475,7 +475,7 @@ 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!");
|
||||
|
||||
@@ -66,6 +66,20 @@ void exec(const char (&s)[N], object global = globals(), object local = object()
|
||||
eval<eval_statements>(s, global, local);
|
||||
}
|
||||
|
||||
#if defined(PYPY_VERSION) && PY_VERSION_HEX >= 0x3000000
|
||||
template <eval_mode mode = eval_statements>
|
||||
object eval_file(str, object, object) {
|
||||
pybind11_fail("eval_file not supported in PyPy3. Use eval");
|
||||
}
|
||||
template <eval_mode mode = eval_statements>
|
||||
object eval_file(str, object) {
|
||||
pybind11_fail("eval_file not supported in PyPy3. Use eval");
|
||||
}
|
||||
template <eval_mode mode = eval_statements>
|
||||
object eval_file(str) {
|
||||
pybind11_fail("eval_file not supported in PyPy3. Use eval");
|
||||
}
|
||||
#else
|
||||
template <eval_mode mode = eval_statements>
|
||||
object eval_file(str fname, object global = globals(), object local = object()) {
|
||||
if (!local)
|
||||
@@ -113,5 +127,6 @@ object eval_file(str fname, object global = globals(), object local = object())
|
||||
throw error_already_set();
|
||||
return reinterpret_steal<object>(result);
|
||||
}
|
||||
#endif
|
||||
|
||||
NAMESPACE_END(PYBIND11_NAMESPACE)
|
||||
|
||||
Reference in New Issue
Block a user