summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2000-09-18 11:06:00 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2000-09-18 11:06:00 (GMT)
commit09cad08d754e5d458d79d26ff61fccfeff39a059 (patch)
treea7383c0f58fd80a15b093944cb46cafc35a96759 /Lib/site.py
parent0b7b4b8a229532bb7f634aedf0db81adfeb2ae18 (diff)
downloadcpython-09cad08d754e5d458d79d26ff61fccfeff39a059.zip
cpython-09cad08d754e5d458d79d26ff61fccfeff39a059.tar.gz
cpython-09cad08d754e5d458d79d26ff61fccfeff39a059.tar.bz2
sys.setdefaultencoding() should only be called in case the standard
default encoding ("ascii") is changed. This safes quite a few cycles during startup since the first call to .setdefaultencoding() will initialize the codec registry and the encodings package. See python-dev for a discussion (Subject: "[Python-Dev] [comp.lang.python] sys.setdefaultencoding (2.0b1)").
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 1c25f50..a9f5480 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -175,7 +175,7 @@ else:
# default is 'ascii', but if you're willing to experiment, you can
# change this.
-encoding = "ascii" # default
+encoding = "ascii" # Default value set by _PyUnicode_Init()
if 0:
# Enable to support locale aware default string encodings.
@@ -189,7 +189,8 @@ if 0:
# Unicode to string conversion.
encoding = "undefined"
-sys.setdefaultencoding(encoding)
+if encoding != "ascii":
+ sys.setdefaultencoding(encoding)
#
# Run custom site specific code, if available.