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, "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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue