Skip to content

Commit 626981e

Browse files
authored
Remove unnecessary PY_VERSION_HEX check (PaddlePaddle#76358)
1 parent 8096e31 commit 626981e

File tree

3 files changed

+0
-12
lines changed

3 files changed

+0
-12
lines changed

paddle/fluid/pybind/auto_parallel_py.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ namespace py = pybind11; // NOLINT
6161
namespace paddle::pybind {
6262

6363
static bool PyCheckInteger(PyObject *obj) {
64-
#if PY_VERSION_HEX < 0x03000000
65-
return (PyLong_Check(obj) || PyInt_Check(obj)) && !PyBool_Check(obj);
66-
#else
6764
return PyLong_Check(obj) && !PyBool_Check(obj);
68-
#endif
6965
}
7066

7167
using paddle::distributed::auto_parallel::DistTensorSpec;

paddle/fluid/pybind/eager_math_op_patch.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ using egr::InputsContainDistTensor;
5656
namespace paddle::pybind {
5757

5858
static bool PyCheckInteger(PyObject* obj) {
59-
#if PY_VERSION_HEX < 0x03000000
60-
return (PyLong_Check(obj) || PyInt_Check(obj)) && !PyBool_Check(obj);
61-
#else
6259
return PyLong_Check(obj) && !PyBool_Check(obj);
63-
#endif
6460
}
6561

6662
static bool IsNumpyType(PyObject* obj) {

paddle/fluid/pybind/slice_utils.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,7 @@ inline T GetDenseTensorValue(const phi::DenseTensor* x) {
245245
static Py_ssize_t GetSliceIndexFromPyObject(PyObject* obj);
246246
// Slice related methods
247247
static bool PyCheckInteger(PyObject* obj) {
248-
#if PY_VERSION_HEX < 0x03000000
249-
return (PyLong_Check(obj) || PyInt_Check(obj)) && !PyBool_Check(obj);
250-
#else
251248
return PyLong_Check(obj) && !PyBool_Check(obj);
252-
#endif
253249
}
254250

255251
static bool IsNumpyType(PyObject* obj) {

0 commit comments

Comments
 (0)