From df86fbc54ec707443a6e52f6e887fc909244472f Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 23 Mar 2022 07:51:30 +0000 Subject: [PATCH] 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 --- Source/Modules/python.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 83c00929c..41569cb18 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -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, ")"); } }