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:
parent
866429d0f7
commit
475d03f195
1 changed files with 4 additions and 9 deletions
|
|
@ -912,17 +912,12 @@ public:
|
||||||
tab4, "try:\n", tab8, "strthis = \"proxy of \" + self.this.__repr__()\n",
|
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);
|
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) {
|
if (!classic && !modern) {
|
||||||
/* Usage of types.ObjectType is deprecated.
|
|
||||||
* But don't sure wether this would broken old Python?
|
|
||||||
*/
|
|
||||||
Printv(f_shadow,
|
Printv(f_shadow,
|
||||||
// "import types\n",
|
|
||||||
"try:\n",
|
"try:\n",
|
||||||
// " _object = types.ObjectType\n",
|
tab4, "_object = object\n", tab4, "_newclass = 1\n",
|
||||||
tab4, "_object = object\n", tab4, "_newclass = 1\n", "except AttributeError:\n", tab4, "class _object:\n", tab8, "pass\n", tab4, "_newclass = 0\n",
|
"except __builtin__.Exception:\n",
|
||||||
// "del types\n",
|
tab4, "class _object:\n", tab8, "pass\n", tab4, "_newclass = 0\n\n", NIL);
|
||||||
"\n\n", NIL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (modern) {
|
if (modern) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue