mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 20:10:08 +01:00
Use textfile_open when loading core.pi to avoid encoding errors in Python3
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -812,8 +812,8 @@ def myExecfile(filename, ns):
|
|||||||
|
|
||||||
def textfile_open(filename, mode='rt'):
|
def textfile_open(filename, mode='rt'):
|
||||||
"""
|
"""
|
||||||
Simple wrapper around open() that will use codecs.open on Python 2.x and
|
Simple wrapper around open() that will use codecs.open on Python2 and
|
||||||
on Python 2.3 will add the encoding parameter to the normal open(). The
|
on Python3 will add the encoding parameter to the normal open(). The
|
||||||
mode parameter must include the 't' to put the stream into text mode.
|
mode parameter must include the 't' to put the stream into text mode.
|
||||||
"""
|
"""
|
||||||
assert 't' in mode
|
assert 't' in mode
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ class Utf8EncodingStream(io.StringIO):
|
|||||||
|
|
||||||
def textfile_open(filename, mode='rt'):
|
def textfile_open(filename, mode='rt'):
|
||||||
"""
|
"""
|
||||||
Simple wrapper around open() that will use codecs.open on Python 2.x and
|
Simple wrapper around open() that will use codecs.open on Python2 and
|
||||||
on Python 2.3 will add the encoding parameter to the normal open(). The
|
on Python3 will add the encoding parameter to the normal open(). The
|
||||||
mode parameter must include the 't' to put the stream into text mode.
|
mode parameter must include the 't' to put the stream into text mode.
|
||||||
"""
|
"""
|
||||||
assert 't' in mode
|
assert 't' in mode
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class FixWxPrefix(object):
|
|||||||
names.append(item.name)
|
names.append(item.name)
|
||||||
|
|
||||||
names = list()
|
names = list()
|
||||||
text = open('wx/core.pi').read()
|
text = textfile_open('wx/core.pi').read()
|
||||||
parseTree = ast.parse(text, 'wx/core.pi')
|
parseTree = ast.parse(text, 'wx/core.pi')
|
||||||
for item in parseTree.body:
|
for item in parseTree.body:
|
||||||
_processItem(item, names)
|
_processItem(item, names)
|
||||||
|
|||||||
Reference in New Issue
Block a user