summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-01 18:54:56 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-01 18:54:56 (GMT)
commitfce7fd6426519a2897330c03da7eb889232bf681 (patch)
treeafe2ba5ce7020f102d7c5b5e568643b2e76199ad /Lib/site.py
parentb0fa831d1e073624d28aa403496f122e2f35697a (diff)
downloadcpython-fce7fd6426519a2897330c03da7eb889232bf681.zip
cpython-fce7fd6426519a2897330c03da7eb889232bf681.tar.gz
cpython-fce7fd6426519a2897330c03da7eb889232bf681.tar.bz2
Issue #9549: sys.setdefaultencoding() and PyUnicode_SetDefaultEncoding()
are now removed, since their effect was inexistent in 3.x (the default encoding is hardcoded to utf-8 and cannot be changed).
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py25
1 files changed, 0 insertions, 25 deletions
diff --git a/Lib/site.py b/Lib/site.py
index f108432..51516aa 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -460,25 +460,6 @@ def aliasmbcs():
encodings._cache[enc] = encodings._unknown
encodings.aliases.aliases[enc] = 'mbcs'
-def setencoding():
- """Set the string encoding used by the Unicode implementation. The
- default is 'ascii', but if you're willing to experiment, you can
- change this."""
- encoding = "ascii" # Default value set by _PyUnicode_Init()
- if 0:
- # Enable to support locale aware default string encodings.
- import locale
- loc = locale.getdefaultlocale()
- if loc[1]:
- encoding = loc[1]
- if 0:
- # Enable to switch off string to Unicode coercion and implicit
- # Unicode to string conversion.
- encoding = "undefined"
- if encoding != "ascii":
- # On Non-Unicode builds this will raise an AttributeError...
- sys.setdefaultencoding(encoding) # Needs Python Unicode build !
-
def execsitecustomize():
"""Run custom site specific code, if available."""
@@ -527,15 +508,9 @@ def main():
setcopyright()
sethelper()
aliasmbcs()
- setencoding()
execsitecustomize()
if ENABLE_USER_SITE:
execusercustomize()
- # Remove sys.setdefaultencoding() so that users cannot change the
- # encoding after initialization. The test for presence is needed when
- # this module is run as a script, because this code is executed twice.
- if hasattr(sys, "setdefaultencoding"):
- del sys.setdefaultencoding
main()