From 1d8246b08290780e2400f9b3b4682a76fb0edf9a Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Sat, 2 Apr 2022 19:41:53 +0800 Subject: [PATCH] [Eager] Fix Pylayer compile error (#41240) * fix bug, test=develop * refine, test=develop --- paddle/fluid/pybind/eager_py_layer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/pybind/eager_py_layer.cc b/paddle/fluid/pybind/eager_py_layer.cc index 59f21a1e1fa..e9ddfd80bb8 100644 --- a/paddle/fluid/pybind/eager_py_layer.cc +++ b/paddle/fluid/pybind/eager_py_layer.cc @@ -34,6 +34,8 @@ limitations under the License. */ #include "paddle/phi/core/compat/convert_utils.h" #include "paddle/phi/core/dense_tensor.h" #include "pybind11/detail/internals.h" +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" namespace paddle { namespace pybind { @@ -479,7 +481,7 @@ void BindEagerPyLayer(PyObject* module) { type->tp_dealloc = (destructor)PyLayerDealloc; type->tp_methods = pylayer_methods; type->tp_getset = pylayer_properties; - type->tp_new = PyLayerNew; + type->tp_new = (newfunc)PyLayerNew; Py_INCREF(&PyBaseObject_Type); type->tp_base = reinterpret_cast(&PyBaseObject_Type); type->tp_flags |= -- GitLab