diff options
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index b4c0f63a984..4aa35685b50 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -785,6 +785,39 @@ PyLong_AsUnsignedLongMask(PyObject *op) } int +PyLong_IsPositive(PyObject *obj) +{ + assert(obj != NULL); + if (!PyLong_Check(obj)) { + PyErr_Format(PyExc_TypeError, "expected int, got %T", obj); + return -1; + } + return _PyLong_IsPositive((PyLongObject *)obj); +} + +int +PyLong_IsNegative(PyObject *obj) +{ + assert(obj != NULL); + if (!PyLong_Check(obj)) { + PyErr_Format(PyExc_TypeError, "expected int, got %T", obj); + return -1; + } + return _PyLong_IsNegative((PyLongObject *)obj); +} + +int +PyLong_IsZero(PyObject *obj) +{ + assert(obj != NULL); + if (!PyLong_Check(obj)) { + PyErr_Format(PyExc_TypeError, "expected int, got %T", obj); + return -1; + } + return _PyLong_IsZero((PyLongObject *)obj); +} + +int _PyLong_Sign(PyObject *vv) { PyLongObject *v = (PyLongObject *)vv; |