[pypy-commit] pypy default: Issue #2416, first part: show the correct line in these warnings

arigo pypy.commits at gmail.com
Fri Oct 14 04:23:32 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r87770:15f53e8bab40
Date: 2016-10-14 10:22 +0200
http://bitbucket.org/pypy/pypy/changeset/15f53e8bab40/

Log:	Issue #2416, first part: show the correct line in these warnings

diff --git a/pypy/module/_cffi_backend/ctypeptr.py b/pypy/module/_cffi_backend/ctypeptr.py
--- a/pypy/module/_cffi_backend/ctypeptr.py
+++ b/pypy/module/_cffi_backend/ctypeptr.py
@@ -165,7 +165,7 @@
                     "will be forbidden in the future (check that the types "
                     "are as you expect; use an explicit ffi.cast() if they "
                     "are correct)" % (other.name, self.name))
-                space.warn(space.wrap(msg), space.w_UserWarning, stacklevel=1)
+                space.warn(space.wrap(msg), space.w_UserWarning)
             else:
                 raise self._convert_error("compatible pointer", w_ob)
 
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -3689,3 +3689,5 @@
         assert len(w) == 2
         newp(new_pointer_type(BIntP), z3)    # fine
         assert len(w) == 2
+    # check that the warnings are associated with lines in this file
+    assert w[1].lineno == w[0].lineno + 4


More information about the pypy-commit mailing list