summaryrefslogtreecommitdiff
path: root/cffi
diff options
context:
space:
mode:
authorguillaumesottas <guillaumesottas@Guillaumes-MacBook-Pro.local>2019-03-25 10:24:53 -0600
committerguillaumesottas <guillaumesottas@Guillaumes-MacBook-Pro.local>2019-03-25 10:24:53 -0600
commit21e166d3a7641bda5821f23c3d6cc349585d1697 (patch)
tree770aaee75b05efe84b733a88843dfecd423ece63 /cffi
parent79ec6591d4bfd8e440729a705496ff645a055576 (diff)
downloadcffi-21e166d3a7641bda5821f23c3d6cc349585d1697.tar.gz
fix #407 add support for u/U suffix in integer constants (eg. 0xABu, or 0xCDU).
Diffstat (limited to 'cffi')
-rw-r--r--cffi/cparser.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/cffi/cparser.py b/cffi/cparser.py
index df6303d..474f756 100644
--- a/cffi/cparser.py
+++ b/cffi/cparser.py
@@ -819,6 +819,8 @@ class Parser(object):
s = exprnode.value
if s.startswith('0'):
if s.startswith('0x') or s.startswith('0X'):
+ if s.endswith('u') or s.endswith('U'):
+ s = s[:-1]
return int(s, 16)
return int(s, 8)
elif '1' <= s[0] <= '9':