| 504 | */ |
| 505 | #if defined(NPY_PY3K) |
| 506 | static inline int |
| 507 | PyObject_Cmp(PyObject *i1, PyObject *i2, int *cmp) |
| 508 | { |
| 509 | int v; |
| 510 | v = PyObject_RichCompareBool(i1, i2, Py_LT); |
| 511 | if (v == 1) { |
| 512 | *cmp = -1; |
| 513 | return 1; |
| 514 | } |
| 515 | else if (v == -1) { |
| 516 | return -1; |
| 517 | } |
| 518 | |
| 519 | v = PyObject_RichCompareBool(i1, i2, Py_GT); |
| 520 | if (v == 1) { |
| 521 | *cmp = 1; |
| 522 | return 1; |
| 523 | } |
| 524 | else if (v == -1) { |
| 525 | return -1; |
| 526 | } |
| 527 | |
| 528 | v = PyObject_RichCompareBool(i1, i2, Py_EQ); |
| 529 | if (v == 1) { |
| 530 | *cmp = 0; |
| 531 | return 1; |
| 532 | } |
| 533 | else { |
| 534 | *cmp = 0; |
| 535 | return -1; |
| 536 | } |
| 537 | } |
| 538 | #endif |
| 539 | |
| 540 | /* |
nothing calls this directly
no outgoing calls
no test coverage detected