From 39e5e2545c229f9e7aab254afdf8dde2ac858efe Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 14 Sep 2013 08:33:35 +0200 Subject: [PATCH] clean up some code --- Cython/Compiler/Code.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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: -- 2.7.4