The dependency on __builtins__ is wrong; you should import __builtin__ (no 's') and use that.
Also, why the except? On 2/27/07, brett.cannon <[email protected]> wrote: > Author: brett.cannon > Date: Wed Feb 28 01:01:43 2007 > New Revision: 54008 > > Modified: > python/branches/p3yk/Lib/test/test_pep352.py > Log: > Fix test_pep352 to deal with the removal of the 'exceptions' module. > > > Modified: python/branches/p3yk/Lib/test/test_pep352.py > ============================================================================== > --- python/branches/p3yk/Lib/test/test_pep352.py (original) > +++ python/branches/p3yk/Lib/test/test_pep352.py Wed Feb 28 01:01:43 > 2007 > @@ -1,6 +1,5 @@ > import unittest > import __builtin__ > -import exceptions > import warnings > from test.test_support import run_unittest, guard_warnings_filter > import os > @@ -21,7 +20,14 @@ > > def test_inheritance(self): > # Make sure the inheritance hierarchy matches the documentation > - exc_set = set(x for x in dir(exceptions) if not x.startswith('_')) > + exc_set = set() > + for object_ in __builtins__.__dict__.values(): > + try: > + if issubclass(object_, BaseException): > + exc_set.add(object_.__name__) > + except TypeError: > + pass > + > inheritance_tree = open(os.path.join(os.path.split(__file__)[0], > 'exception_hierarchy.txt')) > try: > _______________________________________________ > Python-3000-checkins mailing list > [email protected] > http://mail.python.org/mailman/listinfo/python-3000-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000-checkins mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000-checkins
