[Python-checkins] commit of r41754 - python/trunk/Python/compile.c
neal.norwitz
python-checkins at python.org
Sun Dec 18 06:32:48 CET 2005
Author: neal.norwitz
Date: Sun Dec 18 06:32:41 2005
New Revision: 41754
Modified:
python/trunk/Python/compile.c
Log:
Handle more error conditions with SystemError
Modified: python/trunk/Python/compile.c
==============================================================================
--- python/trunk/Python/compile.c (original)
+++ python/trunk/Python/compile.c Sun Dec 18 06:32:41 2005
@@ -2760,8 +2760,7 @@
return INPLACE_FLOOR_DIVIDE;
}
PyErr_Format(PyExc_SystemError,
- "inplace binary op %d should not be possible",
- op);
+ "inplace binary op %d should not be possible", op);
return 0;
}
@@ -2809,6 +2808,9 @@
case GLOBAL_EXPLICIT:
optype = OP_GLOBAL;
break;
+ default:
+ /* scope can be 0 */
+ break;
}
/* XXX Leave assert here, but handle __doc__ and the like better */
@@ -2830,6 +2832,7 @@
Py_DECREF(mangled);
return 0;
case Param:
+ default:
PyErr_SetString(PyExc_SystemError,
"param invalid for deref variable");
return 0;
@@ -2844,6 +2847,7 @@
case AugStore:
break;
case Param:
+ default:
PyErr_SetString(PyExc_SystemError,
"param invalid for local variable");
return 0;
@@ -2860,6 +2864,7 @@
case AugStore:
break;
case Param:
+ default:
PyErr_SetString(PyExc_SystemError,
"param invalid for global variable");
return 0;
@@ -2874,6 +2879,7 @@
case AugStore:
break;
case Param:
+ default:
PyErr_SetString(PyExc_SystemError,
"param invalid for name variable");
return 0;
@@ -3361,6 +3367,7 @@
ADDOP_NAME(c, DELETE_ATTR, e->v.Attribute.attr, names);
break;
case Param:
+ default:
PyErr_SetString(PyExc_SystemError,
"param invalid in attribute expression");
return 0;
@@ -3388,6 +3395,7 @@
VISIT_SLICE(c, e->v.Subscript.slice, Del);
break;
case Param:
+ default:
PyErr_SetString(PyExc_SystemError,
"param invalid in subscript expression");
return 0;
@@ -3441,8 +3449,9 @@
ADDOP(c, inplace_binop(c, s->v.AugAssign.op));
return compiler_nameop(c, e->v.Name.id, Store);
default:
- fprintf(stderr,
- "invalid node type for augmented assignment\n");
+ PyErr_Format(PyExc_SystemError,
+ "invalid node type (%d) for augmented assignment",
+ e->kind);
return 0;
}
return 1;
@@ -3514,9 +3523,9 @@
case Store: op = STORE_SUBSCR; break;
case Del: op = DELETE_SUBSCR; break;
case Param:
- fprintf(stderr,
- "invalid %s kind %d in subscript\n",
- kind, ctx);
+ PyErr_Format(PyExc_SystemError,
+ "invalid %s kind %d in subscript\n",
+ kind, ctx);
return 0;
}
if (ctx == AugLoad) {
@@ -3599,6 +3608,7 @@
case Store: op = STORE_SLICE; break;
case Del: op = DELETE_SLICE; break;
case Param:
+ default:
PyErr_SetString(PyExc_SystemError,
"param invalid in simple slice");
return 0;
@@ -3618,11 +3628,11 @@
break;
case Slice_kind:
return compiler_slice(c, s, ctx);
- break;
case Index_kind:
VISIT(c, expr, s->v.Index.value);
break;
case ExtSlice_kind:
+ default:
PyErr_SetString(PyExc_SystemError,
"extended slice invalid in nested slice");
return 0;
@@ -3664,6 +3674,10 @@
if (ctx != AugStore)
VISIT(c, expr, s->v.Index.value);
return compiler_handle_subscr(c, "index", ctx);
+ default:
+ PyErr_Format(PyExc_SystemError,
+ "invalid slice %d", s->kind);
+ return 0;
}
return 1;
}
More information about the Python-checkins
mailing list