From: Stefan Behnel Date: Fri, 21 Aug 2009 07:50:05 +0000 (+0200) Subject: Py3 fix X-Git-Tag: 0.12.alpha0~244 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=745ac5d9cba463f7ceb6b4109b067e47c2881a33;p=cython.git Py3 fix --- diff --git a/Cython/Compiler/Buffer.py b/Cython/Compiler/Buffer.py index bfcedc9c..b297ad15 100644 --- a/Cython/Compiler/Buffer.py +++ b/Cython/Compiler/Buffer.py @@ -146,8 +146,8 @@ def analyse_buffer_options(globalpos, env, posargs, dictargs, defaults=None, nee for name, (value, pos) in dictargs.iteritems(): if not name in buffer_options: raise CompileError(pos, ERR_BUF_OPTION_UNKNOWN % name) - options[name.encode("ASCII")] = value - + options[name] = value + for name, (value, pos) in zip(buffer_options, posargs): if not name in buffer_options: raise CompileError(pos, ERR_BUF_OPTION_UNKNOWN % name) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 1c816692..da818675 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -735,6 +735,11 @@ class CBufferAccessTypeNode(CBaseTypeNode): self.keyword_args, base_type.buffer_defaults) + if sys.version_info[0] < 3: + # Py 2.x enforces byte strings as keyword arguments ... + options = dict([ (name.encode('ASCII'), value) + for name, value in options.iteritems() ]) + self.type = PyrexTypes.BufferType(base_type, **options) return self.type