diff options
author | Victor Stinner <vstinner@python.org> | 2022-02-06 20:50:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-06 20:50:09 (GMT) |
commit | 04dd60e50cd3da48fd19cdab4c0e4cc600d6af30 (patch) | |
tree | 81f316a4d68d61647d0bc91ba6e44759996e247a /Lib/encodings | |
parent | 3da5526136034188185d6a3fdba71e2b56577ee2 (diff) | |
download | cpython-04dd60e50cd3da48fd19cdab4c0e4cc600d6af30.zip cpython-04dd60e50cd3da48fd19cdab4c0e4cc600d6af30.tar.gz cpython-04dd60e50cd3da48fd19cdab4c0e4cc600d6af30.tar.bz2 |
bpo-46659: Update the test on the mbcs codec alias (GH-31168)
encodings registers the _alias_mbcs() codec search function before
the search_function() codec search function. Previously, the
_alias_mbcs() was never used.
Fix the test_codecs.test_mbcs_alias() test: use the current ANSI code
page, not a fake ANSI code page number.
Remove the test_site.test_aliasing_mbcs() test: the alias is now
implemented in the encodings module, no longer in the site module.
Diffstat (limited to 'Lib/encodings')
-rw-r--r-- | Lib/encodings/__init__.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py index 4b37d33..dff22a4 100644 --- a/Lib/encodings/__init__.py +++ b/Lib/encodings/__init__.py @@ -152,9 +152,6 @@ def search_function(encoding): # Return the registry entry return entry -# Register the search_function in the Python codec registry -codecs.register(search_function) - if sys.platform == 'win32': def _alias_mbcs(encoding): try: @@ -167,4 +164,8 @@ if sys.platform == 'win32': # Imports may fail while we are shutting down pass + # It must be registered before search_function() codecs.register(_alias_mbcs) + +# Register the search_function in the Python codec registry +codecs.register(search_function) |