Code Review
/
apps
/
low-level-can-service.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
review
|
tree
raw
|
patch
| inline |
side by side
(parent:
e02c653
)
generator: Fix strange unicode/str issue in python2
author
Kyle Manna
<kyle@kylemanna.com>
Mon, 21 Sep 2015 01:39:45 +0000
(18:39 -0700)
committer
Kyle Manna
<kyle@kylemanna.com>
Mon, 21 Sep 2015 01:55:04 +0000
(18:55 -0700)
* Work around this by checking the appropriate class for the given
* environment.
generator/nanopb_generator.py
patch
|
blob
|
history
diff --git
a/generator/nanopb_generator.py
b/generator/nanopb_generator.py
index
91a820f
..
df97338
100755
(executable)
--- a/
generator/nanopb_generator.py
+++ b/
generator/nanopb_generator.py
@@
-85,7
+85,14
@@
class Names:
return '_'.join(self.parts)
def __add__(self, other):
- if isinstance(other, str):
+ # The fdesc names are unicode and need to be handled for
+ # python2 and python3
+ try:
+ realstr = unicode
+ except NameError:
+ realstr = str
+
+ if isinstance(other, realstr):
return Names(self.parts + (other,))
elif isinstance(other, tuple):
return Names(self.parts + other)