未验证 提交 42297995 编写于 作者: zhouweiwei2014's avatar zhouweiwei2014 提交者: GitHub

fix python3.10 compile bug on windows (#42140) (#42180)

cherry-pick #42140
上级 a887ffd0
......@@ -14,6 +14,10 @@
#pragma once
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
#include <pybind11/pybind11.h>
namespace paddle {
......
......@@ -14,6 +14,10 @@
#pragma once
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
#include <pybind11/pybind11.h>
namespace paddle {
......
......@@ -9,6 +9,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
// disable numpy compile error
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
#include <Python.h>
#include <string>
......
......@@ -9,6 +9,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
// disable numpy compile error
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
#include <Python.h>
#include <string>
......
......@@ -10,6 +10,11 @@ See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
#include <Python.h>
#include "paddle/phi/common/backend.h"
#include "paddle/phi/common/data_type.h"
......
......@@ -14,6 +14,11 @@
#pragma once
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
#include <pybind11/pybind11.h>
namespace paddle {
......
......@@ -14,6 +14,11 @@ limitations under the License. */
#pragma once
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
#include <Python.h>
#include "paddle/fluid/pybind/pybind_boost_headers.h"
......
......@@ -14,6 +14,11 @@
#pragma once
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
#include <pybind11/chrono.h>
#include <pybind11/complex.h>
#include <pybind11/functional.h>
......
......@@ -13,6 +13,10 @@ See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
#include <Python.h>
#include <fstream>
......
......@@ -50,7 +50,8 @@ TEST(CC, IMPORT_PY) {
// 3. C/C++ Run Python file
std::string file_name(cwd);
file_name.append("/test_install_check.py");
FILE* fp = _Py_fopen(file_name.c_str(), "r+");
PyObject* obj = Py_BuildValue("s", file_name.c_str());
FILE* fp = _Py_fopen_obj(obj, "r+");
ASSERT_TRUE(fp != NULL);
ASSERT_FALSE(PyRun_SimpleFile(fp, file_name.c_str()));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册