Commit 745ac5d9 authored by Stefan Behnel's avatar Stefan Behnel

Py3 fix

parent 1a38e0ce
...@@ -146,8 +146,8 @@ def analyse_buffer_options(globalpos, env, posargs, dictargs, defaults=None, nee ...@@ -146,8 +146,8 @@ def analyse_buffer_options(globalpos, env, posargs, dictargs, defaults=None, nee
for name, (value, pos) in dictargs.iteritems(): for name, (value, pos) in dictargs.iteritems():
if not name in buffer_options: if not name in buffer_options:
raise CompileError(pos, ERR_BUF_OPTION_UNKNOWN % name) 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): for name, (value, pos) in zip(buffer_options, posargs):
if not name in buffer_options: if not name in buffer_options:
raise CompileError(pos, ERR_BUF_OPTION_UNKNOWN % name) raise CompileError(pos, ERR_BUF_OPTION_UNKNOWN % name)
......
...@@ -735,6 +735,11 @@ class CBufferAccessTypeNode(CBaseTypeNode): ...@@ -735,6 +735,11 @@ class CBufferAccessTypeNode(CBaseTypeNode):
self.keyword_args, self.keyword_args,
base_type.buffer_defaults) 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) self.type = PyrexTypes.BufferType(base_type, **options)
return self.type return self.type
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment