1. 22 Jun, 1999 1 commit
    • Guido van Rossum's avatar
      Patch by Tim Peters: · 87460821
      Guido van Rossum authored
      Introduce a new builtin exception, UnboundLocalError, raised when ceval.c
      tries to retrieve or delete a local name that isn't bound to a value.
      Currently raises NameError, which makes this behavior a FAQ since the same
      error is raised for "missing" global names too:  when the user has a global
      of the same name as the unbound local, NameError makes no sense to them.
      Even in the absence of shadowing, knowing whether a bogus name is local or
      global is a real aid to quick understanding.
      
      Example:
      
      D:\src\PCbuild>type local.py
      x = 42
      
      def f():
          print x
          x = 13
          return x
      
      f()
      
      D:\src\PCbuild>python local.py
      Traceback (innermost last):
        File "local.py", line 8, in ?
          f()
        File "local.py", line 4, in f
          print x
      UnboundLocalError: x
      
      D:\src\PCbuild>
      
      Note that UnboundLocalError is a subclass of NameError, for compatibility
      with existing class-exception code that may be trying to catch this as a
      NameError.  Unfortunately, I see no way to make this wholly compatible
      with -X (see comments in bltinmodule.c):  under -X, [UnboundLocalError
      is an alias for NameError --GvR].
      
      [The ceval.c patch differs slightly from the second version that Tim
      submitted; I decided not to raise UnboundLocalError for DELETE_NAME,
      only for DELETE_LOCAL.  DELETE_NAME is only generated at the module
      level, and since at that level a NameError is raised for referencing
      an undefined name, it should also be raised for deleting one.]
      87460821
  2. 21 Jun, 1999 12 commits
  3. 18 Jun, 1999 7 commits
  4. 17 Jun, 1999 15 commits
  5. 16 Jun, 1999 3 commits
    • Guido van Rossum's avatar
      Patch by Jim Fulton (code style tweaked a bit) to support · 668213d3
      Guido van Rossum authored
      ExtensionClasses in isinstance() and issubclass().
      
        - abstract instance and class protocols are used *only* in those
          cases that would generate errors before the patch.  That is, there's
          no penalty for the normal case.
      
        - instance protocol: an object smells like an instance if it
          has a __class__ attribute that smells like a class.
      
        - class protocol: an object smells like a class if it has a
          __bases__ attribute that is a tuple with elements that
          smell like classes (although not all elements may actually get
          sniffed ;).
      668213d3
    • Guido van Rossum's avatar
      Suppress warning print statements about modules not found, they are · 9f612f9c
      Guido van Rossum authored
      confusing to end users of IDEs.
      9f612f9c
    • Guido van Rossum's avatar
      Sjoerd Mullender: · 7bb11d68
      Guido van Rossum authored
      Added support for unseekable files.
      
      (I use unqualified excepts since we don't know why the seek/tell might
      fail.  In my case it was because of an AttributeError.)
      7bb11d68
  6. 15 Jun, 1999 2 commits