Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-36778: fix test_startup_imports if default codepage is cp65001 #13072

Closed
wants to merge 4 commits into from

Conversation

paulmon
Copy link
Contributor

@paulmon paulmon commented May 3, 2019

Windows desktop skus have a default ANSI codepage (returned by GetACP()) of 1252 (Western European). Windows IoT Core and Windows Nano Server have a default codepage of 65001 (UTF-8).

This causes test_site.StartupImportTests.test_startup_imports to fail on Windows IoT Core and Windows Nano Server because cp65001.py is loaded instead of the frozen cp1252.py at startup.

I tried changing the default codepage to 65001 on my dev machine and rebuilding Python and it had no effect that I could tell on the generated frozen importlibs.

The simplest solutions would be for the test_startup_imports test to be skipped or changed to pass when the locale.getpreferredencoding() returns 'cp65001'

@vstinner @methane @zooba

https://bugs.python.org/issue36778

@paulmon
Copy link
Contributor Author

paulmon commented May 3, 2019

pasted the output of the test failure in the bug

@methane
Copy link
Member

methane commented May 4, 2019

Windows desktop skus have a default ANSI codepage (returned by GetACP()) of 1252 (Western European).

It's depends on languages. In Japanese, cp932 is used. Your patch seems unclear about it.

because cp65001.py is loaded instead of the frozen cp1252.py at startup.

What "frozen" mean here? This error is caused by cp65001.py imports functools.
test_startup_imports tests some heavy modules including functools
is not imported while startup.

@paulmon paulmon changed the title bpo-36778: fix test_startup_imports if default codepage is UTF-8 bpo-36778: fix test_startup_imports if default codepage is cp65001 May 6, 2019
@paulmon
Copy link
Contributor Author

paulmon commented May 6, 2019

Thanks for the feedback. Do the new comments make more sense?

Ideally it would be better if the test passed without changes when using cp65001, but if not I would like to make an exception or skip the test so I can get the buildbot errors to zero.

}.difference(sys.builtin_module_names)
if sys.platform != 'darwin':
# http://bugs.python.org/issue19209
self.assertNotIn('copyreg', modules, stderr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't revert my change!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry. That wasn't intentional.

'weakref'
}.difference(sys.builtin_module_names)
else:
# http://bugs.python.org/issue19218>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is typo at the end of the URL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Victor fixed this in #13230
The test change is not needed

@paulmon paulmon closed this May 10, 2019
@paulmon paulmon deleted the startup_imports branch June 12, 2019 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants