diff options
author | Guido van Rossum <guido@python.org> | 2007-08-27 17:25:39 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-08-27 17:25:39 (GMT) |
commit | 6dab79535139a36d7e845c1c5f399d7a59d5d630 (patch) | |
tree | cda5fbdedbd262cb2f7dba187e8cfeb5a9b47e83 /Lib | |
parent | 39478e852827a4ca6955151bf004c7a15099a4b1 (diff) | |
download | cpython-6dab79535139a36d7e845c1c5f399d7a59d5d630.zip cpython-6dab79535139a36d7e845c1c5f399d7a59d5d630.tar.gz cpython-6dab79535139a36d7e845c1c5f399d7a59d5d630.tar.bz2 |
Changes in anticipation of stricter str vs. bytes enforcement.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/plat-mac/Carbon/AppleEvents.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/aetypes.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/plistlib.py | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/Lib/plat-mac/Carbon/AppleEvents.py b/Lib/plat-mac/Carbon/AppleEvents.py index 33ee3b3..ec19d19 100644 --- a/Lib/plat-mac/Carbon/AppleEvents.py +++ b/Lib/plat-mac/Carbon/AppleEvents.py @@ -1,6 +1,6 @@ # Generated from 'AEDataModel.h' -def FOUR_CHAR_CODE(x): return bytes(x) +def FOUR_CHAR_CODE(x): return x.encode("latin-1") typeBoolean = FOUR_CHAR_CODE('bool') typeChar = FOUR_CHAR_CODE('TEXT') typeSInt16 = FOUR_CHAR_CODE('shor') diff --git a/Lib/plat-mac/aetypes.py b/Lib/plat-mac/aetypes.py index b4492ed..cf6e3b9 100644 --- a/Lib/plat-mac/aetypes.py +++ b/Lib/plat-mac/aetypes.py @@ -22,7 +22,7 @@ def _four_char_code(four_chars): four_chars must contain only ASCII characters. """ - return bytes("%-4.4s" % str(four_chars)) + return ("%-4.4s" % str(four_chars)).encode("latin-1") class Unknown: """An uninterpreted AE object""" diff --git a/Lib/plat-mac/plistlib.py b/Lib/plat-mac/plistlib.py index ca7ac87..a107b26 100644 --- a/Lib/plat-mac/plistlib.py +++ b/Lib/plat-mac/plistlib.py @@ -176,7 +176,7 @@ class DumbXMLWriter: line = line.encode('utf-8') self.file.write(self.indentLevel * self.indent) self.file.write(line) - self.file.write('\n') + self.file.write(b'\n') # Contents should conform to a subset of ISO 8601 @@ -220,14 +220,14 @@ def _escapeAndEncode(text): return text.encode("utf-8") # encode as UTF-8 -PLISTHEADER = """\ +PLISTHEADER = b"""\ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> """ class PlistWriter(DumbXMLWriter): - def __init__(self, file, indentLevel=0, indent="\t", writeHeader=1): + def __init__(self, file, indentLevel=0, indent=b"\t", writeHeader=1): if writeHeader: file.write(PLISTHEADER) DumbXMLWriter.__init__(self, file, indentLevel, indent) |