[Python-checkins] r46304 - python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
richard.jones
python-checkins at python.org
Fri May 26 14:24:43 CEST 2006
Author: richard.jones
Date: Fri May 26 14:24:42 2006
New Revision: 46304
Modified:
python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
Log:
fix num of args issue
Modified: python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
==============================================================================
--- python/branches/sreifschneider-newnewexcept/Objects/exceptions.c (original)
+++ python/branches/sreifschneider-newnewexcept/Objects/exceptions.c Fri May 26 14:24:42 2006
@@ -417,6 +417,10 @@
{
PyObject *myerrno, *strerror, *filename;
PyObject *subslice = NULL;
+
+ if (PySequence_Length(args) <= 1) {
+ return 0;
+ }
if (!PyArg_ParseTuple(args, "OO|O", &myerrno, &strerror, &filename)) {
return -1;
@@ -472,6 +476,7 @@
EnvironmentError_init(EnvironmentErrorObject *self, PyObject *args,
PyObject *kwds)
{
+ if (_BaseException_init(self, args, kwds) == -1) return -1;
return _EnvironmentError_init(self, args, kwds);
}
@@ -830,6 +835,7 @@
static int
SyntaxError_init(SyntaxErrorObject *self, PyObject *args, PyObject *kwds)
{
+ if (_BaseException_init(self, args, kwds) == -1) return -1;
return _SyntaxError_init(self, args, kwds);
}
@@ -1006,14 +1012,14 @@
#ifdef Py_USING_UNICODE
typedef struct {
- PyObject_HEAD
- PyObject *args;
- PyObject *message;
- PyObject *encoding;
- PyObject *object;
- PyObject *start;
- PyObject *end;
- PyObject *reason;
+ PyObject_HEAD
+ PyObject *args;
+ PyObject *message;
+ PyObject *encoding;
+ PyObject *object;
+ PyObject *start;
+ PyObject *end;
+ PyObject *reason;
} UnicodeErrorObject;
static
@@ -1368,6 +1374,7 @@
static int
UnicodeEncodeError_init(PyObject *self, PyObject *args, PyObject *kwds)
{
+ if (_BaseException_init(self, args, kwds) == -1) return -1;
return UnicodeError_init((UnicodeErrorObject *)self, args, kwds, &PyUnicode_Type);
}
@@ -1444,6 +1451,7 @@
static int
UnicodeDecodeError_init(PyObject *self, PyObject *args, PyObject *kwds)
{
+ if (_BaseException_init(self, args, kwds) == -1) return -1;
return UnicodeError_init((UnicodeErrorObject *)self, args, kwds, &PyString_Type);
}
@@ -1554,13 +1562,15 @@
static int
UnicodeTranslateError_init(UnicodeErrorObject *self, PyObject *args, PyObject *kwds)
{
+ if (_BaseException_init(self, args, kwds) == -1) return -1;
+
if (!PyArg_ParseTuple(args, "O!O!O!O!",
- &PyUnicode_Type, &self->object,
- &PyInt_Type, &self->start,
- &PyInt_Type, &self->end,
- &PyString_Type, &self->reason)) {
+ &PyUnicode_Type, &self->object,
+ &PyInt_Type, &self->start,
+ &PyInt_Type, &self->end,
+ &PyString_Type, &self->reason)) {
self->object = self->start = self->end = self->reason = NULL;
- return -1;
+ return -1;
}
self->encoding = Py_None;
More information about the Python-checkins
mailing list