diff options
author | Brett Cannon <brett@python.org> | 2016-09-07 19:51:08 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2016-09-07 19:51:08 (GMT) |
commit | 3788b85628eb9e8e802374303e14c04b6a817d97 (patch) | |
tree | 1823a2b45173a9333ce75ac1c550f481d9f931ef /Objects/codeobject.c | |
parent | d1702565855318d4c1984e997d973fc8d2f8a154 (diff) | |
download | cpython-3788b85628eb9e8e802374303e14c04b6a817d97.zip cpython-3788b85628eb9e8e802374303e14c04b6a817d97.tar.gz cpython-3788b85628eb9e8e802374303e14c04b6a817d97.tar.bz2 |
Change error return value to be more consistent with the rest of Python
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r-- | Objects/codeobject.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index c8abda2..5da2e93 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -780,7 +780,7 @@ _PyCode_GetExtra(PyObject *code, Py_ssize_t index, void **extra) if (!PyCode_Check(code)) { PyErr_BadInternalCall(); - return 1; + return -1; } o = (PyCodeObject*) code; @@ -803,7 +803,7 @@ _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra) if (!PyCode_Check(code) || index < 0 || index >= tstate->co_extra_user_count) { PyErr_BadInternalCall(); - return 1; + return -1; } o = (PyCodeObject*) code; @@ -812,13 +812,13 @@ _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra) o->co_extra = (_PyCodeObjectExtra*) PyMem_Malloc( sizeof(_PyCodeObjectExtra)); if (o->co_extra == NULL) { - return 1; + return -1; } o->co_extra->ce_extras = PyMem_Malloc( tstate->co_extra_user_count * sizeof(void*)); if (o->co_extra->ce_extras == NULL) { - return 1; + return -1; } o->co_extra->ce_size = tstate->co_extra_user_count; @@ -832,7 +832,7 @@ _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra) o->co_extra->ce_extras, tstate->co_extra_user_count * sizeof(void*)); if (o->co_extra->ce_extras == NULL) { - return 1; + return -1; } o->co_extra->ce_size = tstate->co_extra_user_count; |