Remove option to use Python 3 only syntax for %pythonnondynamic feature

A metaclass is added using a decorator @_swig_add_metaclass which
is designed to provide a metaclass that works for both Python 2 and Python 3.
The option to use the Python 3 only syntax: metaclass=_SwigNonDynamicMeta
via the -py3 command line option has been removed as part of a
simplification to remove the -py3 option.

Issue #1779
This commit is contained in:
William S Fulton 2022-03-23 07:51:30 +00:00
commit df86fbc54e

View file

@ -4498,10 +4498,8 @@ public:
Delete(rname);
}
} else {
if (!py3) {
if (GetFlag(n, "feature:python:nondynamic"))
Printv(f_shadow, "@_swig_add_metaclass(_SwigNonDynamicMeta)\n", NIL);
}
if (GetFlag(n, "feature:python:nondynamic"))
Printv(f_shadow, "@_swig_add_metaclass(_SwigNonDynamicMeta)\n", NIL);
Printv(f_shadow, "class ", class_name, NIL);
if (Len(base_class)) {
@ -4511,9 +4509,11 @@ public:
Printf(f_shadow, "(Exception)");
} else {
Printf(f_shadow, "(object");
if (py3 && GetFlag(n, "feature:python:nondynamic")) {
/* Replace @_swig_add_metaclass above with below when support for python 2.7 is dropped
if (GetFlag(n, "feature:python:nondynamic")) {
Printf(f_shadow, ", metaclass=_SwigNonDynamicMeta");
}
*/
Printf(f_shadow, ")");
}
}