diff options
author | Guido van Rossum <guido@python.org> | 1997-04-09 21:02:17 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-04-09 21:02:17 (GMT) |
commit | cee1dd3f9d26a04ec52317dcbb533af80b791a90 (patch) | |
tree | 62e7276d0484a839700ad885fa6ede89739160bb | |
parent | a6ed2254e12458418bfdc73f1c94a7151295335e (diff) | |
download | cpython-cee1dd3f9d26a04ec52317dcbb533af80b791a90.zip cpython-cee1dd3f9d26a04ec52317dcbb533af80b791a90.tar.gz cpython-cee1dd3f9d26a04ec52317dcbb533af80b791a90.tar.bz2 |
Don't just die when an error is not defined; print a warning instead.
This for errno-challenged platforms like Windows.
-rwxr-xr-x | Lib/test/test_errno.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/test/test_errno.py b/Lib/test/test_errno.py index 6951255..7228fdf 100755 --- a/Lib/test/test_errno.py +++ b/Lib/test/test_errno.py @@ -23,7 +23,7 @@ errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV', 'ENODEV', 'ENOENT', 'ENOEXEC', 'ENOLCK', 'ENOLINK', 'ENOMEM', 'ENOMSG', 'ENONET', 'ENOPKG', 'ENOPROTOOPT', 'ENOSPC', 'ENOSR', 'ENOSTR', 'ENOSYS', 'ENOTBLK', - 'ENOTCONN', 'ENOTDIR', 'ENOTEMPTY', 'ENOTSOCK', + 'ENOTCONN', 'ENOTDIR', 'ENOTEMPTY', 'ENOTOBACCO', 'ENOTSOCK', 'ENOTTY', 'ENOTUNIQ', 'ENXIO', 'EOPNOTSUPP', 'EOVERFLOW', 'EPERM', 'EPFNOSUPPORT', 'EPIPE', 'EPROTO', 'EPROTONOSUPPORT', 'EPROTOTYPE', @@ -39,6 +39,11 @@ errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV', # test seems to work on SGI, Sparc & intel Solaris, and linux. # for error in errors: - a = getattr(errno, error) - if verbose: - print '%s: %d' % (error, a) + try: + a = getattr(errno, error) + except AttributeError: + if verbose: + print '%s: not found' % error + else: + if verbose: + print '%s: %d' % (error, a) |