Commit 90fe3168 authored by Stefan Behnel's avatar Stefan Behnel

fix TreeFragment: parsing works on Unicode streams

parent 75289aca
...@@ -3,10 +3,7 @@ ...@@ -3,10 +3,7 @@
# #
import re import re
try: from StringIO import StringIO
from cStringIO import BytesIO # Py3 mangled by 2to3 ...
except ImportError:
from cStringIO import StringIO as BytesIO # Py3 mangled by 2to3 ...
from Scanning import PyrexScanner, StringSourceDescriptor from Scanning import PyrexScanner, StringSourceDescriptor
from Symtab import BuiltinScope, ModuleScope from Symtab import BuiltinScope, ModuleScope
import Symtab import Symtab
...@@ -57,7 +54,7 @@ def parse_from_strings(name, code, pxds={}, level=None, initial_pos=None): ...@@ -57,7 +54,7 @@ def parse_from_strings(name, code, pxds={}, level=None, initial_pos=None):
context = StringParseContext([], name) context = StringParseContext([], name)
scope = context.find_module(module_name, pos = initial_pos, need_pxd = 0) scope = context.find_module(module_name, pos = initial_pos, need_pxd = 0)
buf = BytesIO(code.encode(encoding)) buf = StringIO(code)
scanner = PyrexScanner(buf, code_source, source_encoding = encoding, scanner = PyrexScanner(buf, code_source, source_encoding = encoding,
scope = scope, context = context, initial_pos = initial_pos) scope = scope, context = context, initial_pos = initial_pos)
......
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