]> granicus.if.org Git - python/commitdiff
Bug #1566800: make sure that EnvironmentError can be called with any
authorGeorg Brandl <georg@python.org>
Sat, 30 Sep 2006 09:03:42 +0000 (09:03 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 30 Sep 2006 09:03:42 +0000 (09:03 +0000)
number of arguments, as was the case in Python 2.4.

Lib/test/test_exceptions.py
Misc/NEWS
Objects/exceptions.c

index 27d88a0fd5f079df7180ce05097fde5eaacf10f8..585d6fe6cffc47ebd7f746f12e2f322a2db58534 100644 (file)
@@ -196,11 +196,16 @@ class ExceptionTests(unittest.TestCase):
             (SystemExit, ('foo',),
                 {'message' : 'foo', 'args' : ('foo',), 'code' : 'foo'}),
             (IOError, ('foo',),
-                {'message' : 'foo', 'args' : ('foo',)}),
+                {'message' : 'foo', 'args' : ('foo',), 'filename' : None,
+                 'errno' : None, 'strerror' : None}),
             (IOError, ('foo', 'bar'),
-                {'message' : '', 'args' : ('foo', 'bar')}),
+                {'message' : '', 'args' : ('foo', 'bar'), 'filename' : None,
+                 'errno' : 'foo', 'strerror' : 'bar'}),
             (IOError, ('foo', 'bar', 'baz'),
-                {'message' : '', 'args' : ('foo', 'bar')}),
+                {'message' : '', 'args' : ('foo', 'bar'), 'filename' : 'baz',
+                 'errno' : 'foo', 'strerror' : 'bar'}),
+            (IOError, ('foo', 'bar', 'baz', 'quux'),
+                {'message' : '', 'args' : ('foo', 'bar', 'baz', 'quux')}),
             (EnvironmentError, ('errnoStr', 'strErrorStr', 'filenameStr'),
                 {'message' : '', 'args' : ('errnoStr', 'strErrorStr'),
                  'strerror' : 'strErrorStr', 'errno' : 'errnoStr',
index 23b9bbb77108c201785b1a130a5a79b723bdfe2a..3bca93dcec9b8c3afd6611499176d114523e38f6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
 Core and builtins
 -----------------
 
+- Bug #1566800: make sure that EnvironmentError can be called with any
+  number of arguments, as was the case in Python 2.4.
+
 - Patch #1567691: super() and new.instancemethod() now don't accept
   keyword arguments any more (previously they accepted them, but didn't
   use them).
index bfe28a95c0a8db6dc725a25b7caf4be4d8ed5587..c0b813d4a2203eacd474f4713cdcbd28fc31d4ac 100644 (file)
@@ -510,7 +510,7 @@ EnvironmentError_init(PyEnvironmentErrorObject *self, PyObject *args,
     if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1)
         return -1;
 
-    if (PyTuple_GET_SIZE(args) <= 1) {
+    if (PyTuple_GET_SIZE(args) <= 1 || PyTuple_GET_SIZE(args) > 3) {
         return 0;
     }