Commit 3788b856 authored by Brett Cannon's avatar Brett Cannon

Change error return value to be more consistent with the rest of Python

parent d1702565
...@@ -780,7 +780,7 @@ _PyCode_GetExtra(PyObject *code, Py_ssize_t index, void **extra) ...@@ -780,7 +780,7 @@ _PyCode_GetExtra(PyObject *code, Py_ssize_t index, void **extra)
if (!PyCode_Check(code)) { if (!PyCode_Check(code)) {
PyErr_BadInternalCall(); PyErr_BadInternalCall();
return 1; return -1;
} }
o = (PyCodeObject*) code; o = (PyCodeObject*) code;
...@@ -803,7 +803,7 @@ _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra) ...@@ -803,7 +803,7 @@ _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra)
if (!PyCode_Check(code) || index < 0 || if (!PyCode_Check(code) || index < 0 ||
index >= tstate->co_extra_user_count) { index >= tstate->co_extra_user_count) {
PyErr_BadInternalCall(); PyErr_BadInternalCall();
return 1; return -1;
} }
o = (PyCodeObject*) code; o = (PyCodeObject*) code;
...@@ -812,13 +812,13 @@ _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra) ...@@ -812,13 +812,13 @@ _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra)
o->co_extra = (_PyCodeObjectExtra*) PyMem_Malloc( o->co_extra = (_PyCodeObjectExtra*) PyMem_Malloc(
sizeof(_PyCodeObjectExtra)); sizeof(_PyCodeObjectExtra));
if (o->co_extra == NULL) { if (o->co_extra == NULL) {
return 1; return -1;
} }
o->co_extra->ce_extras = PyMem_Malloc( o->co_extra->ce_extras = PyMem_Malloc(
tstate->co_extra_user_count * sizeof(void*)); tstate->co_extra_user_count * sizeof(void*));
if (o->co_extra->ce_extras == NULL) { if (o->co_extra->ce_extras == NULL) {
return 1; return -1;
} }
o->co_extra->ce_size = tstate->co_extra_user_count; o->co_extra->ce_size = tstate->co_extra_user_count;
...@@ -832,7 +832,7 @@ _PyCode_SetExtra(PyObject *code, Py_ssize_t index, void *extra) ...@@ -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*)); o->co_extra->ce_extras, tstate->co_extra_user_count * sizeof(void*));
if (o->co_extra->ce_extras == NULL) { if (o->co_extra->ce_extras == NULL) {
return 1; return -1;
} }
o->co_extra->ce_size = tstate->co_extra_user_count; o->co_extra->ce_size = tstate->co_extra_user_count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment