Author: Armin Rigo <[email protected]>
Branch:
Changeset: r3172:355a99f0c4cc
Date: 2018-11-27 21:49 +0200
http://bitbucket.org/cffi/cffi/changeset/355a99f0c4cc/
Log: Silence bogus warning
diff --git a/cffi/cparser.py b/cffi/cparser.py
--- a/cffi/cparser.py
+++ b/cffi/cparser.py
@@ -156,7 +156,6 @@
macrovalue = macrovalue.replace('\\\n', '').strip()
macros[macroname] = macrovalue
csource = _r_define.sub('', csource)
- _warn_for_string_literal(csource)
#
if pycparser.__version__ < '2.14':
csource = _workaround_for_old_pycparser(csource)
@@ -173,6 +172,9 @@
# Replace `extern "Python"` with start/end markers
csource = _preprocess_extern_python(csource)
#
+ # Now there should not be any string literal left; warn if we get one
+ _warn_for_string_literal(csource)
+ #
# Replace "[...]" with "[__dotdotdotarray__]"
csource = _r_partial_array.sub('[__dotdotdotarray__]', csource)
#
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
@@ -1538,15 +1538,18 @@
assert (pt.x, pt.y) == (99*500*999, -99*500*999)
def test_extern_python_1():
+ import warnings
ffi = FFI()
- ffi.cdef("""
+ with warnings.catch_warnings(record=True) as log:
+ ffi.cdef("""
extern "Python" {
int bar(int, int);
void baz(int, int);
int bok(void);
void boz(void);
}
- """)
+ """)
+ assert len(log) == 0, "got a warning: %r" % (log,)
lib = verify(ffi, 'test_extern_python_1', """
static void baz(int, int); /* forward */
""")
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit