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-32139: test_strftime does not anymore modify the locale #4569
Conversation
Lib/test/test_strftime.py
Outdated
try: | ||
import java | ||
java.util.Locale.setDefault(java.util.Locale.US) | ||
except ImportError: | ||
import locale | ||
locale.setlocale(locale.LC_TIME, 'C') | ||
self.saved_locale = setlocale(LC_TIME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to add here:
self.addCleanup(setlocale, LC_TIME, self.saved_locale)
With that, you avoid tearDown() (which is not called if the test is interrupted by CTRL+c if I recall correctly), and you may even use a local variable instead of an attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, much better. Thanks for your reviews Victor.
Thanks @xdegaye for the PR |
Thanks @xdegaye for the PR |
GH-4635 is a backport of this pull request to the 3.6 branch. |
GH-4636 is a backport of this pull request to the 2.7 branch. |
https://bugs.python.org/issue32139