diff Python/_warnings.c @ 46686:2f351fa53a6b legacy-trunk

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.
author Brett Cannon <bcannon@gmail.com>
date Tue, 06 May 2008 04:37:31 +0000
parents d9071fa8244a
children 9130b48a7130
line wrap: on
line diff
--- a/Python/_warnings.c	Tue May 06 02:51:10 2008 +0000
+++ b/Python/_warnings.c	Tue May 06 04:37:31 2008 +0000
@@ -445,10 +445,8 @@
 
     /* 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;