[Python-3000-checkins] r57563 - in python/branches/py3k/Lib/plat-mac: Carbon/AppleEvents.py aetypes.py plistlib.py
guido.van.rossum
python-3000-checkins at python.org
Mon Aug 27 19:25:40 CEST 2007
Author: guido.van.rossum
Date: Mon Aug 27 19:25:39 2007
New Revision: 57563
Modified:
python/branches/py3k/Lib/plat-mac/Carbon/AppleEvents.py
python/branches/py3k/Lib/plat-mac/aetypes.py
python/branches/py3k/Lib/plat-mac/plistlib.py
Log:
Changes in anticipation of stricter str vs. bytes enforcement.
Modified: python/branches/py3k/Lib/plat-mac/Carbon/AppleEvents.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/Carbon/AppleEvents.py (original)
+++ python/branches/py3k/Lib/plat-mac/Carbon/AppleEvents.py Mon Aug 27 19:25:39 2007
@@ -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')
Modified: python/branches/py3k/Lib/plat-mac/aetypes.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/aetypes.py (original)
+++ python/branches/py3k/Lib/plat-mac/aetypes.py Mon Aug 27 19:25:39 2007
@@ -22,7 +22,7 @@
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"""
Modified: python/branches/py3k/Lib/plat-mac/plistlib.py
==============================================================================
--- python/branches/py3k/Lib/plat-mac/plistlib.py (original)
+++ python/branches/py3k/Lib/plat-mac/plistlib.py Mon Aug 27 19:25:39 2007
@@ -176,7 +176,7 @@
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 @@
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)
More information about the Python-3000-checkins
mailing list