Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix python3.10 compile bug on windows #42140

Merged
merged 1 commit into from
Apr 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions paddle/fluid/pybind/bind_fleet_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions paddle/fluid/pybind/compatible.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions paddle/fluid/pybind/eager_functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 6 additions & 0 deletions paddle/fluid/pybind/eager_method.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 5 additions & 0 deletions paddle/fluid/pybind/eager_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions paddle/fluid/pybind/inference_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions paddle/fluid/pybind/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
5 changes: 5 additions & 0 deletions paddle/fluid/pybind/op_function_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 4 additions & 0 deletions paddle/fluid/pybind/protobuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion python/paddle/fluid/tests/unittests/cc_imp_py_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down