未验证 提交 921b0418 编写于 作者: W wanghuancoder 提交者: GitHub

PyNumber_Long only for numpy, test=develop (#33778)

* PyNumber_Long only for numpy, test=develop
上级 6024488d
......@@ -209,11 +209,16 @@ inline bool PyObject_CheckLongOrToLong(PyObject** obj) {
PyObject_IsInstance(*obj, (PyObject*)g_varbase_pytype)) { // NOLINT
return true;
}
auto to = PyNumber_Long(*obj);
if (to) {
*obj = to;
return true;
if (std::string(((PyTypeObject*)(*obj)->ob_type)->tp_name) // NOLINT
.find("numpy") != std::string::npos) {
auto to = PyNumber_Long(*obj);
if (to) {
*obj = to;
return true;
}
}
return false;
}
......@@ -223,10 +228,13 @@ inline bool PyObject_CheckFloatOrToFloat(PyObject** obj) {
PyObject_IsInstance(*obj, (PyObject*)g_varbase_pytype)) { // NOLINT
return true;
}
auto to = PyNumber_Float(*obj);
if (to) {
*obj = to;
return true;
if (std::string(((PyTypeObject*)(*obj)->ob_type)->tp_name) // NOLINT
.find("numpy") != std::string::npos) {
auto to = PyNumber_Float(*obj);
if (to) {
*obj = to;
return true;
}
}
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册