[pypy-commit] cffi default: remove extra comments.
guil...@Guillaumes-MacBook-Pro.local
pypy.commits at gmail.com
Wed Mar 27 06:45:24 EDT 2019
Author: guillaumesottas at Guillaumes-MacBook-Pro.local
Branch:
Changeset: r3251:fa1ef05714de
Date: 2019-03-26 17:23 -0600
http://bitbucket.org/cffi/cffi/changeset/fa1ef05714de/
Log: remove extra comments.
diff --git a/cffi/cparser.py b/cffi/cparser.py
--- a/cffi/cparser.py
+++ b/cffi/cparser.py
@@ -818,15 +818,13 @@
if isinstance(exprnode, pycparser.c_ast.Constant):
s = exprnode.value
if '0' <= s[0] <= '9':
- s = s.rstrip('uUlL') # remove integer constant suffix if any. this will remove pattern such as lL, but
- # it is the responsibility of the C parser to perform this check.
- try: # first we try to convert to base 8/10, as it will fail if the string contains base 2/16 C prefix.
+ s = s.rstrip('uUlL')
+ try:
if s.startswith('0'):
return int(s, 8)
else:
return int(s, 10)
- except ValueError: # then it should be a base 2 or a base 16. it is necessary to explicitly check the
- # prefix, as python's int() function will be able to convert both (0b01 and 0x0b01) into base 16.
+ except ValueError:
if len(s) > 1:
if s.lower()[0:2] == '0x':
return int(s, 16)
More information about the pypy-commit
mailing list