diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/locale.py | 6 | ||||
-rw-r--r-- | Lib/test/test_locale.py | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Lib/locale.py b/Lib/locale.py index 4bd31c9..a710f27 100644 --- a/Lib/locale.py +++ b/Lib/locale.py @@ -555,6 +555,12 @@ def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): """ + import warnings + warnings.warn( + "Use setlocale(), getpreferredencoding(False) and getlocale() instead", + DeprecationWarning, stacklevel=2 + ) + try: # check if it's supported by the _locale module import _locale diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py index f844e62..2a3b0ac 100644 --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -518,7 +518,8 @@ class TestMiscellaneous(unittest.TestCase): os.environ['LC_CTYPE'] = 'UTF-8' - self.assertEqual(locale.getdefaultlocale(), (None, 'UTF-8')) + with check_warnings(('', DeprecationWarning)): + self.assertEqual(locale.getdefaultlocale(), (None, 'UTF-8')) finally: for k in orig_env: |