diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-05-06 04:37:31 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-05-06 04:37:31 (GMT) |
commit | e3dcb01bfc6bd14da865b0f28c3c9ad8181ab212 (patch) | |
tree | a86b4bafd50bc3a309efa1b01451d64ec61c1be0 /Python | |
parent | 0b7f77847a878a84c2b928e72372b4d5b44b870c (diff) | |
download | cpython-e3dcb01bfc6bd14da865b0f28c3c9ad8181ab212.zip cpython-e3dcb01bfc6bd14da865b0f28c3c9ad8181ab212.tar.gz cpython-e3dcb01bfc6bd14da865b0f28c3c9ad8181ab212.tar.bz2 |
Fix a bug in the handling of the stacklevel argument in warnings.warn() where
the stack was being unwound by two levels instead of one each time.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/_warnings.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index 3e7dda7..0e48675 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -445,10 +445,8 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno, /* Setup globals and lineno. */ PyFrameObject *f = PyThreadState_GET()->frame; - while (--stack_level > 0 && f != NULL) { + while (--stack_level > 0 && f != NULL) f = f->f_back; - --stack_level; - } if (f == NULL) { globals = PyThreadState_Get()->interp->sysdict; |