]> granicus.if.org Git - python/commitdiff
Don't just die when an error is not defined; print a warning instead.
authorGuido van Rossum <guido@python.org>
Wed, 9 Apr 1997 21:02:17 +0000 (21:02 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 9 Apr 1997 21:02:17 +0000 (21:02 +0000)
This for errno-challenged platforms like Windows.

Lib/test/test_errno.py

index 6951255becd2a2b22e729f438a3846f2ec3150c0..7228fdf65ececf00bce414f462c5afb8a28a5072 100755 (executable)
@@ -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)