Clean up setting _object

Don't bother setting _object in modern mode since it isn't used
Catch __builtin__.Exception rather than AttributeError since the check for
object hasn't been through something that would raise an AttributeError since
3d8ddfc4 in 2008
This commit is contained in:
Alec Cooper 2016-01-25 12:03:13 -05:00
commit 475d03f195

View file

@ -912,17 +912,12 @@ public:
tab4, "try:\n", tab8, "strthis = \"proxy of \" + self.this.__repr__()\n",
tab4, "except __builtin__.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.
* But don't sure wether this would broken old Python?
*/
if (!classic && !modern) {
Printv(f_shadow,
// "import types\n",
"try:\n",
// " _object = types.ObjectType\n",
tab4, "_object = object\n", tab4, "_newclass = 1\n", "except AttributeError:\n", tab4, "class _object:\n", tab8, "pass\n", tab4, "_newclass = 0\n",
// "del types\n",
"\n\n", NIL);
tab4, "_object = object\n", tab4, "_newclass = 1\n",
"except __builtin__.Exception:\n",
tab4, "class _object:\n", tab8, "pass\n", tab4, "_newclass = 0\n\n", NIL);
}
}
if (modern) {