Author: Armin Rigo <ar...@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 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit