From: Robert Bradshaw Date: Wed, 13 Aug 2008 05:55:03 +0000 (-0700) Subject: Merge fixes, fix constant unicode, string literal indexing. X-Git-Tag: 0.9.8.1~49^2~5^2~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=205ea59dbbbe66c4b12132977eb39349cc82a36d;p=cython.git Merge fixes, fix constant unicode, string literal indexing. All test pass but bufaccess, tnumpy, and r_mang1. --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 7f9570e4..55582798 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -759,6 +759,9 @@ class UnicodeNode(PyConstNode): # We still need to perform normal coerce_to processing on the # result, because we might be coercing to an extension type, # in which case a type test node will be needed. + + def compile_time_value(self, env): + return self.value class IdentifierStringNode(ConstNode): @@ -1370,6 +1373,9 @@ class IndexNode(ExprNode): self.is_buffer_access = False self.base.analyse_types(env) + # Handle the case where base is a literal char* (and we expect a string, not an int) + if isinstance(self.base, StringNode): + self.base = self.base.coerce_to_pyobject(env) skip_child_analysis = False buffer_access = False diff --git a/Cython/Compiler/Lexicon.py b/Cython/Compiler/Lexicon.py index 60c5bd88..0c94dc7d 100644 --- a/Cython/Compiler/Lexicon.py +++ b/Cython/Compiler/Lexicon.py @@ -63,7 +63,7 @@ def make_lexicon(): three_oct = octdigit + octdigit + octdigit two_hex = hexdigit + hexdigit four_hex = two_hex + two_hex - escapeseq = Str("\\") + (two_oct | three_oct | two_hex | + escapeseq = Str("\\") + (two_oct | three_oct | Str('u') + four_hex | Str('x') + two_hex | Str('U') + four_hex + four_hex | AnyChar) diff --git a/Cython/Compiler/Main.py b/Cython/Compiler/Main.py index 7d68ded1..2d8c3dd6 100644 --- a/Cython/Compiler/Main.py +++ b/Cython/Compiler/Main.py @@ -632,7 +632,6 @@ def compile_multiple(sources, options): if source not in processed: # Compiling multiple sources in one context doesn't quite # work properly yet. - context = Context(options.include_path) # to be removed later if not timestamps or context.c_file_out_of_date(source): if verbose: sys.stderr.write("Compiling %s\n" % source) diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index 98caa901..9c002c50 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -603,7 +603,7 @@ def p_string_literal(s): else: c = systr[1] if c in "01234567": - chars.append(chr(int(systr[1:]))) + chars.append(chr(int(systr[1:], 8))) elif c in "'\"\\": chars.append(c) elif c in "abfnrtv":