mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Based off https://github.com/pytorch/pytorch/pull/80511 with extra changes: - Update pybind to the latest release as it contains some needed fixes - Extend the compat header to do reduce changes in code Pull Request resolved: https://github.com/pytorch/pytorch/pull/81242 Approved by: https://github.com/malfet, https://github.com/mattip
20 lines
527 B
C
20 lines
527 B
C
#pragma once
|
|
#include <cmath>
|
|
// workaround for Python 2 issue: https://bugs.python.org/issue17120
|
|
// NOTE: It looks like this affects Python 3 as well.
|
|
#pragma push_macro("_XOPEN_SOURCE")
|
|
#pragma push_macro("_POSIX_C_SOURCE")
|
|
#undef _XOPEN_SOURCE
|
|
#undef _POSIX_C_SOURCE
|
|
|
|
#include <Python.h>
|
|
#include <frameobject.h>
|
|
#include <structseq.h>
|
|
|
|
#pragma pop_macro("_XOPEN_SOURCE")
|
|
#pragma pop_macro("_POSIX_C_SOURCE")
|
|
|
|
#if PY_MAJOR_VERSION < 3
|
|
#error "Python 2 has reached end-of-life and is no longer supported by PyTorch."
|
|
#endif
|