diff --git a/SWIG/CHANGES.current b/SWIG/CHANGES.current index 25ac5149b..2ce1d7637 100644 --- a/SWIG/CHANGES.current +++ b/SWIG/CHANGES.current @@ -1,7 +1,27 @@ Version 1.3.28 (unreleased). =========================== -12/14/2005: mmatus + +12/17/2005: mmatus + [Python] + - Add the -aliasobj0/-noaliasobj0 options to use with + -fastunpack and/or -O and old typemaps that use 'obj0' + directly. + + So, if you compile your code using -O and get errors about + the undeclared 'obj0' variable, run again using + + swig -O -aliasobj0 -python .... + + For new typemaps, never use 'obj0' directly, if needed, + use the '$self' name that will be properly expanded to + 'obj0' (nofastunpack) or 'swig_obj[0]' (fastunpack). + + If you have no idea what I am talking about, better, that + means you have no typemap with this problem. + + +12/14/2005: mmatus [Python] - Add the -fastunpack/-nofastunpack options to enable/disable the use of the internal UnpackTuple method, instead of diff --git a/SWIG/Source/Modules/python.cxx b/SWIG/Source/Modules/python.cxx index c2f1c0a4c..a60fcf5d3 100644 --- a/SWIG/Source/Modules/python.cxx +++ b/SWIG/Source/Modules/python.cxx @@ -67,7 +67,7 @@ static int safecstrings = 0; static int dirvtable = 0; static int proxydel = 1; static int fastunpack = 0; -static int keepobj0 = 0; +static int aliasobj0 = 0; /* flags for the make_autodoc function */ enum autodoc_t { @@ -109,8 +109,8 @@ Python Options (available with -python)\n\ -noproxydel - Don't generate the redundant __del__ method \n\ -fastunpack - Use fast unpack mechanism to parse the argument functions \n\ -nofastunpack - Use traditional UnpackTuple method to parse the argument functions (default) \n\ - -keepobj0 - Keep obj0 when using fastunpack, needed for some users typemaps \n\ - -nokeepobj0 - Don't generate obj0 when using fastunpack (default) \n\ + -aliasobj0 - Alias obj0 when using fastunpack, needed for some old typemaps \n\ + -noaliasobj0 - Don't generate an obj0 alias when using fastunpack (default) \n\ -O - Enable several old and new optimizations options: \n\ -modern -fastdispatch -dirvtable -nosafecstrings -fvirtual -noproxydel -fastunpack\n\ \n"; @@ -290,11 +290,11 @@ public: } else if (strcmp(argv[i],"-nofastunpack") == 0) { fastunpack = 0; Swig_mark_arg(i); - } else if (strcmp(argv[i],"-keepobj0") == 0) { - keepobj0 = 1; + } else if (strcmp(argv[i],"-aliasobj0") == 0) { + aliasobj0 = 1; Swig_mark_arg(i); - } else if (strcmp(argv[i],"-nokeepobj0") == 0) { - keepobj0 = 0; + } else if (strcmp(argv[i],"-noaliasobj0") == 0) { + aliasobj0 = 0; Swig_mark_arg(i); } else if (strcmp(argv[i],"-proxydel") == 0) { proxydel = 1; @@ -1475,13 +1475,13 @@ public: /* Generate code for argument marshalling */ if (funpack) { if (overname) { - if (keepobj0) { + if (aliasobj0) { Printf(f->code, "#define obj0 (swig_obj[0])\n"); } } else if (num_arguments) { sprintf(source,"PyObject *swig_obj[%d]",num_arguments); Wrapper_add_localv(f, "swig_obj", source, NIL); - if (keepobj0) { + if (aliasobj0) { Printf(f->code, "#define obj0 (swig_obj[0])\n"); } } @@ -1850,7 +1850,7 @@ public: if (funpack) { - if (keepobj0) { + if (aliasobj0) { Printf(f->code, "#if defined(obj0)\n"); Printf(f->code, "#undef obj0\n"); Printf(f->code, "#endif\n");