[pypy-commit] cffi default: Add the module name in front of the error for missing def_extern().
arigo
pypy.commits at gmail.com
Tue Mar 21 06:21:49 EDT 2017
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r2915:85994689bab3
Date: 2017-03-21 11:21 +0100
http://bitbucket.org/cffi/cffi/changeset/85994689bab3/
Log: Add the module name in front of the error for missing def_extern().
Useful in cases we mistakenly define the same name in more than one
module.
diff --git a/cffi/recompiler.py b/cffi/recompiler.py
--- a/cffi/recompiler.py
+++ b/cffi/recompiler.py
@@ -1180,7 +1180,7 @@
size_of_result = '(int)sizeof(%s)' % (
tp.result.get_c_name('', context),)
prnt('static struct _cffi_externpy_s _cffi_externpy__%s =' % name)
- prnt(' { "%s", %s };' % (name, size_of_result))
+ prnt(' { "%s.%s", %s };' % (self.module_name, name, size_of_result))
prnt()
#
arguments = []
diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py
--- a/testing/cffi1/test_recompiler.py
+++ b/testing/cffi1/test_recompiler.py
@@ -1552,7 +1552,8 @@
res = lib.bar(4, 5)
assert res == 0
assert f.getvalue() == (
- b"extern \"Python\": function bar() called, but no code was attached "
+ b"extern \"Python\": function _CFFI_test_extern_python_1.bar() called, "
+ b"but no code was attached "
b"to it yet with @ffi.def_extern(). Returning 0.\n")
@ffi.def_extern("bar")
More information about the pypy-commit
mailing list