From c499d0a60aeb414efbbdff01d63ee1384f2ddb04 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 2 Mar 2024 11:54:11 -0500 Subject: [PATCH] Fix in 3.3 subclass detection in class closures --- uncompyle6/semantics/customize3.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/uncompyle6/semantics/customize3.py b/uncompyle6/semantics/customize3.py index e0a9f026..c9025c5d 100644 --- a/uncompyle6/semantics/customize3.py +++ b/uncompyle6/semantics/customize3.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018-2021, 2023 by Rocky Bernstein +# Copyright (c) 2018-2021, 2023-2024 by Rocky Bernstein # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -139,14 +139,10 @@ def customize_for_version3(self, version): # Python 3.2 works like this subclass_code = find_code_node(load_closure, -2).attr else: - raise "Internal Error n_classdef: cannot find class body" - if hasattr(build_class[3], "__len__"): - if not subclass_info: - subclass_info = build_class[3] - elif hasattr(build_class[2], "__len__"): - subclass_info = build_class[2] - else: - raise "Internal Error n_classdef: cannot superclass name" + raise RuntimeError("Internal Error n_classdef: cannot find class body") + + subclass_info = build_class + elif not subclass_info: if mkfunc[0] in ("no_kwargs", "kwargs"): subclass_code = mkfunc[1].attr