[Python-checkins] cpython: Change error return value to be more consistent with the rest of Python

brett.cannon python-checkins at python.org
Wed Sep 7 15:51:22 EDT 2016


https://hg.python.org/cpython/rev/be272696991e
changeset: 103243:be272696991e
user: Brett Cannon <brett at python.org>
date: Wed Sep 07 12:51:08 2016 -0700
summary:
 Change error return value to be more consistent with the rest of Python
files:
 Objects/codeobject.c | 10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -780,7 +780,7 @@
 
 if (!PyCode_Check(code)) {
 PyErr_BadInternalCall();
- return 1;
+ return -1;
 }
 
 o = (PyCodeObject*) code;
@@ -803,7 +803,7 @@
 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 @@
 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 @@
 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;
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /