Remove unused functions in Python builtin mode

This commit is contained in:
William S Fulton 2022-04-06 23:06:48 +01:00
commit a12fc916e4

View file

@ -712,9 +712,11 @@ public:
Printv(default_import_code, tab4, "from ", module, " import *\n", NULL); Printv(default_import_code, tab4, "from ", module, " import *\n", NULL);
} }
if (!builtin) {
/* Need builtins to qualify names like Exception that might also be /* Need builtins to qualify names like Exception that might also be
defined in this module (try both Python 3 and Python 2 names) */ defined in this module (try both Python 3 and Python 2 names) */
Printv(f_shadow, "try:\n", tab4, "import builtins as __builtin__\n", "except ImportError:\n", tab4, "import __builtin__\n", NULL); Printv(f_shadow, "try:\n", tab4, "import builtins as __builtin__\n", "except ImportError:\n", tab4, "import __builtin__\n", NULL);
}
if (!builtin && fastproxy) { if (!builtin && fastproxy) {
Printf(f_shadow, "\n"); Printf(f_shadow, "\n");
@ -722,6 +724,7 @@ public:
Printf(f_shadow, "_swig_new_static_method = %s.SWIG_PyStaticMethod_New\n", module); Printf(f_shadow, "_swig_new_static_method = %s.SWIG_PyStaticMethod_New\n", module);
} }
if (!builtin) {
Printv(f_shadow, "\n", Printv(f_shadow, "\n",
"def _swig_repr(self):\n", "def _swig_repr(self):\n",
tab4, "try:\n", tab4, "try:\n",
@ -767,7 +770,7 @@ public:
Printv(f_shadow, "\n", NIL); Printv(f_shadow, "\n", NIL);
if (directorsEnabled()) { if (directorsEnabled())
Printv(f_shadow, "import weakref\n\n", NIL); Printv(f_shadow, "import weakref\n\n", NIL);
} }
} }