Fix PySlice_Unpack not available on PyPy 3.6 yet (#17836)
authorKonstantin Lopuhin <kostia.lopuhin@gmail.com>
Sun, 10 Mar 2019 04:06:57 +0000 (20:06 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sun, 10 Mar 2019 04:10:16 +0000 (20:10 -0800)
Summary:
This is one of the fixes needed to support compilation on PyPy 3.6, see https://github.com/pytorch/pytorch/issues/17835
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17836

Differential Revision: D14399404

Pulled By: soumith

fbshipit-source-id: ca650a6e2066aed86ddd3314a95d0cb3c515c633

torch/csrc/utils/python_compat.h

index 2914ee8..35015fa 100644 (file)
@@ -2,7 +2,8 @@
 
 #include <torch/csrc/python_headers.h>
 
-#if PY_VERSION_HEX < 0x03060100
+// PyPy 3.6 does not yet have PySlice_Unpack
+#if PY_VERSION_HEX < 0x03060100 || defined(PYPY_VERSION)
 
 // PySlice_Unpack not introduced till python 3.6.1
 // included here for backwards compatibility