diff options
author | Armin Rigo <arigo@tunes.org> | 2017-03-21 11:21:40 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2017-03-21 11:21:40 +0100 |
commit | ae9bbda42eeaa0f3dfb75318cccf3fdbb7233ddc (patch) | |
tree | a2b759d22b4172d42346f411032072ef99d8b667 | |
parent | 85fbc59d662054d2483985564451a2d7b598e87c (diff) | |
download | cffi-ae9bbda42eeaa0f3dfb75318cccf3fdbb7233ddc.tar.gz |
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.
-rw-r--r-- | cffi/recompiler.py | 2 | ||||
-rw-r--r-- | testing/cffi1/test_recompiler.py | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/cffi/recompiler.py b/cffi/recompiler.py index ddf5130..524d6be 100644 --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -1180,7 +1180,7 @@ class Recompiler: 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 index 7afab07..3c0a188 100644 --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1552,7 +1552,8 @@ def test_extern_python_1(): 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") |