[Python-checkins] r54023 - in python/branches/p3yk_no_args_on_exc: Lib/test/test_exceptions.py Objects/exceptions.c
brett.cannon
python-checkins at python.org
Wed Feb 28 19:15:38 CET 2007
Author: brett.cannon
Date: Wed Feb 28 19:15:35 2007
New Revision: 54023
Modified:
python/branches/p3yk_no_args_on_exc/Lib/test/test_exceptions.py
python/branches/p3yk_no_args_on_exc/Objects/exceptions.c
Log:
Allow SyntaxError to be instantiated with no arguments.
Modified: python/branches/p3yk_no_args_on_exc/Lib/test/test_exceptions.py
==============================================================================
--- python/branches/p3yk_no_args_on_exc/Lib/test/test_exceptions.py (original)
+++ python/branches/p3yk_no_args_on_exc/Lib/test/test_exceptions.py Wed Feb 28 19:15:35 2007
@@ -224,6 +224,9 @@
(EnvironmentError, (1, 'strErrorStr', 'filenameStr'),
{'message' : 1, 'errno' : 1, 'strerror' : 'strErrorStr',
'filename' : 'filenameStr'}),
+ (SyntaxError, (), {'message' : '', 'text' : None,
+ 'print_file_and_line' : None, 'msg' : '', 'filename' : None,
+ 'lineno' : None, 'offset' : None}),
(SyntaxError, ('msgStr',),
{'message' : 'msgStr', 'text' : None,
'print_file_and_line' : None, 'msg' : 'msgStr',
Modified: python/branches/p3yk_no_args_on_exc/Objects/exceptions.c
==============================================================================
--- python/branches/p3yk_no_args_on_exc/Objects/exceptions.c (original)
+++ python/branches/p3yk_no_args_on_exc/Objects/exceptions.c Wed Feb 28 19:15:35 2007
@@ -919,7 +919,7 @@
self->msg = self->message;
Py_INCREF(self->msg);
- if (lenargs == 1) {
+ if (lenargs == 0 || lenargs == 1) {
Py_INCREF(Py_None);
self->filename = Py_None;
Py_INCREF(Py_None);
@@ -960,7 +960,7 @@
Py_DECREF(info);
}
else {
- PyErr_SetString(PyExc_TypeError, "expect either 0, 1, or 2 arguments");
+ PyErr_SetString(PyExc_TypeError, "0, 1, or 2 arguments required");
return -1;
}
return 0;
More information about the Python-checkins
mailing list