add -proxydel/-noproxydel plus minor improvements
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7972 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ea47af15fe
commit
72b1667a58
4 changed files with 44 additions and 9 deletions
|
|
@ -1,6 +1,18 @@
|
||||||
Version 1.3.28 (unreleased).
|
Version 1.3.28 (unreleased).
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
12/11/2005: mmatus
|
||||||
|
[Python]
|
||||||
|
- Add the -proxydel/-noproxydel options to enable/disable
|
||||||
|
the generation of proxy/shadow __del__ methods, even
|
||||||
|
when now are redundant, since they are empty.
|
||||||
|
However, old interfaces could relay in calling them.
|
||||||
|
|
||||||
|
The default behavior is to generate the __del__ methods
|
||||||
|
as in 1.3.27 or older swig versions.
|
||||||
|
|
||||||
|
The option -O now also implies -noproxydel.
|
||||||
|
|
||||||
12/10/2005: mmatus
|
12/10/2005: mmatus
|
||||||
[UTF]
|
[UTF]
|
||||||
- Fix inneccessary calls to SWIG_TypeQuery for 'char *'
|
- Fix inneccessary calls to SWIG_TypeQuery for 'char *'
|
||||||
|
|
@ -26,7 +38,7 @@ Version 1.3.28 (unreleased).
|
||||||
- Add the -O option to enable all the optimization options
|
- Add the -O option to enable all the optimization options
|
||||||
at once, equivalent to
|
at once, equivalent to
|
||||||
|
|
||||||
-modern -fastdispatch -dirvtable -nosafecstrings -fvirtual -fcompact
|
-modern -fastdispatch -dirvtable -nosafecstrings -fvirtual
|
||||||
|
|
||||||
|
|
||||||
12/08/2005: mmatus
|
12/08/2005: mmatus
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ PySwigObject_own(PyObject *v, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIME PyTypeObject*
|
SWIGRUNTIME PyTypeObject*
|
||||||
PySwigObject_type(void) {
|
_PySwigObject_type(void) {
|
||||||
static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
|
static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
|
||||||
static PyMethodDef
|
static PyMethodDef
|
||||||
swigobject_methods[] = {
|
swigobject_methods[] = {
|
||||||
|
|
@ -479,6 +479,12 @@ PySwigObject_type(void) {
|
||||||
return &pyswigobject_type;
|
return &pyswigobject_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWIGRUNTIME PyTypeObject*
|
||||||
|
PySwigObject_type(void) {
|
||||||
|
static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
SWIGRUNTIME PyObject *
|
SWIGRUNTIME PyObject *
|
||||||
PySwigObject_New(void *ptr, swig_type_info *ty, int own)
|
PySwigObject_New(void *ptr, swig_type_info *ty, int own)
|
||||||
{
|
{
|
||||||
|
|
@ -706,8 +712,8 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
|
||||||
obj = PyObject_GetAttr(pyobj,SWIG_This());
|
obj = PyObject_GetAttr(pyobj,SWIG_This());
|
||||||
Py_XDECREF(obj);
|
Py_XDECREF(obj);
|
||||||
#endif
|
#endif
|
||||||
if (!obj || PyErr_Occurred()) {
|
if (!obj) {
|
||||||
PyErr_Clear();
|
if (PyErr_Occurred()) PyErr_Clear();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!PySwigObject_Check(obj)) {
|
if (!PySwigObject_Check(obj)) {
|
||||||
|
|
@ -839,7 +845,12 @@ SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
|
||||||
{
|
{
|
||||||
PyObject *inst = 0;
|
PyObject *inst = 0;
|
||||||
if (data->newraw) {
|
if (data->newraw) {
|
||||||
|
#if 1
|
||||||
|
PyCFunctionWithKeywords meth = (PyCFunctionWithKeywords) PyCFunction_GET_FUNCTION(data->newraw);
|
||||||
|
inst = (*meth)(PyCFunction_GET_SELF(data->newraw), data->newargs, NULL);
|
||||||
|
#else
|
||||||
inst = PyObject_Call(data->newraw, data->newargs, NULL);
|
inst = PyObject_Call(data->newraw, data->newargs, NULL);
|
||||||
|
#endif
|
||||||
if (inst) {
|
if (inst) {
|
||||||
#ifndef SWIG_PYTHON_SLOW_GETSET_THIS
|
#ifndef SWIG_PYTHON_SLOW_GETSET_THIS
|
||||||
PyObject **dictptr = _PyObject_GetDictPtr(inst);
|
PyObject **dictptr = _PyObject_GetDictPtr(inst);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
|
||||||
*alloc = SWIG_NEWOBJ;
|
*alloc = SWIG_NEWOBJ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*cptr = PyString_AsString(obj);
|
*cptr = cstr;
|
||||||
*alloc = SWIG_OLDOBJ;
|
*alloc = SWIG_OLDOBJ;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,11 @@ static String *real_classname;
|
||||||
static int threads = 0;
|
static int threads = 0;
|
||||||
static int nothreads = 0;
|
static int nothreads = 0;
|
||||||
static int classptr = 0;
|
static int classptr = 0;
|
||||||
|
/* Other options */
|
||||||
static int shadowimport = 1;
|
static int shadowimport = 1;
|
||||||
static int safecstrings = 0;
|
static int safecstrings = 0;
|
||||||
static int dirvtable = 0;
|
static int dirvtable = 0;
|
||||||
|
static int proxydel = 1;
|
||||||
|
|
||||||
/* flags for the make_autodoc function */
|
/* flags for the make_autodoc function */
|
||||||
enum autodoc_t {
|
enum autodoc_t {
|
||||||
|
|
@ -101,8 +103,10 @@ Python Options (available with -python)\n\
|
||||||
-nosafecstrings - Avoid extra strings copies when possible (default)\n\
|
-nosafecstrings - Avoid extra strings copies when possible (default)\n\
|
||||||
-dirvtable - Generate a pseudo virtual table for directors for faster dispatch \n\
|
-dirvtable - Generate a pseudo virtual table for directors for faster dispatch \n\
|
||||||
-nodirvtable - Don't use the virtual table feature, resolve the python method each time (default)\n\
|
-nodirvtable - Don't use the virtual table feature, resolve the python method each time (default)\n\
|
||||||
|
-proxydel - Generate a __del__ method even when now is redundant (default) \n\
|
||||||
|
-noproxydel - Don't generate the redundant __del__ method \n\
|
||||||
-O - Enable several old and new optimizations options: \n\
|
-O - Enable several old and new optimizations options: \n\
|
||||||
-modern, -fastdispatch, -dirvtable, -nosafecstrings, -fvirtual, -fcompact \n\
|
-modern -fastdispatch -dirvtable -nosafecstrings -fvirtual -noproxydel \n\
|
||||||
\n";
|
\n";
|
||||||
|
|
||||||
class PYTHON : public Language {
|
class PYTHON : public Language {
|
||||||
|
|
@ -274,6 +278,12 @@ public:
|
||||||
} else if (strcmp(argv[i],"-nodirvtable") == 0) {
|
} else if (strcmp(argv[i],"-nodirvtable") == 0) {
|
||||||
dirvtable = 0;
|
dirvtable = 0;
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
|
} else if (strcmp(argv[i],"-proxydel") == 0) {
|
||||||
|
proxydel = 1;
|
||||||
|
Swig_mark_arg(i);
|
||||||
|
} else if (strcmp(argv[i],"-noproxydel") == 0) {
|
||||||
|
proxydel = 0;
|
||||||
|
Swig_mark_arg(i);
|
||||||
} else if (strcmp(argv[i],"-modern") == 0) {
|
} else if (strcmp(argv[i],"-modern") == 0) {
|
||||||
apply = 0;
|
apply = 0;
|
||||||
classic = 0;
|
classic = 0;
|
||||||
|
|
@ -297,9 +307,9 @@ public:
|
||||||
dirvtable = 1;
|
dirvtable = 1;
|
||||||
safecstrings = 0;
|
safecstrings = 0;
|
||||||
classptr = 0;
|
classptr = 0;
|
||||||
|
proxydel = 0;
|
||||||
Wrapper_fast_dispatch_mode_set(1);
|
Wrapper_fast_dispatch_mode_set(1);
|
||||||
Wrapper_virtual_elimination_mode_set(1);
|
Wrapper_virtual_elimination_mode_set(1);
|
||||||
Wrapper_compact_print_mode_set(1);
|
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
} else if (strcmp(argv[i],"-help") == 0) {
|
} else if (strcmp(argv[i],"-help") == 0) {
|
||||||
fputs(usage,stdout);
|
fputs(usage,stdout);
|
||||||
|
|
@ -2702,7 +2712,9 @@ public:
|
||||||
} else {
|
} else {
|
||||||
Printv(f_shadow, tab4, "__swig_destroy__ = ", module, ".", Swig_name_destroy(symname), "\n", NIL);
|
Printv(f_shadow, tab4, "__swig_destroy__ = ", module, ".", Swig_name_destroy(symname), "\n", NIL);
|
||||||
if (!have_pythonprepend(n) && !have_pythonappend(n)) {
|
if (!have_pythonprepend(n) && !have_pythonappend(n)) {
|
||||||
Printv(f_shadow, tab4, "__del__ = lambda self : None;\n", NIL);
|
if (proxydel) {
|
||||||
|
Printv(f_shadow, tab4, "__del__ = lambda self : None;\n", NIL);
|
||||||
|
}
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
Printv(f_shadow, tab4, "def __del__(self):\n", NIL);
|
Printv(f_shadow, tab4, "def __del__(self):\n", NIL);
|
||||||
|
|
@ -3092,6 +3104,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
||||||
int allow_thread = threads_enable(n);
|
int allow_thread = threads_enable(n);
|
||||||
|
|
||||||
/* direct call to superclass if _up is set */
|
/* direct call to superclass if _up is set */
|
||||||
|
if (allow_thread) thread_begin_block(n, w->code);
|
||||||
Printf(w->code, "if (swig_get_up()) {\n");
|
Printf(w->code, "if (swig_get_up()) {\n");
|
||||||
if (pure_virtual) {
|
if (pure_virtual) {
|
||||||
Printf(w->code,
|
Printf(w->code,
|
||||||
|
|
@ -3118,7 +3131,6 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
||||||
Delete(cres);
|
Delete(cres);
|
||||||
}
|
}
|
||||||
if (allow_thread) {
|
if (allow_thread) {
|
||||||
thread_begin_block(n, w->code);
|
|
||||||
Printf(w->code, "{\n");
|
Printf(w->code, "{\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue