From: Stefan Behnel Date: Sat, 14 Sep 2013 06:33:35 +0000 (+0200) Subject: clean up some code X-Git-Tag: 0.20b1~328 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=39e5e2545c229f9e7aab254afdf8dde2ac858efe;p=platform%2Fupstream%2Fpython-cython.git clean up some code --- diff --git a/Cython/Compiler/Code.py b/Cython/Compiler/Code.py index e58a3e8..074506d 100644 --- a/Cython/Compiler/Code.py +++ b/Cython/Compiler/Code.py @@ -1093,13 +1093,9 @@ class GlobalState(object): self.py_constants.append(c) return c - def new_string_const_cname(self, bytes_value, intern=None): + def new_string_const_cname(self, bytes_value): # Create a new globally-unique nice name for a C string constant. - try: - value = bytes_value.decode('ASCII') - except UnicodeError: - return self.new_const_cname(value=bytes_value) - + value = bytes_value.decode('ASCII', 'ignore') return self.new_const_cname(value=value) def new_int_const_cname(self, value, longness): @@ -1114,7 +1110,7 @@ class GlobalState(object): value = value.decode('ASCII', 'ignore') value = replace_identifier('_', value)[:32].strip('_') c = self.const_cname_counters - c[value] = c.setdefault(value, 0) + 1 + c[value] = c.get(value, 0) + 1 if c[value] == 1: return "%s%s%s" % (Naming.const_prefix, prefix, value) else: