Merge pull request #509 from sjoerdjob/python_exception_not_bare
Do not use bare exception in generated Python code.
This commit is contained in:
commit
fc521be4e6
1 changed files with 6 additions and 6 deletions
|
|
@ -904,7 +904,7 @@ public:
|
|||
Printv(f_shadow,
|
||||
"\n", "def _swig_repr(self):\n",
|
||||
tab4, "try:\n", tab8, "strthis = \"proxy of \" + self.this.__repr__()\n",
|
||||
tab4, "except:\n", tab8, "strthis = \"\"\n", tab4, "return \"<%s.%s; %s >\" % (self.__class__.__module__, self.__class__.__name__, strthis,)\n\n", NIL);
|
||||
tab4, "except Exception:\n", tab8, "strthis = \"\"\n", tab4, "return \"<%s.%s; %s >\" % (self.__class__.__module__, self.__class__.__name__, strthis,)\n\n", NIL);
|
||||
|
||||
if (!classic) {
|
||||
/* Usage of types.ObjectType is deprecated.
|
||||
|
|
@ -934,7 +934,7 @@ public:
|
|||
if (directorsEnabled()) {
|
||||
// Try loading weakref.proxy, which is only available in Python 2.1 and higher
|
||||
Printv(f_shadow,
|
||||
"try:\n", tab4, "import weakref\n", tab4, "weakref_proxy = weakref.proxy\n", "except:\n", tab4, "weakref_proxy = lambda x: x\n", "\n\n", NIL);
|
||||
"try:\n", tab4, "import weakref\n", tab4, "weakref_proxy = weakref.proxy\n", "except Exception:\n", tab4, "weakref_proxy = lambda x: x\n", "\n\n", NIL);
|
||||
}
|
||||
}
|
||||
// Include some information in the code
|
||||
|
|
@ -4478,11 +4478,11 @@ public:
|
|||
if (!modern) {
|
||||
Printv(f_shadow_file,
|
||||
tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
|
||||
tab8, "except:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n\n", NIL);
|
||||
tab8, "except Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n\n", NIL);
|
||||
} else {
|
||||
Printv(f_shadow_file,
|
||||
tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
|
||||
tab8, "except:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n\n", NIL);
|
||||
tab8, "except Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n\n", NIL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4824,7 +4824,7 @@ public:
|
|||
} else {
|
||||
Printv(f_shadow,
|
||||
tab8, "this = ", funcCall(Swig_name_construct(NSPACE_TODO, symname), callParms), "\n",
|
||||
tab8, "try:\n", tab8, tab4, "self.this.append(this)\n", tab8, "except:\n", tab8, tab4, "self.this = this\n", NIL);
|
||||
tab8, "try:\n", tab8, tab4, "self.this.append(this)\n", tab8, "except Exception:\n", tab8, tab4, "self.this = this\n", NIL);
|
||||
}
|
||||
if (have_pythonappend(n))
|
||||
Printv(f_shadow, indent_pythoncode(pythonappend(n), tab8, Getfile(n), Getline(n), "%pythonappend or %feature(\"pythonappend\")"), "\n\n", NIL);
|
||||
|
|
@ -4922,7 +4922,7 @@ public:
|
|||
#ifdef USE_THISOWN
|
||||
Printv(f_shadow, tab8, "try:\n", NIL);
|
||||
Printv(f_shadow, tab8, tab4, "if self.thisown:", module, ".", Swig_name_destroy(NSPACE_TODO, symname), "(self)\n", NIL);
|
||||
Printv(f_shadow, tab8, "except: pass\n", NIL);
|
||||
Printv(f_shadow, tab8, "except Exception: pass\n", NIL);
|
||||
#else
|
||||
#endif
|
||||
if (have_pythonappend(n))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue