Author: Armin Rigo <[email protected]>
Branch:
Changeset: r3281:8097b9f9ab09
Date: 2019-06-19 11:59 +0200
http://bitbucket.org/cffi/cffi/changeset/8097b9f9ab09/
Log: (brendan on mailing list) Ignore preprocessor stuff when looking for
'"'
diff --git a/cffi/cparser.py b/cffi/cparser.py
--- a/cffi/cparser.py
+++ b/cffi/cparser.py
@@ -145,12 +145,16 @@
return ''.join(parts)
def _warn_for_string_literal(csource):
- if '"' in csource:
- import warnings
- warnings.warn("String literal found in cdef() or type source. "
- "String literals are ignored here, but you should "
- "remove them anyway because some character sequences "
- "confuse pre-parsing.")
+ if '"' not in csource:
+ return
+ for line in csource.splitlines():
+ if '"' in line and not line.lstrip().startswith('#'):
+ import warnings
+ warnings.warn("String literal found in cdef() or type source. "
+ "String literals are ignored here, but you should "
+ "remove them anyway because some character sequences
"
+ "confuse pre-parsing.")
+ break
def _preprocess(csource):
# Remove comments. NOTE: this only work because the cdef() section
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit