Merged revisions 78035,78040,78043,78049-78050,78052-78054 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78035 | georg.brandl | 2010-02-06 23:44:17 +0100 (Sa, 06 Feb 2010) | 1 line

  Fix duplicate import.
........
  r78040 | georg.brandl | 2010-02-07 00:08:00 +0100 (So, 07 Feb 2010) | 1 line

  Fix a few UnboundLocalErrors in test_long.
........
  r78043 | georg.brandl | 2010-02-07 00:12:19 +0100 (So, 07 Feb 2010) | 1 line

  Remove duplicate test method.
........
  r78049 | georg.brandl | 2010-02-07 00:33:33 +0100 (So, 07 Feb 2010) | 1 line

  Fix import/access for some identifiers.  _TestSharedCTypes does not seem to be executed?
........
  r78050 | georg.brandl | 2010-02-07 00:34:10 +0100 (So, 07 Feb 2010) | 1 line

  Fix more unbound locals in code paths that do not seem to be used.
........
  r78052 | georg.brandl | 2010-02-07 00:54:04 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import when running these tests standalone.
........
  r78053 | georg.brandl | 2010-02-07 00:54:43 +0100 (So, 07 Feb 2010) | 1 line

  Fix some name errors in Mac modules.
........
  r78054 | georg.brandl | 2010-02-07 00:58:25 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import.
........
diff --git a/Lib/plat-mac/Carbon/MediaDescr.py b/Lib/plat-mac/Carbon/MediaDescr.py
index 254634b..5431d1e 100644
--- a/Lib/plat-mac/Carbon/MediaDescr.py
+++ b/Lib/plat-mac/Carbon/MediaDescr.py
@@ -15,7 +15,7 @@
             data = data[:self.size]
         values = struct.unpack(self.fmt, data)
         if len(values) != len(self.names):
-            raise Error, ('Format length does not match number of names', descr)
+            raise Error, ('Format length does not match number of names')
         rv = {}
         for i in range(len(values)):
             name = self.names[i]
@@ -26,7 +26,7 @@
             rv[name] = value
         return rv
 
-    def encode(dict):
+    def encode(self, dict):
         list = [self.fmt]
         for name in self.names:
             if type(name) == type(()):
diff --git a/Lib/plat-mac/bundlebuilder.py b/Lib/plat-mac/bundlebuilder.py
index 13b3e4b..42ba1ee 100755
--- a/Lib/plat-mac/bundlebuilder.py
+++ b/Lib/plat-mac/bundlebuilder.py
@@ -426,7 +426,7 @@
             pass
         elif self.mainprogram is not None:
             self.name = os.path.splitext(os.path.basename(self.mainprogram))[0]
-        elif executable is not None:
+        elif self.executable is not None:
             self.name = os.path.splitext(os.path.basename(self.executable))[0]
         if self.name[-4:] != ".app":
             self.name += ".app"
diff --git a/Lib/plat-mac/macostools.py b/Lib/plat-mac/macostools.py
index 337cc7f..395001d 100644
--- a/Lib/plat-mac/macostools.py
+++ b/Lib/plat-mac/macostools.py
@@ -10,6 +10,7 @@
 from Carbon import Res
 from Carbon import File, Files
 import os
+import errno
 import MacOS
 try:
     openrf = MacOS.openrf