]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
When adding a name to the table of macros and environments, make sure it
authorFred Drake <fdrake@acm.org>
Wed, 10 Apr 2002 04:20:33 +0000 (04:20 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 10 Apr 2002 04:20:33 +0000 (04:20 +0000)
is not already present.  If it is, raise an exception, since that should not
happen in a well-defined conversion.

Doc/tools/sgmlconv/latex2esis.py

index 38b6e49e8cf9d24abbe3c31a52551abfe50ff025..3ccd7e700ca744af82b544baacc19dbfa1f8be1b 100755 (executable)
@@ -487,7 +487,10 @@ class TableHandler(xml.sax.handler.ContentHandler):
         if attrs.has_key("outputname"):
             self.__current.outputname = attrs.get("outputname")
     def end_macro(self):
-        self.__table[self.__current.name] = self.__current
+        name = self.__current.name
+        if self.__table.has_key(name):
+            raise ValueError("name %s already in use" % `name`)
+        self.__table[name] = self.__current
         self.__current = None
 
     def start_attribute(self, attrs):