1 | #pragma once |
---|---|
2 | // workaround for https://github.com/python/cpython/pull/23326 |
3 | #include <cmath> |
4 | #include <complex> |
5 | // workaround for Python 2 issue: https://bugs.python.org/issue17120 |
6 | // NOTE: It looks like this affects Python 3 as well. |
7 | #pragma push_macro("_XOPEN_SOURCE") |
8 | #pragma push_macro("_POSIX_C_SOURCE") |
9 | #undef _XOPEN_SOURCE |
10 | #undef _POSIX_C_SOURCE |
11 | |
12 | #include <Python.h> |
13 | #include <frameobject.h> |
14 | #include <structseq.h> |
15 | |
16 | #pragma pop_macro("_XOPEN_SOURCE") |
17 | #pragma pop_macro("_POSIX_C_SOURCE") |
18 | |
19 | #ifdef copysign |
20 | #undef copysign |
21 | #endif |
22 | |
23 | #if PY_MAJOR_VERSION < 3 |
24 | #error "Python 2 has reached end-of-life and is no longer supported by PyTorch." |
25 | #endif |
26 |