[PythonCAD] R25 bug

Wilbert Knol w.knol at niwa.co.nz
Tue Jun 7 00:51:37 CEST 2005


Sure enough, the latest patch (below), as applied against DS1-R25, 
fixes the 'list index out of range' bug. Well done.

Wilbert.
--

> Here's a patch to try. The problem was in the Image class and the
> counter used to track what actions get placed in the undo stack. In
> the case above no objects were selected, so nothing moved, but the
> count was incremented anyway, leading to an IndexError exception.
> By setting the count variable to the length of the undo array this
> problem is resolved.
>
> I suspect this bug could have been tripped in numerous other
> routines, so the fix below, if it is indeed all that is needed, is
> a nice improvement. Try it out and let me know if it works for you.
> It worked for me, so it must be right, right? :-)
>
> Art
>
> Index: PythonCAD/Generic/image.py
> ===================================================================
> --- PythonCAD/Generic/image.py	(revision 1865)
> +++ PythonCAD/Generic/image.py	(revision 1868)
> @@ -1354,7 +1354,7 @@
>          if not self.__busy:
>              raise ValueError, "Image not in busy state"
>          self.__busy = False
> -        self.__action = self.__action + 1
> +        self.__action = len(self.__undo)
>
>      def inAction(self):
>          """Test if the Image is with a startAction()/endAction()
> operation.


More information about the PythonCAD mailing list