[Python-checkins] r46966 - python/trunk/Lib/encodings/mbcs.py
martin.v.loewis
python-checkins at python.org
Thu Jun 15 08:45:08 CEST 2006
Author: martin.v.loewis
Date: Thu Jun 15 08:45:05 2006
New Revision: 46966
Modified:
python/trunk/Lib/encodings/mbcs.py
Log:
Make import/lookup of mbcs fail on non-Windows systems.
Modified: python/trunk/Lib/encodings/mbcs.py
==============================================================================
--- python/trunk/Lib/encodings/mbcs.py (original)
+++ python/trunk/Lib/encodings/mbcs.py Thu Jun 15 08:45:05 2006
@@ -7,6 +7,10 @@
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
+# Import them explicitly to cause an ImportError
+# on non-Windows systems
+from codecs import mbcs_encode, mbcs_decode
+# for IncrementalDecoder, IncrementalEncoder, ...
import codecs
### Codec APIs
@@ -15,16 +19,16 @@
# Note: Binding these as C functions will result in the class not
# converting them to methods. This is intended.
- encode = codecs.mbcs_encode
- decode = codecs.mbcs_decode
+ encode = mbcs_encode
+ decode = mbcs_decode
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
- return codecs.mbcs_encode(input,self.errors)[0]
+ return mbcs_encode(input,self.errors)[0]
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
def _buffer_decode(self, input, errors, final):
- return codecs.mbcs_decode(input,self.errors,final)
+ return mbcs_decode(input,self.errors,final)
class StreamWriter(Codec,codecs.StreamWriter):
pass
More information about the Python-checkins
mailing list