Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
fe8f4c9e
Commit
fe8f4c9e
authored
Sep 07, 2016
by
Steve Dower
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #27959: Prevent ImportError from escaping codec search function
parent
2f8bfef1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
Lib/encodings/__init__.py
Lib/encodings/__init__.py
+8
-4
Lib/test/test_io.py
Lib/test/test_io.py
+1
-2
No files found.
Lib/encodings/__init__.py
View file @
fe8f4c9e
...
...
@@ -155,9 +155,13 @@ codecs.register(search_function)
if
sys
.
platform
==
'win32'
:
def
_alias_mbcs
(
encoding
):
import
_bootlocale
if
encoding
==
_bootlocale
.
getpreferredencoding
(
False
):
import
encodings.mbcs
return
encodings
.
mbcs
.
getregentry
()
try
:
import
_bootlocale
if
encoding
==
_bootlocale
.
getpreferredencoding
(
False
):
import
encodings.mbcs
return
encodings
.
mbcs
.
getregentry
()
except
ImportError
:
# Imports may fail while we are shutting down
pass
codecs
.
register
(
_alias_mbcs
)
Lib/test/test_io.py
View file @
fe8f4c9e
...
...
@@ -3230,8 +3230,7 @@ def _to_memoryview(buf):
class
CTextIOWrapperTest
(
TextIOWrapperTest
):
io
=
io
shutdown_error
=
(
"ImportError: sys.meta_path is None"
if
os
.
name
==
"nt"
else
"RuntimeError: could not find io module state"
)
shutdown_error
=
"RuntimeError: could not find io module state"
def
test_initialization
(
self
):
r
=
self
.
BytesIO
(
b"
\
xc3
\
xa9
\
n
\
n
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment