summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-12-16 19:44:20 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-12-16 19:44:20 (GMT)
commitb519638d1ee6715d4c262d804408041d4caf6b5a (patch)
tree06bee5f39d6a9b1782342d48d7a28a850d913a1d /Python
parentcb479e78e0c6f57ffc130af3a81dff648262d069 (diff)
downloadcpython-b519638d1ee6715d4c262d804408041d4caf6b5a.zip
cpython-b519638d1ee6715d4c262d804408041d4caf6b5a.tar.gz
cpython-b519638d1ee6715d4c262d804408041d4caf6b5a.tar.bz2
_PyEval_SliceIndex(): explain why a NULL argument is allowed (thanks
to Guido for the revelation).
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index f99e44a..91a74e4 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3332,14 +3332,14 @@ loop_subscript(PyObject *v, PyObject *w)
Silently reduce values larger than INT_MAX to INT_MAX, and silently
boost values less than -INT_MAX to 0. Return 0 on error, 1 on success.
*/
-/* XXX If v is NULL, this goes out of its way to indicate success(!), but
- XXX doesn't store into *pi. Why isn't that an error, or at least v!=NULL
- XXX an asserted precondition?
+/* Note: If v is NULL, return success without storing into *pi. This
+ is because_PyEval_SliceIndex() is called by apply_slice(), which can be
+ called by the SLICE opcode with v and/or w equal to NULL.
*/
int
_PyEval_SliceIndex(PyObject *v, int *pi)
{
- if (v != NULL) { /* XXX why isn't this assert(v != NULL()? */
+ if (v != NULL) {
long x;
if (PyInt_Check(v)) {
x = PyInt_AsLong(v);