Staging
v0.5.1
https://github.com/python/cpython
Revision 9fd41e363b4780ae9af475f9c23c0a3cf69d70ad authored by Guido van Rossum on 29 December 1997, 19:59:33 UTC, committed by Guido van Rossum on 29 December 1997, 19:59:33 UTC
 *  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):

	def invoke(self):
	    return self.tk.call(self._w, 'invoke')

 *  The select_from method of the Canvas widget should use 'from', not
    'set':

	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)

    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'

 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.

 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:

	f.grid_columnconfigure(0, 'minsize')

    Instead it returns the same as:

	f.grid_columnconfigure(0)

    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]

 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:

	grid_slaves('-row', 1)
1 parent 23e21e7
Raw File
Tip revision: 9fd41e363b4780ae9af475f9c23c0a3cf69d70ad authored by Guido van Rossum on 29 December 1997, 19:59:33 UTC
Fixed several bugs reported by Greg McFarmane:
Tip revision: 9fd41e3
exceptions.py
"""Class based built-in exception hierarchy.

This is a new feature whereby all the standard built-in exceptions,
traditionally string objects, are replaced with classes.  This gives
Python's exception handling mechanism a more object-oriented feel.

Most existing code should continue to work with class based
exceptions.  Some tricky uses of IOError may break, but the most
common uses should work.

To disable this feature, start the Python executable with the -X option.

Here is a rundown of the class hierarchy.  You can change this by
editing this file, but it isn't recommended.  The classes with a `*'
are new with this feature.  They are defined as tuples containing the
derived exceptions when string-based exceptions are used.

Exception(*)
 |
 +-- StandardError(*)
      |
      +-- SystemExit
      +-- KeyboardInterrupt
      +-- ImportError
      +-- IOError
      +-- EOFError
      +-- RuntimeError
      +-- NameError
      +-- AttributeError
      +-- SyntaxError
      +-- TypeError
      +-- AssertionError
      +-- LookupError(*)
      |    |
      |    +-- IndexError
      |    +-- KeyError
      |
      +-- ArithmeticError(*)
      |    |
      |    +-- OverflowError
      |    +-- ZeroDivisionError
      |    +-- FloatingPointError
      |
      +-- ValueError
      +-- SystemError
      +-- MemoryError
"""

class Exception:
    def __init__(self, *args):
	self.args = args

    def __str__(self):
        if not self.args:
            return ''
	elif len(self.args) == 1:
	    return str(self.args[0])
	else:
	    return str(self.args)

    def __getitem__(self, i):
	return self.args[i]

class StandardError(Exception):
    pass

class SyntaxError(StandardError):
    filename = lineno = offset = text = None
    msg = ""
    def __init__(self, *args):
	self.args = args
	if len(self.args) >= 1:
	    self.msg = self.args[0]
	if len(self.args) == 2:
	    info = self.args[1]
	    try:
		self.filename, self.lineno, self.offset, self.text = info
	    except:
		pass
    def __str__(self):
        return str(self.msg)

class IOError(StandardError):
    def __init__(self, *args):
	self.args = args
        self.errno = None
        self.strerror = None
        if len(args) == 2:
            # common case: PyErr_SetFromErrno()
            self.errno = args[0]
            self.strerror = args[1]

class RuntimeError(StandardError):
    pass

class SystemError(StandardError):
    pass

class EOFError(StandardError):
    pass

class ImportError(StandardError):
    pass

class TypeError(StandardError):
    pass

class ValueError(StandardError):
    pass

class KeyboardInterrupt(StandardError):
    pass

class AssertionError(StandardError):
    pass

class ArithmeticError(StandardError):
    pass

class OverflowError(ArithmeticError):
    pass

class FloatingPointError(ArithmeticError):
    pass

class ZeroDivisionError(ArithmeticError):
    pass

class LookupError(StandardError):
    pass

class IndexError(LookupError):
    pass

class KeyError(LookupError):
    pass

class AttributeError(StandardError):
    pass

class NameError(StandardError):
    pass

class MemoryError(StandardError):
    pass

class SystemExit(Exception):
    def __init__(self, *args):
	self.args = args
        if len(args) == 0:
            self.code = None
        elif len(args) == 1:
            self.code = args[0]
        else:
            self.code = args
back to top