From c499d0a60aeb414efbbdff01d63ee1384f2ddb04 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 2 Mar 2024 11:54:11 -0500 Subject: [PATCH 1/2] 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 From 33f49849f5e78b544cbf4c21efa82f10d0cea9d6 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 2 Mar 2024 12:02:05 -0500 Subject: [PATCH 2/2] Add some 3.3 and 3.4 stdlib tests back in --- test/stdlib/3.3-exclude.sh | 3 +-- test/stdlib/3.4-exclude.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/stdlib/3.3-exclude.sh b/test/stdlib/3.3-exclude.sh index a45c81ca..170e25e8 100644 --- a/test/stdlib/3.3-exclude.sh +++ b/test/stdlib/3.3-exclude.sh @@ -10,7 +10,7 @@ SKIP_TESTS=( # tgt.append(elem) [test_itertools.py]=1 - [test_buffer.py]=pytest # FIXME: Works on c90ff51 + [test_buffer.py]=pytest [test_cmath.py]=pytest [test_atexit.py]=1 # The atexit test starting at 3.3 looks for specific comments in error lines @@ -19,7 +19,6 @@ SKIP_TESTS=( [test_concurrent_futures.py]=1 # too long? [test_decimal.py]=1 # test takes too long to run: 18 seconds - [test_descr.py]=1 # test assertion errors [test_doctest.py]=1 # test assertion errors [test_doctest2.py]=1 # test assertion errors [test_dis.py]=1 # We change line numbers - duh! diff --git a/test/stdlib/3.4-exclude.sh b/test/stdlib/3.4-exclude.sh index 641cf906..b398b8e9 100644 --- a/test/stdlib/3.4-exclude.sh +++ b/test/stdlib/3.4-exclude.sh @@ -26,7 +26,16 @@ SKIP_TESTS=( [test_dbm_gnu.py]=1 # fails on its own [test_devpoll.py]=1 # it fails on its own + [test_descr.py]=1 # test assertion errors + # ERROR: test_reent_set_bases_on_base (__main__.MroTest) + # Traceback (most recent call last): + # File "test_descr.py", line 5521, in test_reent_set_bases_on_base + # class A(metaclass=M): + # File "test_descr.py", line 5472, in __new__ + # return type.__new__(mcls, name, bases, attrs) + # TypeError: 'NoneType' object is not iterable + [test_dis.py]=1 # We change line numbers - duh! [test_distutils.py]=1 # it fails on its own [test_doctest2.py]=1