Message37182
Logged In: YES
user_id=93657
1) Patch for PyErr_Raise:
I manually edited the patch file, since I had the ImportNotFound changes with it.
The entire patch is in cdiff file attached to
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=448488&group_id=5470
Meanwhile, I'm pasting below the missing section.
2) I'm going to make a quick search on the existing base for replacement opportunities.
3) CallMethodArgs vs. CallMethodArgs with keywords:
The main reason is that the implementation relies on the exsiting PyObject_CallObject function, with does
not take keyword args...
However, your remark is relevant, and two other functions would be needed to complete the call interface:
PyObject_CallObjectWithKW and PyObject_CallMethodArgsWithKW...
I'd say that use of keyword arg from the C API is unusual; since I've never needed them, I haven't
implemented them...
Index: Python/errors.c
===================================================================
RCS file: /cvs/python/Python/Python/errors.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 errors.c
*** Python/errors.c 2001/05/27 15:36:36 1.1.1.1
--- Python/errors.c 2001/06/05 16:11:16
***************
*** 514,519 ****
--- 514,571 ----
}
+ PyObject* PyErr_RaiseArgs( PyObject* exctype, PyObject* args)
+ {
+ PyObject* exception;
+ exception = PyObject_CallObject( exctype, args);
+ if (! exception) return NULL;
+ PyErr_SetObject( exctype, exception);
+ return NULL;
+ }
+
+ PyObject* PyErr_Raise( PyObject* exctype, char const* format, ...)
+ {
+ PyObject* args = NULL, *result = NULL;
+ va_list va;
+
+ va_start( va, format);
+ args = format ? Py_VaBuildValue( (char*)format, va) : PyTuple_New(0);
+ va_end(va);
+
+ if (! args) goto Finally;
+ if (! PyTuple_Check( args)) {
+ PyObject* newargs;
+ newargs = PyTuple_New( 1);
+ if (! newargs) goto Finally;
+ PyTuple_SET_ITEM( newargs, 0, args);
+ args = newargs;
+ }
+
+ result = PyErr_RaiseArgs( exctype, args);
+ Finally:
+ Py_XDECREF(args);
+ return result;
+ }
+
PyObject *
PyErr_NewException(char *name, PyObject *base, PyObject *dict)
{
|
|
Date |
User |
Action |
Args |
2007-08-23 15:06:54 | admin | link | issue448305 messages |
2007-08-23 15:06:54 | admin | create | |
|