Remove -outputtuple and -nooutputtuple command line options (Python)

Both the command line and %module options of the same name have been
removed. These were undocumented. The -outputtuple option returned a
Python tuple instead of a list, mostly typically in the OUTPUT
typemap implementations.

It unclear why a tuple instead of a list return type is needed and
hence this option has been removed as part of the simplification of
the SWIG Python command line options for SWIG 4.

Issue #1340.
This commit is contained in:
William S Fulton 2018-11-13 19:46:31 +00:00
commit 0a9b36d3be
2 changed files with 6 additions and 39 deletions

View file

@ -118,7 +118,6 @@ SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
SWIGINTERN PyObject*
SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
if (!result) {
result = obj;
} else if (result == Py_None) {
@ -134,29 +133,6 @@ SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
Py_DECREF(obj);
}
return result;
#else
PyObject* o2;
PyObject* o3;
if (!result) {
result = obj;
} else if (result == Py_None) {
Py_DECREF(result);
result = obj;
} else {
if (!PyTuple_Check(result)) {
o2 = result;
result = PyTuple_New(1);
PyTuple_SET_ITEM(result, 0, o2);
}
o3 = PyTuple_New(1);
PyTuple_SET_ITEM(o3, 0, obj);
o2 = result;
result = PySequence_Concat(o2, o3);
Py_DECREF(o2);
Py_DECREF(o3);
}
return result;
#endif
}
/* Unpack the argument tuple */

View file

@ -90,7 +90,6 @@ static int fastproxy = 0;
static int olddefs = 0;
static int castmode = 0;
static int extranative = 0;
static int outputtuple = 0;
static int nortti = 0;
static int relativeimport = 0;
@ -130,13 +129,11 @@ static const char *usage2 = "\
-noh - Don't generate the output header file\n";
static const char *usage3 = "\
-noolddefs - Don't emit the old method definitions even when using fastproxy (default) \n\
-nooutputtuple - Use a PyList for appending output values (default) \n\
-noproxy - Don't generate proxy classes \n\
-noproxyimport - Don't insert proxy import statements derived from the %import directive \n\
-nortti - Disable the use of the native C++ RTTI with directors\n\
-nothreads - Disable thread support for the entire interface\n\
-olddefs - Keep the old method definitions even when using fastproxy\n\
-outputtuple - Use a PyTuple for outputs instead of a PyList (use carefully with legacy interfaces) \n\
-py3 - Generate code with Python 3 specific features and syntax\n\
-relativeimport - Use relative python imports \n\
-threads - Add thread support for all the interface\n\
@ -347,12 +344,6 @@ public:
use_kw = 1;
SWIG_cparse_set_compact_default_args(1);
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-outputtuple") == 0) {
outputtuple = 1;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-nooutputtuple") == 0) {
outputtuple = 0;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-nortti") == 0) {
nortti = 1;
Swig_mark_arg(i);
@ -458,9 +449,11 @@ public:
strcmp(argv[i], "-nofastquery") == 0 ||
strcmp(argv[i], "-nomodern") == 0 ||
strcmp(argv[i], "-nomodernargs") == 0 ||
strcmp(argv[i], "-nooutputtuple") == 0 ||
strcmp(argv[i], "-nosafecstrings") == 0 ||
strcmp(argv[i], "-old_repr") == 0 ||
strcmp(argv[i], "-oldrepr") == 0 ||
strcmp(argv[i], "-outputtuple") == 0 ||
strcmp(argv[i], "-proxydel") == 0) {
Printf(stderr, "Deprecated command line option: %s. This option is no longer supported.\n", argv[i]);
Swig_mark_arg(i);
@ -530,10 +523,12 @@ public:
extranative = 0;
}
if (Getattr(options, "outputtuple")) {
outputtuple = 1;
Printf(stderr, "Deprecated module option: %s. This option is no longer supported.\n", "outputtuple");
SWIG_exit(EXIT_FAILURE);
}
if (Getattr(options, "nooutputtuple")) {
outputtuple = 0;
Printf(stderr, "Deprecated module option: %s. This option is no longer supported.\n", "nooutputtuple");
SWIG_exit(EXIT_FAILURE);
}
mod_docstring = Getattr(options, "docstring");
package = Getattr(options, "package");
@ -613,10 +608,6 @@ public:
Printf(f_runtime, "#define SWIG_PYTHON_DIRECTOR_NO_VTABLE\n");
}
if (outputtuple) {
Printf(f_runtime, "#define SWIG_PYTHON_OUTPUT_TUPLE\n");
}
if (nortti) {
Printf(f_runtime, "#ifndef SWIG_DIRECTOR_NORTTI\n");
Printf(f_runtime, "#define SWIG_DIRECTOR_NORTTI\n");