Python 1.5.1 compatibility fixes
authorrgbecker
Tue, 20 Jun 2000 11:35:08 +0000
changeset 287 bbd0eb35aee8
parent 286 27e2b436e588
child 288 95ed4bda4a26
Python 1.5.1 compatibility fixes
docs/tools/codegrab.py
docs/tools/yaml.py
--- a/docs/tools/codegrab.py	Tue Jun 20 09:15:50 2000 +0000
+++ b/docs/tools/codegrab.py	Tue Jun 20 11:35:08 2000 +0000
@@ -35,7 +35,7 @@
         #now the full path should be known, if it is in the
         #package
         
-        directory = apply(os.path.join, [packagepath] + words[1:-1])
+        directory = apply(os.path.join, tuple([packagepath] + words[1:-1]))
         modulename = words[-1]
         searchpath = [directory]
 
--- a/docs/tools/yaml.py	Tue Jun 20 09:15:50 2000 +0000
+++ b/docs/tools/yaml.py	Tue Jun 20 11:35:08 2000 +0000
@@ -85,10 +85,14 @@
             #is it a parser method?
             if hasattr(self.__class__, cmd):
                 method = eval('self.'+cmd)
+                apply(method, tuple(args))
+                #this was very bad; any type error in the method was hidden
+                #we have to hack the traceback
                 try:
-                    apply(method, args)
-                except TypeError:
-                    raise TypeError, "Incorrect arguments to parser method %s at line %d" % (cmd, self._lineNo)
+                    apply(method, tuple(args))
+                except TypeError, err:
+                    sys.stderr.write("Parser method: apply(%s,%s) %s at line %d\n" % (cmd, tuple(args), err, self._lineNo))
+                    raise
             else:
                 # assume it is a paragraph style -
                 # becomes the formatter's problem