0s autopkgtest [23:15:48]: starting date and time: 2024-11-14 23:15:48+0000 0s autopkgtest [23:15:48]: git checkout: 6f3be7a8 Fix armhf LXD image generation for plucky 0s autopkgtest [23:15:48]: host juju-7f2275-prod-proposed-migration-environment-20; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.jj1qimfs/out --timeout-copy=6000 -a i386 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:python3-defaults,src:python3-stdlib-extensions --apt-upgrade python-bytecode --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 '--env=ADT_TEST_TRIGGERS=python3-defaults/3.12.7-1 python3-stdlib-extensions/3.12.7-1' -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor builder-cpu2-ram4-disk20 --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-20@bos03-8.secgroup --name adt-plucky-i386-python-bytecode-20241114-231548-juju-7f2275-prod-proposed-migration-environment-20-91a3d12f-832c-4348-bc89-d4bcfbfdd048 --image adt/ubuntu-plucky-amd64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-20 --net-id=net_prod-proposed-migration-amd64 -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 41s autopkgtest [23:16:29]: testbed dpkg architecture: amd64 41s autopkgtest [23:16:29]: testbed apt version: 2.9.8 41s autopkgtest [23:16:29]: test architecture: i386 41s autopkgtest [23:16:29]: @@@@@@@@@@@@@@@@@@@@ test bed setup 42s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [73.9 kB] 42s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [102 kB] 43s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/restricted Sources [7016 B] 43s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [1025 kB] 43s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.5 kB] 43s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main i386 Packages [77.0 kB] 43s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 Packages [144 kB] 43s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/restricted amd64 Packages [32.6 kB] 43s Get:9 http://ftpmaster.internal/ubuntu plucky-proposed/universe amd64 Packages [803 kB] 43s Get:10 http://ftpmaster.internal/ubuntu plucky-proposed/universe i386 Packages [293 kB] 43s Get:11 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse amd64 Packages [9128 B] 43s Get:12 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse i386 Packages [740 B] 43s Fetched 2583 kB in 1s (3184 kB/s) 43s Reading package lists... 45s Reading package lists... 45s Building dependency tree... 45s Reading state information... 45s Calculating upgrade... 45s The following NEW packages will be installed: 45s python3.13-gdbm 45s The following packages will be upgraded: 45s libcap-ng0 libpython3-stdlib pastebinit python3 python3-gdbm python3-minimal 45s python3-systemd 46s 7 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 46s Need to get 178 kB of archives. 46s After this operation, 256 kB of additional disk space will be used. 46s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 python3-minimal amd64 3.12.7-1 [27.4 kB] 46s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 python3 amd64 3.12.7-1 [24.0 kB] 46s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 libpython3-stdlib amd64 3.12.7-1 [10.0 kB] 46s Get:4 http://ftpmaster.internal/ubuntu plucky/main amd64 libcap-ng0 amd64 0.8.5-3build1 [15.6 kB] 46s Get:5 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.13-gdbm amd64 3.13.0-2 [31.3 kB] 46s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 python3-gdbm amd64 3.12.7-1 [8642 B] 46s Get:7 http://ftpmaster.internal/ubuntu plucky/main amd64 pastebinit all 1.7.1-1 [14.9 kB] 46s Get:8 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-systemd amd64 235-1build5 [45.7 kB] 46s Fetched 178 kB in 0s (446 kB/s) 46s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75542 files and directories currently installed.) 46s Preparing to unpack .../python3-minimal_3.12.7-1_amd64.deb ... 46s Unpacking python3-minimal (3.12.7-1) over (3.12.6-0ubuntu1) ... 46s Setting up python3-minimal (3.12.7-1) ... 46s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75542 files and directories currently installed.) 46s Preparing to unpack .../python3_3.12.7-1_amd64.deb ... 46s Unpacking python3 (3.12.7-1) over (3.12.6-0ubuntu1) ... 46s Preparing to unpack .../libpython3-stdlib_3.12.7-1_amd64.deb ... 46s Unpacking libpython3-stdlib:amd64 (3.12.7-1) over (3.12.6-0ubuntu1) ... 47s Preparing to unpack .../libcap-ng0_0.8.5-3build1_amd64.deb ... 47s Unpacking libcap-ng0:amd64 (0.8.5-3build1) over (0.8.5-1) ... 47s Setting up libcap-ng0:amd64 (0.8.5-3build1) ... 47s Selecting previously unselected package python3.13-gdbm. 47s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75542 files and directories currently installed.) 47s Preparing to unpack .../python3.13-gdbm_3.13.0-2_amd64.deb ... 47s Unpacking python3.13-gdbm (3.13.0-2) ... 47s Preparing to unpack .../python3-gdbm_3.12.7-1_amd64.deb ... 47s Unpacking python3-gdbm:amd64 (3.12.7-1) over (3.12.6-1ubuntu1) ... 47s Preparing to unpack .../pastebinit_1.7.1-1_all.deb ... 47s Unpacking pastebinit (1.7.1-1) over (1.7.0-1) ... 47s Preparing to unpack .../python3-systemd_235-1build5_amd64.deb ... 47s Unpacking python3-systemd (235-1build5) over (235-1build4) ... 47s Setting up python3.13-gdbm (3.13.0-2) ... 47s Setting up libpython3-stdlib:amd64 (3.12.7-1) ... 47s Setting up python3 (3.12.7-1) ... 47s Setting up python3-systemd (235-1build5) ... 47s Setting up python3-gdbm:amd64 (3.12.7-1) ... 47s Setting up pastebinit (1.7.1-1) ... 47s Processing triggers for libc-bin (2.40-1ubuntu3) ... 47s Processing triggers for man-db (2.12.1-3) ... 48s Reading package lists... 48s Building dependency tree... 48s Reading state information... 48s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 48s Hit:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease 48s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 48s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 48s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 49s Reading package lists... 49s Reading package lists... 49s Building dependency tree... 49s Reading state information... 50s Calculating upgrade... 50s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 50s Reading package lists... 50s Building dependency tree... 50s Reading state information... 50s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 53s autopkgtest [23:16:41]: testbed running kernel: Linux 6.11.0-8-generic #8-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 16 13:41:20 UTC 2024 53s autopkgtest [23:16:41]: @@@@@@@@@@@@@@@@@@@@ apt-source python-bytecode 55s Get:1 http://ftpmaster.internal/ubuntu plucky/universe python-bytecode 0.15.1-3 (dsc) [2738 B] 55s Get:2 http://ftpmaster.internal/ubuntu plucky/universe python-bytecode 0.15.1-3 (tar) [93.8 kB] 55s Get:3 http://ftpmaster.internal/ubuntu plucky/universe python-bytecode 0.15.1-3 (diff) [9036 B] 55s gpgv: Signature made Wed Dec 27 19:06:00 2023 UTC 55s gpgv: using RSA key 7E1AC3FA27A649284C323EF6695C429316C07BFE 55s gpgv: issuer "jdg@debian.org" 55s gpgv: Can't check signature: No public key 55s dpkg-source: warning: cannot verify inline signature for ./python-bytecode_0.15.1-3.dsc: no acceptable signature found 55s autopkgtest [23:16:43]: testing package python-bytecode version 0.15.1-3 55s autopkgtest [23:16:43]: build not needed 55s autopkgtest [23:16:43]: test pytest: preparing testbed 57s Note, using file '/tmp/autopkgtest.AL7vus/1-autopkgtest-satdep.dsc' to get the build dependencies 57s Reading package lists... 57s Building dependency tree... 57s Reading state information... 58s Starting pkgProblemResolver with broken count: 0 58s Starting 2 pkgProblemResolver with broken count: 0 58s Done 58s The following NEW packages will be installed: 58s build-essential cpp cpp-14 cpp-14-x86-64-linux-gnu cpp-x86-64-linux-gnu 58s fonts-font-awesome fonts-lato g++ g++-14 g++-14-x86-64-linux-gnu 58s g++-x86-64-linux-gnu gcc gcc-14 gcc-14-x86-64-linux-gnu gcc-x86-64-linux-gnu 58s libasan8 libcc1-0 libgcc-14-dev libgomp1 libhwasan0 libisl23 libitm1 58s libjs-jquery libjs-sphinxdoc libjs-underscore liblsan0 libmpc3 58s libpython3.13-minimal libpython3.13-stdlib libquadmath0 libstdc++-14-dev 58s libtsan2 libubsan1 python-bytecode-doc python3-all python3-bytecode 58s python3-iniconfig python3-packaging python3-pluggy python3-pytest python3.13 58s python3.13-minimal sphinx-rtd-theme-common 58s 0 upgraded, 43 newly installed, 0 to remove and 0 not upgraded. 58s Need to get 76.7 MB of archives. 58s After this operation, 263 MB of additional disk space will be used. 58s Get:1 http://ftpmaster.internal/ubuntu plucky/main amd64 fonts-lato all 2.015-1 [2781 kB] 59s Get:2 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3.13-minimal amd64 3.13.0-2 [879 kB] 59s Get:3 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.13-minimal amd64 3.13.0-2 [2188 kB] 59s Get:4 http://ftpmaster.internal/ubuntu plucky/main amd64 libisl23 amd64 0.27-1 [685 kB] 59s Get:5 http://ftpmaster.internal/ubuntu plucky/main amd64 libmpc3 amd64 1.3.1-1build2 [55.3 kB] 59s Get:6 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp-14-x86-64-linux-gnu amd64 14.2.0-8ubuntu1 [11.9 MB] 59s Get:7 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp-14 amd64 14.2.0-8ubuntu1 [1030 B] 59s Get:8 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp-x86-64-linux-gnu amd64 4:14.1.0-2ubuntu1 [5452 B] 59s Get:9 http://ftpmaster.internal/ubuntu plucky/main amd64 cpp amd64 4:14.1.0-2ubuntu1 [22.4 kB] 59s Get:10 http://ftpmaster.internal/ubuntu plucky/main amd64 libcc1-0 amd64 14.2.0-8ubuntu1 [47.6 kB] 59s Get:11 http://ftpmaster.internal/ubuntu plucky/main amd64 libgomp1 amd64 14.2.0-8ubuntu1 [148 kB] 59s Get:12 http://ftpmaster.internal/ubuntu plucky/main amd64 libitm1 amd64 14.2.0-8ubuntu1 [29.1 kB] 59s Get:13 http://ftpmaster.internal/ubuntu plucky/main amd64 libasan8 amd64 14.2.0-8ubuntu1 [2998 kB] 59s Get:14 http://ftpmaster.internal/ubuntu plucky/main amd64 liblsan0 amd64 14.2.0-8ubuntu1 [1317 kB] 59s Get:15 http://ftpmaster.internal/ubuntu plucky/main amd64 libtsan2 amd64 14.2.0-8ubuntu1 [2732 kB] 59s Get:16 http://ftpmaster.internal/ubuntu plucky/main amd64 libubsan1 amd64 14.2.0-8ubuntu1 [1177 kB] 59s Get:17 http://ftpmaster.internal/ubuntu plucky/main amd64 libhwasan0 amd64 14.2.0-8ubuntu1 [1634 kB] 59s Get:18 http://ftpmaster.internal/ubuntu plucky/main amd64 libquadmath0 amd64 14.2.0-8ubuntu1 [153 kB] 59s Get:19 http://ftpmaster.internal/ubuntu plucky/main amd64 libgcc-14-dev amd64 14.2.0-8ubuntu1 [2814 kB] 59s Get:20 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc-14-x86-64-linux-gnu amd64 14.2.0-8ubuntu1 [23.3 MB] 60s Get:21 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc-14 amd64 14.2.0-8ubuntu1 [528 kB] 60s Get:22 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc-x86-64-linux-gnu amd64 4:14.1.0-2ubuntu1 [1214 B] 60s Get:23 http://ftpmaster.internal/ubuntu plucky/main amd64 gcc amd64 4:14.1.0-2ubuntu1 [5000 B] 60s Get:24 http://ftpmaster.internal/ubuntu plucky/main amd64 libstdc++-14-dev amd64 14.2.0-8ubuntu1 [2504 kB] 60s Get:25 http://ftpmaster.internal/ubuntu plucky/main amd64 g++-14-x86-64-linux-gnu amd64 14.2.0-8ubuntu1 [13.3 MB] 60s Get:26 http://ftpmaster.internal/ubuntu plucky/main amd64 g++-14 amd64 14.2.0-8ubuntu1 [19.9 kB] 60s Get:27 http://ftpmaster.internal/ubuntu plucky/main amd64 g++-x86-64-linux-gnu amd64 4:14.1.0-2ubuntu1 [966 B] 60s Get:28 http://ftpmaster.internal/ubuntu plucky/main amd64 g++ amd64 4:14.1.0-2ubuntu1 [1100 B] 60s Get:29 http://ftpmaster.internal/ubuntu plucky/main amd64 build-essential amd64 12.10ubuntu1 [4928 B] 60s Get:30 http://ftpmaster.internal/ubuntu plucky/main amd64 fonts-font-awesome all 5.0.10+really4.7.0~dfsg-4.1 [516 kB] 60s Get:31 http://ftpmaster.internal/ubuntu plucky/main amd64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 60s Get:32 http://ftpmaster.internal/ubuntu plucky/main amd64 libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB] 60s Get:33 http://ftpmaster.internal/ubuntu plucky/main amd64 libjs-sphinxdoc all 7.4.7-4 [158 kB] 60s Get:34 http://ftpmaster.internal/ubuntu plucky/main amd64 libpython3.13-stdlib amd64 3.13.0-2 [2107 kB] 60s Get:35 http://ftpmaster.internal/ubuntu plucky/main amd64 sphinx-rtd-theme-common all 3.0.1+dfsg-1 [1012 kB] 60s Get:36 http://ftpmaster.internal/ubuntu plucky/universe amd64 python-bytecode-doc all 0.15.1-3 [64.6 kB] 60s Get:37 http://ftpmaster.internal/ubuntu plucky/main amd64 python3.13 amd64 3.13.0-2 [719 kB] 60s Get:38 http://ftpmaster.internal/ubuntu plucky-proposed/main amd64 python3-all amd64 3.12.7-1 [890 B] 60s Get:39 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-bytecode all 0.15.1-3 [44.7 kB] 60s Get:40 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-iniconfig all 1.1.1-2 [6024 B] 60s Get:41 http://ftpmaster.internal/ubuntu plucky/main amd64 python3-packaging all 24.1-1 [41.4 kB] 60s Get:42 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pluggy all 1.5.0-1 [21.0 kB] 60s Get:43 http://ftpmaster.internal/ubuntu plucky/universe amd64 python3-pytest all 8.3.3-1 [251 kB] 61s Fetched 76.7 MB in 2s (30.8 MB/s) 61s Selecting previously unselected package fonts-lato. 61s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75554 files and directories currently installed.) 61s Preparing to unpack .../00-fonts-lato_2.015-1_all.deb ... 61s Unpacking fonts-lato (2.015-1) ... 61s Selecting previously unselected package libpython3.13-minimal:amd64. 61s Preparing to unpack .../01-libpython3.13-minimal_3.13.0-2_amd64.deb ... 61s Unpacking libpython3.13-minimal:amd64 (3.13.0-2) ... 61s Selecting previously unselected package python3.13-minimal. 61s Preparing to unpack .../02-python3.13-minimal_3.13.0-2_amd64.deb ... 61s Unpacking python3.13-minimal (3.13.0-2) ... 61s Selecting previously unselected package libisl23:amd64. 61s Preparing to unpack .../03-libisl23_0.27-1_amd64.deb ... 61s Unpacking libisl23:amd64 (0.27-1) ... 61s Selecting previously unselected package libmpc3:amd64. 61s Preparing to unpack .../04-libmpc3_1.3.1-1build2_amd64.deb ... 61s Unpacking libmpc3:amd64 (1.3.1-1build2) ... 61s Selecting previously unselected package cpp-14-x86-64-linux-gnu. 61s Preparing to unpack .../05-cpp-14-x86-64-linux-gnu_14.2.0-8ubuntu1_amd64.deb ... 61s Unpacking cpp-14-x86-64-linux-gnu (14.2.0-8ubuntu1) ... 61s Selecting previously unselected package cpp-14. 61s Preparing to unpack .../06-cpp-14_14.2.0-8ubuntu1_amd64.deb ... 61s Unpacking cpp-14 (14.2.0-8ubuntu1) ... 61s Selecting previously unselected package cpp-x86-64-linux-gnu. 61s Preparing to unpack .../07-cpp-x86-64-linux-gnu_4%3a14.1.0-2ubuntu1_amd64.deb ... 61s Unpacking cpp-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 61s Selecting previously unselected package cpp. 61s Preparing to unpack .../08-cpp_4%3a14.1.0-2ubuntu1_amd64.deb ... 61s Unpacking cpp (4:14.1.0-2ubuntu1) ... 61s Selecting previously unselected package libcc1-0:amd64. 61s Preparing to unpack .../09-libcc1-0_14.2.0-8ubuntu1_amd64.deb ... 61s Unpacking libcc1-0:amd64 (14.2.0-8ubuntu1) ... 61s Selecting previously unselected package libgomp1:amd64. 61s Preparing to unpack .../10-libgomp1_14.2.0-8ubuntu1_amd64.deb ... 61s Unpacking libgomp1:amd64 (14.2.0-8ubuntu1) ... 61s Selecting previously unselected package libitm1:amd64. 61s Preparing to unpack .../11-libitm1_14.2.0-8ubuntu1_amd64.deb ... 61s Unpacking libitm1:amd64 (14.2.0-8ubuntu1) ... 61s Selecting previously unselected package libasan8:amd64. 61s Preparing to unpack .../12-libasan8_14.2.0-8ubuntu1_amd64.deb ... 61s Unpacking libasan8:amd64 (14.2.0-8ubuntu1) ... 61s Selecting previously unselected package liblsan0:amd64. 61s Preparing to unpack .../13-liblsan0_14.2.0-8ubuntu1_amd64.deb ... 61s Unpacking liblsan0:amd64 (14.2.0-8ubuntu1) ... 62s Selecting previously unselected package libtsan2:amd64. 62s Preparing to unpack .../14-libtsan2_14.2.0-8ubuntu1_amd64.deb ... 62s Unpacking libtsan2:amd64 (14.2.0-8ubuntu1) ... 62s Selecting previously unselected package libubsan1:amd64. 62s Preparing to unpack .../15-libubsan1_14.2.0-8ubuntu1_amd64.deb ... 62s Unpacking libubsan1:amd64 (14.2.0-8ubuntu1) ... 62s Selecting previously unselected package libhwasan0:amd64. 62s Preparing to unpack .../16-libhwasan0_14.2.0-8ubuntu1_amd64.deb ... 62s Unpacking libhwasan0:amd64 (14.2.0-8ubuntu1) ... 62s Selecting previously unselected package libquadmath0:amd64. 62s Preparing to unpack .../17-libquadmath0_14.2.0-8ubuntu1_amd64.deb ... 62s Unpacking libquadmath0:amd64 (14.2.0-8ubuntu1) ... 62s Selecting previously unselected package libgcc-14-dev:amd64. 62s Preparing to unpack .../18-libgcc-14-dev_14.2.0-8ubuntu1_amd64.deb ... 62s Unpacking libgcc-14-dev:amd64 (14.2.0-8ubuntu1) ... 62s Selecting previously unselected package gcc-14-x86-64-linux-gnu. 62s Preparing to unpack .../19-gcc-14-x86-64-linux-gnu_14.2.0-8ubuntu1_amd64.deb ... 62s Unpacking gcc-14-x86-64-linux-gnu (14.2.0-8ubuntu1) ... 62s Selecting previously unselected package gcc-14. 62s Preparing to unpack .../20-gcc-14_14.2.0-8ubuntu1_amd64.deb ... 62s Unpacking gcc-14 (14.2.0-8ubuntu1) ... 62s Selecting previously unselected package gcc-x86-64-linux-gnu. 62s Preparing to unpack .../21-gcc-x86-64-linux-gnu_4%3a14.1.0-2ubuntu1_amd64.deb ... 62s Unpacking gcc-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 62s Selecting previously unselected package gcc. 62s Preparing to unpack .../22-gcc_4%3a14.1.0-2ubuntu1_amd64.deb ... 62s Unpacking gcc (4:14.1.0-2ubuntu1) ... 62s Selecting previously unselected package libstdc++-14-dev:amd64. 62s Preparing to unpack .../23-libstdc++-14-dev_14.2.0-8ubuntu1_amd64.deb ... 62s Unpacking libstdc++-14-dev:amd64 (14.2.0-8ubuntu1) ... 62s Selecting previously unselected package g++-14-x86-64-linux-gnu. 62s Preparing to unpack .../24-g++-14-x86-64-linux-gnu_14.2.0-8ubuntu1_amd64.deb ... 62s Unpacking g++-14-x86-64-linux-gnu (14.2.0-8ubuntu1) ... 63s Selecting previously unselected package g++-14. 63s Preparing to unpack .../25-g++-14_14.2.0-8ubuntu1_amd64.deb ... 63s Unpacking g++-14 (14.2.0-8ubuntu1) ... 63s Selecting previously unselected package g++-x86-64-linux-gnu. 63s Preparing to unpack .../26-g++-x86-64-linux-gnu_4%3a14.1.0-2ubuntu1_amd64.deb ... 63s Unpacking g++-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 63s Selecting previously unselected package g++. 63s Preparing to unpack .../27-g++_4%3a14.1.0-2ubuntu1_amd64.deb ... 63s Unpacking g++ (4:14.1.0-2ubuntu1) ... 63s Selecting previously unselected package build-essential. 63s Preparing to unpack .../28-build-essential_12.10ubuntu1_amd64.deb ... 63s Unpacking build-essential (12.10ubuntu1) ... 63s Selecting previously unselected package fonts-font-awesome. 63s Preparing to unpack .../29-fonts-font-awesome_5.0.10+really4.7.0~dfsg-4.1_all.deb ... 63s Unpacking fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 63s Selecting previously unselected package libjs-jquery. 63s Preparing to unpack .../30-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 63s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 63s Selecting previously unselected package libjs-underscore. 63s Preparing to unpack .../31-libjs-underscore_1.13.4~dfsg+~1.11.4-3_all.deb ... 63s Unpacking libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 63s Selecting previously unselected package libjs-sphinxdoc. 63s Preparing to unpack .../32-libjs-sphinxdoc_7.4.7-4_all.deb ... 63s Unpacking libjs-sphinxdoc (7.4.7-4) ... 63s Selecting previously unselected package libpython3.13-stdlib:amd64. 63s Preparing to unpack .../33-libpython3.13-stdlib_3.13.0-2_amd64.deb ... 63s Unpacking libpython3.13-stdlib:amd64 (3.13.0-2) ... 63s Selecting previously unselected package sphinx-rtd-theme-common. 63s Preparing to unpack .../34-sphinx-rtd-theme-common_3.0.1+dfsg-1_all.deb ... 63s Unpacking sphinx-rtd-theme-common (3.0.1+dfsg-1) ... 63s Selecting previously unselected package python-bytecode-doc. 63s Preparing to unpack .../35-python-bytecode-doc_0.15.1-3_all.deb ... 63s Unpacking python-bytecode-doc (0.15.1-3) ... 63s Selecting previously unselected package python3.13. 63s Preparing to unpack .../36-python3.13_3.13.0-2_amd64.deb ... 63s Unpacking python3.13 (3.13.0-2) ... 63s Selecting previously unselected package python3-all. 63s Preparing to unpack .../37-python3-all_3.12.7-1_amd64.deb ... 63s Unpacking python3-all (3.12.7-1) ... 63s Selecting previously unselected package python3-bytecode. 63s Preparing to unpack .../38-python3-bytecode_0.15.1-3_all.deb ... 63s Unpacking python3-bytecode (0.15.1-3) ... 63s Selecting previously unselected package python3-iniconfig. 63s Preparing to unpack .../39-python3-iniconfig_1.1.1-2_all.deb ... 63s Unpacking python3-iniconfig (1.1.1-2) ... 63s Selecting previously unselected package python3-packaging. 63s Preparing to unpack .../40-python3-packaging_24.1-1_all.deb ... 63s Unpacking python3-packaging (24.1-1) ... 63s Selecting previously unselected package python3-pluggy. 63s Preparing to unpack .../41-python3-pluggy_1.5.0-1_all.deb ... 63s Unpacking python3-pluggy (1.5.0-1) ... 63s Selecting previously unselected package python3-pytest. 63s Preparing to unpack .../42-python3-pytest_8.3.3-1_all.deb ... 63s Unpacking python3-pytest (8.3.3-1) ... 63s Setting up python3-iniconfig (1.1.1-2) ... 63s Setting up fonts-lato (2.015-1) ... 63s Setting up libgomp1:amd64 (14.2.0-8ubuntu1) ... 63s Setting up libpython3.13-minimal:amd64 (3.13.0-2) ... 63s Setting up python3-packaging (24.1-1) ... 64s Setting up libquadmath0:amd64 (14.2.0-8ubuntu1) ... 64s Setting up python3-bytecode (0.15.1-3) ... 64s Setting up libmpc3:amd64 (1.3.1-1build2) ... 64s Setting up python3-pluggy (1.5.0-1) ... 64s Setting up libubsan1:amd64 (14.2.0-8ubuntu1) ... 64s Setting up libhwasan0:amd64 (14.2.0-8ubuntu1) ... 64s Setting up libasan8:amd64 (14.2.0-8ubuntu1) ... 64s Setting up python3.13-minimal (3.13.0-2) ... 65s Setting up libtsan2:amd64 (14.2.0-8ubuntu1) ... 65s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 65s Setting up libisl23:amd64 (0.27-1) ... 65s Setting up libpython3.13-stdlib:amd64 (3.13.0-2) ... 65s Setting up fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ... 65s Setting up sphinx-rtd-theme-common (3.0.1+dfsg-1) ... 65s Setting up libcc1-0:amd64 (14.2.0-8ubuntu1) ... 65s Setting up liblsan0:amd64 (14.2.0-8ubuntu1) ... 65s Setting up libitm1:amd64 (14.2.0-8ubuntu1) ... 65s Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ... 65s Setting up python3.13 (3.13.0-2) ... 65s Setting up python3-pytest (8.3.3-1) ... 66s Setting up python3-all (3.12.7-1) ... 66s Setting up cpp-14-x86-64-linux-gnu (14.2.0-8ubuntu1) ... 66s Setting up libjs-sphinxdoc (7.4.7-4) ... 66s Setting up cpp-14 (14.2.0-8ubuntu1) ... 66s Setting up libgcc-14-dev:amd64 (14.2.0-8ubuntu1) ... 66s Setting up libstdc++-14-dev:amd64 (14.2.0-8ubuntu1) ... 66s Setting up cpp-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 66s Setting up python-bytecode-doc (0.15.1-3) ... 66s Setting up cpp (4:14.1.0-2ubuntu1) ... 66s Setting up gcc-14-x86-64-linux-gnu (14.2.0-8ubuntu1) ... 66s Setting up gcc-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 66s Setting up gcc-14 (14.2.0-8ubuntu1) ... 66s Setting up g++-14-x86-64-linux-gnu (14.2.0-8ubuntu1) ... 66s Setting up g++-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 66s Setting up g++-14 (14.2.0-8ubuntu1) ... 66s Setting up gcc (4:14.1.0-2ubuntu1) ... 66s Setting up g++ (4:14.1.0-2ubuntu1) ... 66s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 66s Setting up build-essential (12.10ubuntu1) ... 66s Processing triggers for systemd (256.5-2ubuntu4) ... 66s Processing triggers for man-db (2.12.1-3) ... 66s Processing triggers for libc-bin (2.40-1ubuntu3) ... 69s Reading package lists... 69s Building dependency tree... 69s Reading state information... 69s Starting pkgProblemResolver with broken count: 0 69s Starting 2 pkgProblemResolver with broken count: 0 69s Done 69s The following NEW packages will be installed: 69s autopkgtest-satdep 69s 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 69s Need to get 0 B/700 B of archives. 69s After this operation, 0 B of additional disk space will be used. 69s Get:1 /tmp/autopkgtest.AL7vus/2-autopkgtest-satdep.deb autopkgtest-satdep amd64 0 [700 B] 70s Selecting previously unselected package autopkgtest-satdep. 70s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 77949 files and directories currently installed.) 70s Preparing to unpack .../2-autopkgtest-satdep.deb ... 70s Unpacking autopkgtest-satdep (0) ... 70s Setting up autopkgtest-satdep (0) ... 72s (Reading database ... 77949 files and directories currently installed.) 72s Removing autopkgtest-satdep (0) ... 72s autopkgtest [23:17:00]: test pytest: [----------------------- 72s Testing with python3.13: 73s ============================= test session starts ============================== 73s platform linux -- Python 3.13.0, pytest-8.3.3, pluggy-1.5.0 73s rootdir: /tmp/autopkgtest.AL7vus/autopkgtest_tmp 73s plugins: typeguard-4.4.1 73s collected 165 items 73s 73s tests/test_bytecode.py F..sFFFsFFF...F..F.F..F..Fsss.FF.F [ 20%] 75s tests/test_cfg.py ....F.........FF.FFFFF....FFFFFFFFFFFFFFFF [ 46%] 75s tests/test_code.py FFFFFF [ 49%] 76s tests/test_concrete.py FF.FF.F..FF..F.FFFF..FF..FFFFFsFFFFFFFFFFFFFFFF [ 78%] 76s tests/test_flags.py ..ss.. [ 81%] 76s tests/test_instr.py ......FF...............F [ 96%] 77s tests/test_misc.py .FF.F. [100%] 77s 77s =================================== FAILURES =================================== 77s _________________ BytecodeTests.test_cellvar_freevar_roundtrip _________________ 77s 77s self = 77s 77s def test_cellvar_freevar_roundtrip(self): 77s from . import cell_free_vars_cases as cfc 77s 77s def recompile_code_and_inner(code): 77s bytecode = Bytecode.from_code( 77s code, 77s conserve_exception_block_stackdepth=True, 77s ) 77s for instr in bytecode: 77s if isinstance(instr, Instr) and isinstance(instr.arg, types.CodeType): 77s instr.arg = recompile_code_and_inner(instr.arg) 77s as_code = bytecode.to_code( 77s stacksize=code.co_stacksize, 77s compute_exception_stack_depths=False, 77s ) 77s self.assertCodeObjectEqual(code, as_code) 77s return as_code 77s 77s for f in cfc.TEST_CASES: 77s print(f.__name__) 77s with self.subTest(f.__name__): 77s origin = f.__code__ 77s > f.__code__ = recompile_code_and_inner(origin) 77s 77s tests/test_bytecode.py:711: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_bytecode.py:693: in recompile_code_and_inner 77s bytecode = Bytecode.from_code( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 94 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ----------------------------- Captured stdout call ----------------------------- 77s simple_cellvar 77s ____________________________ BytecodeTests.test_eq _____________________________ 77s 77s self = 77s 77s def test_eq(self): 77s code = get_code( 77s """ 77s if test: 77s x = 1 77s else: 77s x = 2 77s """ 77s ) 77s > b1 = Bytecode.from_code(code) 77s 77s tests/test_bytecode.py:139: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________________________ BytecodeTests.test_eq_with_try ________________________ 77s 77s self = 77s 77s def test_eq_with_try(self): 77s code = get_code( 77s """ 77s try: 77s x = 1 77s except Exception: 77s pass 77s finally: 77s print() 77s """ 77s ) 77s > b1 = Bytecode.from_code(code) 77s 77s tests/test_bytecode.py:154: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________________ BytecodeTests.test_exception_table_round_trip _________________ 77s 77s self = 77s 77s def test_exception_table_round_trip(self): 77s from . import exception_handling_cases as ehc 77s 77s for f in ehc.TEST_CASES: 77s print(f.__name__) 77s with self.subTest(f.__name__): 77s origin = f.__code__ 77s > bytecode = Bytecode.from_code( 77s origin, 77s conserve_exception_block_stackdepth=True, 77s ) 77s 77s tests/test_bytecode.py:673: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ----------------------------- Captured stdout call ----------------------------- 77s try_except_group 77s _________________________ BytecodeTests.test_from_code _________________________ 77s 77s self = 77s 77s def test_from_code(self): 77s code = get_code( 77s """ 77s if test: 77s x = 1 77s else: 77s x = 2 77s """ 77s ) 77s > bytecode = Bytecode.from_code(code) 77s 77s tests/test_bytecode.py:167: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____________________ BytecodeTests.test_from_code_freevars _____________________ 77s 77s self = 77s 77s def test_from_code_freevars(self): 77s ns = {} 77s exec( 77s textwrap.dedent( 77s """ 77s def create_func(): 77s x = 1 77s def func(): 77s return x 77s return func 77s 77s func = create_func() 77s """ 77s ), 77s ns, 77s ns, 77s ) 77s code = ns["func"].__code__ 77s 77s > bytecode = Bytecode.from_code(code) 77s 77s tests/test_bytecode.py:259: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 62 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____________________ BytecodeTests.test_from_code_load_fast ____________________ 77s 77s self = 77s 77s def test_from_code_load_fast(self): 77s code = get_code( 77s """ 77s def func(): 77s x = 33 77s y = x 77s """, 77s function=True, 77s ) 77s > code = Bytecode.from_code(code) 77s 77s tests/test_bytecode.py:285: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __ BytecodeTests.test_negative_size_binary_with_disable_check_of_pre_and_post __ 77s 77s self = 77s 77s def test_negative_size_binary_with_disable_check_of_pre_and_post(self): 77s operations = ( 77s "SUBSCR", # Subscr is special 77s "POWER", 77s "MULTIPLY", 77s "MATRIX_MULTIPLY", 77s "FLOOR_DIVIDE", 77s "TRUE_DIVIDE", 77s "ADD", 77s "SUBTRACT", 77s "LSHIFT", 77s "RSHIFT", 77s "AND", 77s "XOR", 77s "OR", 77s ) 77s if sys.version_info >= (3, 11): 77s operations += ("REMAINDER",) 77s else: 77s operations += ("MODULO",) 77s 77s for opname in operations: 77s ops = (opname,) 77s if opname != "SUBSCR": 77s ops += ("INPLACE_" + opname,) 77s for op in ops: 77s with self.subTest(op): 77s code = Bytecode() 77s code.first_lineno = 1 77s if sys.version_info >= (3, 11): 77s if op == "SUBSCR": 77s i = Instr("BINARY_SUBSCR") 77s else: 77s i = Instr("BINARY_OP", getattr(BinaryOp, op)) 77s else: 77s if "INPLACE" not in op: 77s op = "BINARY_" + op 77s i = Instr(op) 77s 77s code.extend([Instr("LOAD_CONST", 1), i]) 77s > co = code.to_code(check_pre_and_post=False) 77s 77s tests/test_bytecode.py:493: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _ BytecodeTests.test_negative_size_build_const_map_with_disable_check_of_pre_and_post _ 77s 77s self = 77s 77s def test_negative_size_build_const_map_with_disable_check_of_pre_and_post(self): 77s code = Bytecode() 77s code.first_lineno = 1 77s code.extend([Instr("LOAD_CONST", ("a",)), Instr("BUILD_CONST_KEY_MAP", 1)]) 77s > co = code.to_code(check_pre_and_post=False) 77s 77s tests/test_bytecode.py:559: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _ BytecodeTests.test_negative_size_build_map_with_disable_check_of_pre_and_post _ 77s 77s self = 77s 77s def test_negative_size_build_map_with_disable_check_of_pre_and_post(self): 77s code = Bytecode() 77s code.first_lineno = 1 77s code.extend([Instr("LOAD_CONST", 1), Instr("BUILD_MAP", 1)]) 77s > co = code.to_code(check_pre_and_post=False) 77s 77s tests/test_bytecode.py:545: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __ BytecodeTests.test_negative_size_unary_with_disable_check_of_pre_and_post ___ 77s 77s self = 77s 77s def test_negative_size_unary_with_disable_check_of_pre_and_post(self): 77s opnames = ( 77s "UNARY_POSITIVE", 77s "UNARY_NEGATIVE", 77s "UNARY_NOT", 77s "UNARY_INVERT", 77s ) 77s for opname in opnames: 77s # Replaced by an intrinsic in 3.12 77s if sys.version_info >= (3, 12) and opname == "UNARY_POSITIVE": 77s continue 77s with self.subTest(opname): 77s code = Bytecode() 77s code.first_lineno = 1 77s code.extend([Instr(opname)]) 77s > co = code.to_code(check_pre_and_post=False) 77s 77s tests/test_bytecode.py:407: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 42 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____ BytecodeTests.test_not_enough_copy_with_disable_check_of_pre_and_post _____ 77s 77s self = 77s 77s def test_not_enough_copy_with_disable_check_of_pre_and_post(self): 77s if sys.version_info < (3, 11): 77s self.skipTest("Instruction COPY does not exist before 3.11") 77s code = Bytecode() 77s code.first_lineno = 1 77s code.extend([Instr("LOAD_CONST", 1), Instr("COPY", 2)]) 77s > co = code.to_code(check_pre_and_post=False) 77s 77s tests/test_bytecode.py:619: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____ BytecodeTests.test_not_enough_swap_with_disable_check_of_pre_and_post _____ 77s 77s self = 77s 77s def test_not_enough_swap_with_disable_check_of_pre_and_post(self): 77s if sys.version_info < (3, 11): 77s self.skipTest("Instruction SWAP does not exist before 3.11") 77s code = Bytecode() 77s code.first_lineno = 1 77s code.extend([Instr("LOAD_CONST", 1), Instr("SWAP", 2)]) 77s > co = code.to_code(check_pre_and_post=False) 77s 77s tests/test_bytecode.py:637: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _________________________ BytecodeTests.test_setlineno _________________________ 77s 77s self = 77s 77s def test_setlineno(self): 77s # x = 7 77s # y = 8 77s # z = 9 77s code = Bytecode() 77s code.first_lineno = 3 77s code.extend( 77s [ 77s Instr("LOAD_CONST", 7), 77s Instr("STORE_NAME", "x"), 77s SetLineno(4), 77s Instr("LOAD_CONST", 8), 77s Instr("STORE_NAME", "y"), 77s SetLineno(5), 77s Instr("LOAD_CONST", 9), 77s Instr("STORE_NAME", "z"), 77s ] 77s ) 77s 77s > concrete = code.to_concrete_bytecode() 77s 77s tests/test_bytecode.py:330: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __________________________ BytecodeTests.test_to_code __________________________ 77s 77s self = 77s 77s def test_to_code(self): 77s code = Bytecode() 77s code.first_lineno = 50 77s code.extend( 77s [ 77s Instr("LOAD_NAME", "print"), 77s Instr("LOAD_CONST", "%s"), 77s Instr( 77s "LOAD_GLOBAL", (False, "a") if sys.version_info >= (3, 11) else "a" 77s ), 77s Instr("BINARY_OP", BinaryOp.ADD) 77s if sys.version_info >= (3, 11) 77s else Instr("BINARY_ADD"), 77s ] 77s # For 3.12+ we need a NULL before a CALL to a free function 77s + ([Instr("PUSH_NULL")] if sys.version_info >= (3, 12) else []) 77s + [ 77s # On 3.11 we should have a pre-call 77s Instr("CALL" if sys.version_info >= (3, 11) else "CALL_FUNCTION", 1), 77s Instr("RETURN_VALUE"), 77s ] 77s ) 77s > co = code.to_code() 77s 77s tests/test_bytecode.py:367: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 92 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________________________ BytecodeBlocksTests.test_attr _________________________ 77s 77s self = 77s 77s def test_attr(self): 77s source = """ 77s first_line = 1 77s 77s def func(arg1, arg2, *, arg3): 77s x = 1 77s y = 2 77s return arg1 77s """ 77s > code = disassemble(source, filename="hello.py", function=True) 77s 77s tests/test_cfg.py:133: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:30: in disassemble 77s code = _disassemble(source, filename=filename, function=function) 77s tests/__init__.py:143: in disassemble 77s return Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____________________ BytecodeBlocksFunctionalTests.test_eq _____________________ 77s 77s self = 77s 77s def test_eq(self): 77s # compare codes with multiple blocks and labels, 77s # Code.__eq__() renumbers labels to get equal labels 77s source = "x = 1 if test else 2" 77s > code1 = disassemble(source) 77s 77s tests/test_cfg.py:480: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:30: in disassemble 77s code = _disassemble(source, filename=filename, function=function) 77s tests/__init__.py:143: in disassemble 77s return Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____________ BytecodeBlocksFunctionalTests.test_eq_with_try_except _____________ 77s 77s self = 77s 77s def test_eq_with_try_except(self): 77s source = "try:\n x = 1\nexcept Exception:\n pass\nfinally:\n print()" 77s > code1 = disassemble(source) 77s 77s tests/test_cfg.py:499: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:30: in disassemble 77s code = _disassemble(source, filename=filename, function=function) 77s tests/__init__.py:143: in disassemble 77s return Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________________ BytecodeBlocksFunctionalTests.test_split_block ________________ 77s 77s self = 77s 77s def test_split_block(self): 77s > code = self.sample_code() 77s 77s tests/test_cfg.py:528: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:517: in sample_code 77s code = disassemble("x = 1", remove_last_return_none=True) 77s tests/test_cfg.py:30: in disassemble 77s code = _disassemble(source, filename=filename, function=function) 77s tests/__init__.py:143: in disassemble 77s return Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __________ BytecodeBlocksFunctionalTests.test_split_block_dont_split ___________ 77s 77s self = 77s 77s def test_split_block_dont_split(self): 77s > code = self.sample_code() 77s 77s tests/test_cfg.py:581: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:517: in sample_code 77s code = disassemble("x = 1", remove_last_return_none=True) 77s tests/test_cfg.py:30: in disassemble 77s code = _disassemble(source, filename=filename, function=function) 77s tests/__init__.py:143: in disassemble 77s return Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ______________ BytecodeBlocksFunctionalTests.test_split_block_end ______________ 77s 77s self = 77s 77s def test_split_block_end(self): 77s > code = self.sample_code() 77s 77s tests/test_cfg.py:558: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:517: in sample_code 77s code = disassemble("x = 1", remove_last_return_none=True) 77s tests/test_cfg.py:30: in disassemble 77s code = _disassemble(source, filename=filename, function=function) 77s tests/__init__.py:143: in disassemble 77s return Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _____________ BytecodeBlocksFunctionalTests.test_split_block_error _____________ 77s 77s self = 77s 77s def test_split_block_error(self): 77s > code = self.sample_code() 77s 77s tests/test_cfg.py:591: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:517: in sample_code 77s code = disassemble("x = 1", remove_last_return_none=True) 77s tests/test_cfg.py:30: in disassemble 77s code = _disassemble(source, filename=filename, function=function) 77s tests/__init__.py:143: in disassemble 77s return Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __________________ BytecodeBlocksFunctionalTests.test_to_code __________________ 77s 77s self = 77s 77s def test_to_code(self): 77s # test resolution of jump labels 77s bytecode = ControlFlowGraph() 77s bytecode.first_lineno = 3 77s bytecode.argcount = 3 77s bytecode.posonlyargcount = 0 77s bytecode.kwonlyargcount = 2 77s bytecode.name = "func" 77s bytecode.filename = "hello.py" 77s bytecode.flags = 0x43 77s bytecode.argnames = ("arg", "arg2", "arg3", "kwonly", "kwonly2") 77s bytecode.docstring = None 77s block0 = bytecode[0] 77s block1 = bytecode.add_block() 77s block2 = bytecode.add_block() 77s block0.extend( 77s [ 77s Instr("LOAD_FAST", "x", lineno=4), 77s Instr( 77s "POP_JUMP_FORWARD_IF_FALSE" 77s if (3, 12) > sys.version_info >= (3, 11) 77s else "POP_JUMP_IF_FALSE", 77s block2, 77s lineno=4, 77s ), 77s ] 77s ) 77s block1.extend( 77s [Instr("LOAD_FAST", "arg", lineno=5), Instr("STORE_FAST", "x", lineno=5)] 77s ) 77s block2.extend( 77s [ 77s Instr("LOAD_CONST", 3, lineno=6), 77s Instr("STORE_FAST", "x", lineno=6), 77s Instr("LOAD_FAST", "x", lineno=7), 77s Instr("RETURN_VALUE", lineno=7), 77s ] 77s ) 77s 77s if sys.version_info >= (3, 11): 77s # jump is relative not absolute 77s expected = ( 77s b"|\x05" b"r\x02" b"|\x00" b"}\x05" b"d\x01" b"}\x05" b"|\x05" b"S\x00" 77s ) 77s elif OFFSET_AS_INSTRUCTION: 77s # The argument of the jump is divided by 2 77s expected = ( 77s b"|\x05" b"r\x04" b"|\x00" b"}\x05" b"d\x01" b"}\x05" b"|\x05" b"S\x00" 77s ) 77s else: 77s expected = ( 77s b"|\x05" b"r\x08" b"|\x00" b"}\x05" b"d\x01" b"}\x05" b"|\x05" b"S\x00" 77s ) 77s 77s > code = bytecode.to_code() 77s 77s tests/test_cfg.py:651: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/cfg.py:1057: in to_code 77s return bc.to_code( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 85 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _________ CFGStacksizeComputationTests.test_stack_size_computation_and _________ 77s 77s self = 77s 77s def test_stack_size_computation_and(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s return arg1 and args # Test JUMP_IF_FALSE_OR_POP 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:730: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __ CFGStacksizeComputationTests.test_stack_size_computation_for_loop_continue __ 77s 77s self = 77s 77s def test_stack_size_computation_for_loop_continue(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s for k in kwargs: 77s if k in args: 77s continue 77s else: 77s return 1 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:757: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _______ CFGStacksizeComputationTests.test_stack_size_computation_if_else _______ 77s 77s self = 77s 77s def test_stack_size_computation_if_else(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s if args: 77s return 0 77s elif kwargs: 77s return 1 77s else: 77s return 2 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:747: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _ CFGStacksizeComputationTests.test_stack_size_computation_nested_try_except_else_finally _ 77s 77s self = 77s 77s def test_stack_size_computation_nested_try_except_else_finally(self): 77s def test(*args, **kwargs): 77s try: 77s v = args[1] 77s except IndexError: 77s try: 77s w = kwargs["value"] 77s except KeyError: 77s return -1 77s else: 77s return w 77s finally: 77s print("second finally") 77s else: 77s return v 77s finally: 77s print("first finally") 77s 77s # A direct comparison of the stack depth fails because CPython 77s # generate dead code that is used in stack computation. 77s cpython_stacksize = test.__code__.co_stacksize 77s > test.__code__ = Bytecode.from_code(test.__code__).to_code() 77s 77s tests/test_cfg.py:856: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _ CFGStacksizeComputationTests.test_stack_size_computation_nested_try_except_finally _ 77s 77s self = 77s 77s def test_stack_size_computation_nested_try_except_finally(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s k = 1 77s try: 77s getattr(arg1, k) 77s except AttributeError: 77s pass 77s except Exception: 77s try: 77s assert False 77s except Exception: 77s return 2 77s finally: 77s print("unexpected") 77s finally: 77s print("attempted to get {}".format(k)) 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:833: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _________ CFGStacksizeComputationTests.test_stack_size_computation_or __________ 77s 77s self = 77s 77s def test_stack_size_computation_or(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s return arg1 or args # Test JUMP_IF_TRUE_OR_POP 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:736: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _____ CFGStacksizeComputationTests.test_stack_size_computation_try_except ______ 77s 77s self = 77s 77s def test_stack_size_computation_try_except(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s try: 77s return args[0] 77s except Exception: 77s return 2 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:781: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _ CFGStacksizeComputationTests.test_stack_size_computation_try_except_else_finally _ 77s 77s self = 77s 77s def test_stack_size_computation_try_except_else_finally(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s try: 77s return args[0] 77s except Exception: 77s return 2 77s else: 77s return arg1 77s finally: 77s print("Interrupt") 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:814: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _ CFGStacksizeComputationTests.test_stack_size_computation_try_except_finally __ 77s 77s self = 77s 77s def test_stack_size_computation_try_except_finally(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s try: 77s return args[0] 77s except Exception: 77s return 2 77s finally: 77s print("Interrupt") 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:801: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _____ CFGStacksizeComputationTests.test_stack_size_computation_try_finally _____ 77s 77s self = 77s 77s def test_stack_size_computation_try_finally(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s try: 77s return args[0] 77s finally: 77s return 2 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:790: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __ CFGStacksizeComputationTests.test_stack_size_computation_while_loop_break ___ 77s 77s self = 77s 77s def test_stack_size_computation_while_loop_break(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s while True: 77s if arg1: 77s break 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:765: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________ CFGStacksizeComputationTests.test_stack_size_computation_with _________ 77s 77s self = 77s 77s def test_stack_size_computation_with(self): 77s def test(arg1, *args, **kwargs): # pragma: no cover 77s with open(arg1) as f: 77s return f.read() 77s 77s > self.check_stack_size(test) 77s 77s tests/test_cfg.py:772: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:692: in check_stack_size 77s bytecode = Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _________ CFGStacksizeComputationTests.test_stack_size_with_dead_code __________ 77s 77s self = 77s 77s def test_stack_size_with_dead_code(self): 77s # Simply demonstrate more directly the previously mentioned issue. 77s def test(*args): # pragma: no cover 77s a = 0 77s return a 77s try: 77s a = args[0] 77s except IndexError: 77s return -1 77s else: 77s return a 77s 77s > test.__code__ = Bytecode.from_code(test.__code__).to_code() 77s 77s tests/test_cfg.py:882: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _________ CFGStacksizeComputationTests.test_stack_size_with_dead_code2 _________ 77s 77s self = 77s 77s def test_stack_size_with_dead_code2(self): 77s # See GH #118 77s source = """ 77s try: 77s pass 77s except Exception as e: 77s pass 77s """ 77s source = textwrap.dedent(source).strip() 77s code = compile(source, "", "exec") 77s > bytecode = Bytecode.from_code(code) 77s 77s tests/test_cfg.py:896: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _______________ CFGRoundTripTests.test_cellvar_freevar_roundtrip _______________ 77s 77s self = 77s 77s def test_cellvar_freevar_roundtrip(self): 77s from . import cell_free_vars_cases as cfc 77s 77s def recompile_code_and_inner(code): 77s cfg = ControlFlowGraph.from_bytecode(Bytecode.from_code(code)) 77s for block in cfg: 77s for instr in block: 77s if isinstance(instr.arg, types.CodeType): 77s instr.arg = recompile_code_and_inner(instr.arg) 77s as_code = cfg.to_code() 77s self.assertCodeObjectEqual(code, as_code) 77s return as_code 77s 77s for f in cfc.TEST_CASES: 77s print(f.__name__) 77s with self.subTest(f.__name__): 77s origin = f.__code__ 77s > f.__code__ = recompile_code_and_inner(origin) 77s 77s tests/test_cfg.py:980: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_cfg.py:967: in recompile_code_and_inner 77s cfg = ControlFlowGraph.from_bytecode(Bytecode.from_code(code)) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 94 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ----------------------------- Captured stdout call ----------------------------- 77s simple_cellvar 77s _____________ CFGRoundTripTests.test_roundtrip_exception_handling ______________ 77s 77s self = 77s 77s def test_roundtrip_exception_handling(self): 77s from . import exception_handling_cases as ehc 77s 77s for f in ehc.TEST_CASES: 77s # 3.12 use one less exception table entry causing to optimize this case 77s # less than we could otherwise 77s if sys.version_info >= (3, 12) and f.__name__ == "try_except_finally": 77s continue 77s print(f.__name__) 77s with self.subTest(f.__name__): 77s origin = f.__code__ 77s print("Bytecode:") 77s > bytecode = Bytecode.from_code( 77s f.__code__, conserve_exception_block_stackdepth=True 77s ) 77s 77s tests/test_cfg.py:947: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ----------------------------- Captured stdout call ----------------------------- 77s try_except_group 77s Bytecode: 77s __________________________ CodeTests.test_async_func ___________________________ 77s 77s self = 77s 77s def test_async_func(self): 77s > self.check( 77s """ 77s async def func(arg, arg2): 77s pass 77s """, 77s function=True, 77s ) 77s 77s tests/test_code.py:79: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_code.py:14: in check 77s code = ConcreteBytecode.from_code(ref_code).to_code() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 35 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________________________ CodeTests.test_generator_func _________________________ 77s 77s self = 77s 77s def test_generator_func(self): 77s > self.check( 77s """ 77s def func(arg, arg2): 77s yield 77s """, 77s function=True, 77s ) 77s 77s tests/test_code.py:70: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_code.py:14: in check 77s code = ConcreteBytecode.from_code(ref_code).to_code() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 35 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____________________________ CodeTests.test_kwargs _____________________________ 77s 77s self = 77s 77s def test_kwargs(self): 77s > self.check( 77s """ 77s def func(a, b, **kwargs): 77s pass 77s """, 77s function=True, 77s ) 77s 77s tests/test_code.py:50: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_code.py:14: in check 77s code = ConcreteBytecode.from_code(ref_code).to_code() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __________________________ CodeTests.test_kwonlyargs ___________________________ 77s 77s self = 77s 77s def test_kwonlyargs(self): 77s > self.check( 77s """ 77s def func(*, arg, arg2): 77s pass 77s """, 77s function=True, 77s ) 77s 77s tests/test_code.py:59: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_code.py:14: in check 77s code = ConcreteBytecode.from_code(ref_code).to_code() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _____________________________ CodeTests.test_loop ______________________________ 77s 77s self = 77s 77s def test_loop(self): 77s > self.check( 77s """ 77s for x in range(1, 10): 77s x += 1 77s if x == 3: 77s continue 77s x -= 1 77s if x > 7: 77s break 77s x = 0 77s print(x) 77s """ 77s ) 77s 77s tests/test_code.py:26: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_code.py:14: in check 77s code = ConcreteBytecode.from_code(ref_code).to_code() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____________________________ CodeTests.test_varargs ____________________________ 77s 77s self = 77s 77s def test_varargs(self): 77s > self.check( 77s """ 77s def func(a, b, *varargs): 77s pass 77s """, 77s function=True, 77s ) 77s 77s tests/test_code.py:41: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_code.py:14: in check 77s code = ConcreteBytecode.from_code(ref_code).to_code() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _______________________ ConcreteInstrTests.test_assemble _______________________ 77s 77s self = 77s 77s def test_assemble(self): 77s instr = ConcreteInstr("NOP") 77s > self.assertEqual(instr.assemble(), b"\t\x00") 77s E AssertionError: b'\x1e\x00' != b'\t\x00' 77s 77s tests/test_concrete.py:146: AssertionError 77s _________________________ ConcreteInstrTests.test_attr _________________________ 77s 77s self = 77s 77s def test_attr(self): 77s instr = ConcreteInstr("LOAD_CONST", 5, lineno=12) 77s self.assertEqual(instr.name, "LOAD_CONST") 77s > self.assertEqual(instr.opcode, 100) 77s E AssertionError: 83 != 100 77s 77s tests/test_concrete.py:63: AssertionError 77s _____________________ ConcreteInstrTests.test_disassemble ______________________ 77s 77s self = 77s 77s def test_disassemble(self): 77s code = b"\t\x00d\x03" 77s instr = ConcreteInstr.disassemble(1, code, 0) 77s > self.assertEqual(instr, ConcreteInstr("NOP", lineno=1)) 77s E AssertionError: != 77s 77s tests/test_concrete.py:134: AssertionError 77s ___________________ ConcreteInstrTests.test_get_jump_target ____________________ 77s 77s self = 77s 77s def test_get_jump_target(self): 77s if sys.version_info < (3, 11): 77s jump_abs = ConcreteInstr("JUMP_ABSOLUTE", 3) 77s self.assertEqual(jump_abs.get_jump_target(100), 3) 77s 77s jump_forward = ConcreteInstr("JUMP_FORWARD", 5) 77s self.assertEqual( 77s > jump_forward.get_jump_target(10), 16 if OFFSET_AS_INSTRUCTION else 17 77s ) 77s 77s tests/test_concrete.py:170: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 79 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _______________________ ConcreteInstrTests.test_set_attr _______________________ 77s 77s self = 77s 77s def test_set_attr(self): 77s instr = ConcreteInstr("LOAD_CONST", 5, lineno=12) 77s 77s # operator name 77s instr.name = "LOAD_FAST" 77s self.assertEqual(instr.name, "LOAD_FAST") 77s > self.assertEqual(instr.opcode, 124) 77s E AssertionError: 85 != 124 77s 77s tests/test_concrete.py:93: AssertionError 77s ______________________ ConcreteBytecodeTests.test_cellvar ______________________ 77s 77s self = 77s 77s def test_cellvar(self): 77s concrete = ConcreteBytecode() 77s concrete.cellvars = ["x"] 77s concrete.append(ConcreteInstr("LOAD_DEREF", 0)) 77s > code = concrete.to_code() 77s 77s tests/test_concrete.py:469: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 84 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __________________ ConcreteBytecodeTests.test_cellvar_freevar __________________ 77s 77s self = 77s 77s def test_cellvar_freevar(self): 77s concrete = ConcreteBytecode() 77s concrete.cellvars = ["cell"] 77s concrete.freevars = ["free"] 77s concrete.append(ConcreteInstr("LOAD_DEREF", 0)) 77s concrete.append(ConcreteInstr("LOAD_DEREF", 1)) 77s > code = concrete.to_code() 77s 77s tests/test_concrete.py:509: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 84 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________________________ ConcreteBytecodeTests.test_eq _________________________ 77s 77s self = 77s 77s def test_eq(self): 77s code = ConcreteBytecode() 77s self.assertFalse(code == 1) 77s 77s for name, val in ( 77s ("names", ["a"]), 77s ("varnames", ["a"]), 77s ("consts", [1]), 77s ("argcount", 1), 77s ("kwonlyargcount", 2), 77s ("flags", CompilerFlags(CompilerFlags.GENERATOR)), 77s ("first_lineno", 10), 77s ("filename", "xxxx.py"), 77s ("name", "__x"), 77s ("docstring", "x-x-x"), 77s ("cellvars", [CellVar("x")]), 77s ("freevars", [FreeVar("x")]), 77s ): 77s c = ConcreteBytecode() 77s setattr(c, name, val) 77s # For obscure reasons using assertNotEqual here fail 77s self.assertFalse(code == c) 77s 77s c = ConcreteBytecode() 77s c.posonlyargcount = 10 77s self.assertFalse(code == c) 77s 77s c = ConcreteBytecode() 77s c.consts = [1] 77s code.consts = [1] 77s c.append(ConcreteInstr("LOAD_CONST", 0)) 77s > self.assertFalse(code == c) 77s 77s tests/test_concrete.py:225: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:320: in __eq__ 77s return super().__eq__(other) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:91: in __eq__ 77s if self.compute_stacksize() != other.compute_stacksize(): 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:846: in compute_stacksize 77s bytecode = self.to_bytecode() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________________ ConcreteBytecodeTests.test_explicit_stacksize _________________ 77s 77s self = 77s 77s def test_explicit_stacksize(self): 77s # Passing stacksize=... to ConcreteBytecode.to_code should result in a 77s # code object with the specified stacksize. We pass some silly values 77s # and assert that they are honored. 77s code_obj = get_code("print('%s' % (a,b,c))") 77s original_stacksize = code_obj.co_stacksize 77s concrete = ConcreteBytecode.from_code(code_obj) 77s 77s # First with something bigger than necessary. 77s explicit_stacksize = original_stacksize + 42 77s new_code_obj = concrete.to_code( 77s stacksize=explicit_stacksize, compute_exception_stack_depths=False 77s ) 77s self.assertEqual(new_code_obj.co_stacksize, explicit_stacksize) 77s 77s # Then with something bogus. We probably don't want to advertise this 77s # in the documentation. If this fails then decide if it's for good 77s # reason, and remove if so. 77s explicit_stacksize = 0 77s new_code_obj = concrete.to_code( 77s stacksize=explicit_stacksize, compute_exception_stack_depths=False 77s ) 77s > self.assertEqual(new_code_obj.co_stacksize, explicit_stacksize) 77s E AssertionError: 1 != 0 77s 77s tests/test_concrete.py:614: AssertionError 77s __________________ ConcreteBytecodeTests.test_extended_lnotab __________________ 77s 77s self = 77s 77s def test_extended_lnotab(self): 77s # x = 7 77s # 200 blank lines 77s # y = 8 77s concrete = ConcreteBytecode( 77s [ 77s ConcreteInstr("LOAD_CONST", 0), 77s SetLineno(1 + 128), 77s ConcreteInstr("STORE_NAME", 0), 77s # line number goes backward! 77s SetLineno(1 + 129), 77s ConcreteInstr("LOAD_CONST", 1), 77s SetLineno(1), 77s ConcreteInstr("STORE_NAME", 1), 77s ] 77s ) 77s concrete.consts = [7, 8] 77s concrete.names = ["x", "y"] 77s concrete.first_lineno = 1 77s 77s > code = concrete.to_code() 77s 77s tests/test_concrete.py:365: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _________________ ConcreteBytecodeTests.test_extended_lnotab2 __________________ 77s 77s self = 77s 77s def test_extended_lnotab2(self): 77s # x = 7 77s # 200 blank lines 77s # y = 8 77s base_code = compile("x = 7" + "\n" * 200 + "y = 8", "", "exec") 77s concrete = ConcreteBytecode( 77s ( 77s [ConcreteInstr("RESUME", 0, lineno=0), SetLineno(1)] 77s if sys.version_info >= (3, 11) 77s else [] 77s ) 77s + [ 77s ConcreteInstr("LOAD_CONST", 0), 77s ConcreteInstr("STORE_NAME", 0), 77s SetLineno(201), 77s ConcreteInstr("LOAD_CONST", 1), 77s ConcreteInstr("STORE_NAME", 1), 77s ] 77s + ( 77s [ConcreteInstr("RETURN_CONST", 2)] 77s if sys.version_info >= (3, 12) 77s else [ 77s ConcreteInstr("LOAD_CONST", 2), 77s ConcreteInstr("RETURN_VALUE"), 77s ] 77s ) 77s ) 77s concrete.consts = [None, 7, 8] 77s concrete.names = ["x", "y"] 77s concrete.first_lineno = 1 77s 77s > code = concrete.to_code() 77s 77s tests/test_concrete.py:415: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ______________________ ConcreteBytecodeTests.test_freevar ______________________ 77s 77s self = 77s 77s def test_freevar(self): 77s concrete = ConcreteBytecode() 77s concrete.freevars = ["x"] 77s concrete.append(ConcreteInstr("LOAD_DEREF", 0)) 77s > code = concrete.to_code() 77s 77s tests/test_concrete.py:488: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 84 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __________________ ConcreteBytecodeTests.test_load_classderef __________________ 77s 77s self = 77s 77s def test_load_classderef(self): 77s i_name = ( 77s "LOAD_FROM_DICT_OR_DEREF" 77s if sys.version_info >= (3, 12) 77s else "LOAD_CLASSDEREF" 77s ) 77s i_arg = 2 if sys.version_info >= (3, 11) else 1 77s concrete = ConcreteBytecode() 77s concrete.varnames = ["a"] 77s concrete.cellvars = ["__class__"] 77s concrete.freevars = ["__class__"] 77s concrete.extend( 77s [ 77s ConcreteInstr("LOAD_FAST", 0, lineno=1), 77s ConcreteInstr(i_name, i_arg, lineno=1), 77s ConcreteInstr("STORE_DEREF", i_arg, lineno=1), 77s ] 77s ) 77s 77s > bytecode = concrete.to_bytecode() 77s 77s tests/test_concrete.py:551: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 85 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __________________ ConcreteBytecodeTests.test_negative_lnotab __________________ 77s 77s self = 77s 77s def test_negative_lnotab(self): 77s # x = 7 77s # y = 8 77s concrete = ConcreteBytecode( 77s [ 77s ConcreteInstr("LOAD_CONST", 0), 77s ConcreteInstr("STORE_NAME", 0), 77s # line number goes backward! 77s SetLineno(2), 77s ConcreteInstr("LOAD_CONST", 1), 77s ConcreteInstr("STORE_NAME", 1), 77s ] 77s ) 77s concrete.consts = [7, 8] 77s concrete.names = ["x", "y"] 77s concrete.first_lineno = 5 77s 77s > code = concrete.to_code() 77s 77s tests/test_concrete.py:337: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________________ ConcreteBytecodeTests.test_to_bytecode_consts _________________ 77s 77s self = 77s 77s def test_to_bytecode_consts(self): 77s # x = -0.0 77s # x = +0.0 77s # 77s # code optimized by the CPython 3.6 peephole optimizer which emits 77s # duplicated constants (0.0 is twice in consts). 77s code = ConcreteBytecode() 77s code.consts = [0.0, None, -0.0, 0.0] 77s code.names = ["x", "y"] 77s code.extend( 77s [ 77s ConcreteInstr("LOAD_CONST", 2, lineno=1), 77s ConcreteInstr("STORE_NAME", 0, lineno=1), 77s ConcreteInstr("LOAD_CONST", 3, lineno=2), 77s ConcreteInstr("STORE_NAME", 1, lineno=2), 77s ConcreteInstr("LOAD_CONST", 1, lineno=2), 77s ConcreteInstr("RETURN_VALUE", lineno=2), 77s ] 77s ) 77s 77s > code = code.to_bytecode().to_concrete_bytecode() 77s 77s tests/test_concrete.py:448: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __________________ ConcreteBytecodeTests.test_to_code_lnotab ___________________ 77s 77s self = 77s 77s def test_to_code_lnotab(self): 77s # We use an actual function for the simple case to 77s # ensure we get lnotab right 77s def f(): 77s # 77s # 77s x = 7 # noqa 77s y = 8 # noqa 77s z = 9 # noqa 77s 77s fl = f.__code__.co_firstlineno 77s concrete = ConcreteBytecode() 77s concrete.consts = [None, 7, 8, 9] 77s concrete.varnames = ["x", "y", "z"] 77s concrete.first_lineno = fl 77s concrete.extend( 77s ( 77s [ConcreteInstr("RESUME", 0), SetLineno(1)] 77s if sys.version_info >= (3, 11) 77s else [] 77s ) 77s + [ 77s SetLineno(fl + 3), 77s ConcreteInstr("LOAD_CONST", 1), 77s ConcreteInstr("STORE_FAST", 0), 77s SetLineno(fl + 4), 77s ConcreteInstr("LOAD_CONST", 2), 77s ConcreteInstr("STORE_FAST", 1), 77s SetLineno(fl + 5), 77s ConcreteInstr("LOAD_CONST", 3), 77s ConcreteInstr("STORE_FAST", 2), 77s ] 77s + ( 77s [ConcreteInstr("RETURN_CONST", 0)] 77s if sys.version_info >= (3, 12) 77s else [ 77s ConcreteInstr("LOAD_CONST", 0), 77s ConcreteInstr("RETURN_VALUE"), 77s ] 77s ) 77s ) 77s 77s > code = concrete.to_code() 77s 77s tests/test_concrete.py:308: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _____________ ConcreteFromCodeTests.test_cellvar_freevar_roundtrip _____________ 77s 77s self = 77s 77s def test_cellvar_freevar_roundtrip(self): 77s from . import cell_free_vars_cases as cfc 77s 77s def recompile_code_and_inner(code): 77s concrete = ConcreteBytecode.from_code(code) 77s for i, c in enumerate(concrete.consts): 77s if isinstance(c, types.CodeType): 77s concrete.consts[i] = recompile_code_and_inner(c) 77s as_code = concrete.to_code( 77s stacksize=code.co_stacksize, compute_exception_stack_depths=False 77s ) 77s self.assertCodeObjectEqual(code, as_code) 77s return as_code 77s 77s for f in cfc.TEST_CASES: 77s print(f.__name__) 77s with self.subTest(f.__name__): 77s origin = f.__code__ 77s > f.__code__ = recompile_code_and_inner(origin) 77s 77s tests/test_concrete.py:1323: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/test_concrete.py:1312: in recompile_code_and_inner 77s concrete.consts[i] = recompile_code_and_inner(c) 77s tests/test_concrete.py:1316: in recompile_code_and_inner 77s self.assertCodeObjectEqual(code, as_code) 77s tests/__init__.py:171: in assertCodeObjectEqual 77s self.assertSequenceEqual( 77s E AssertionError: Sequences differ: [(Non[63 chars], 19, 20), (25, 25, 15, 20), (25, 25, 15, 20), (25, 25, 8, 20)] != [(Non[63 chars], 19, 20), (25, 25, 15, 20), (25, 25, 8, 20)] 77s E 77s E First differing element 5: 77s E (25, 25, 15, 20) 77s E (25, 25, 8, 20) 77s E 77s E First sequence contains 1 additional elements. 77s E First extra element 6: 77s E (25, 25, 8, 20) 77s E 77s E [(None, None, None, None), 77s E (24, 24, 0, 0), 77s E (25, 25, 15, 16), 77s E (25, 25, 19, 20), 77s E (25, 25, 15, 20), 77s E - (25, 25, 15, 20), 77s E (25, 25, 8, 20)] 77s ----------------------------- Captured stdout call ----------------------------- 77s simple_cellvar 77s cellvar_share_name 77s cellvar_shared_and_unshared 77s ____________ ConcreteFromCodeTests.test_exception_table_round_trip _____________ 77s 77s self = 77s 77s def test_exception_table_round_trip(self): 77s from . import exception_handling_cases as ehc 77s 77s for f in ehc.TEST_CASES: 77s print(f.__name__) 77s with self.subTest(f.__name__): 77s origin = f.__code__ 77s concrete = ConcreteBytecode.from_code(f.__code__) 77s as_code = concrete.to_code( 77s stacksize=f.__code__.co_stacksize, 77s compute_exception_stack_depths=False, 77s ) 77s > self.assertCodeObjectEqual(origin, as_code) 77s 77s tests/test_concrete.py:1297: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/__init__.py:171: in assertCodeObjectEqual 77s self.assertSequenceEqual( 77s E AssertionError: Sequences differ: [(2, [157 chars] (5, 5, 12, 22), (5, 5, 12, 22), (5, 5, 12, 22[783 chars]one)] != [(2, [157 chars] (5, 6, 4, 21), (5, 6, 4, 21), (5, 6, 4, 21), [566 chars]one)] 77s E 77s E First differing element 10: 77s E (5, 5, 12, 22) 77s E (5, 6, 4, 21) 77s E 77s E First sequence contains 13 additional elements. 77s E First extra element 40: 77s E (None, None, None, None) 77s E 77s E Diff is 1155 characters long. Set self.maxDiff to None to see it. 77s ----------------------------- Captured stdout call ----------------------------- 77s try_except_group 77s ___________ ConcreteFromCodeTests.test_expected_arg_with_many_consts ___________ 77s 77s self = 77s 77s def test_expected_arg_with_many_consts(self): 77s def test(): 77s var = 0 77s var = 1 77s var = 2 77s var = 3 77s var = 4 77s var = 5 77s var = 6 77s var = 7 77s var = 8 77s var = 9 77s var = 10 77s var = 11 77s var = 12 77s var = 13 77s var = 14 77s var = 15 77s var = 16 77s var = 17 77s var = 18 77s var = 19 77s var = 20 77s var = 21 77s var = 22 77s var = 23 77s var = 24 77s var = 25 77s var = 26 77s var = 27 77s var = 28 77s var = 29 77s var = 30 77s var = 31 77s var = 32 77s var = 33 77s var = 34 77s var = 35 77s var = 36 77s var = 37 77s var = 38 77s var = 39 77s var = 40 77s var = 41 77s var = 42 77s var = 43 77s var = 44 77s var = 45 77s var = 46 77s var = 47 77s var = 48 77s var = 49 77s var = 50 77s var = 51 77s var = 52 77s var = 53 77s var = 54 77s var = 55 77s var = 56 77s var = 57 77s var = 58 77s var = 59 77s var = 60 77s var = 61 77s var = 62 77s var = 63 77s var = 64 77s var = 65 77s var = 66 77s var = 67 77s var = 68 77s var = 69 77s var = 70 77s var = 71 77s var = 72 77s var = 73 77s var = 74 77s var = 75 77s var = 76 77s var = 77 77s var = 78 77s var = 79 77s var = 80 77s var = 81 77s var = 82 77s var = 83 77s var = 84 77s var = 85 77s var = 86 77s var = 87 77s var = 88 77s var = 89 77s var = 90 77s var = 91 77s var = 92 77s var = 93 77s var = 94 77s var = 95 77s var = 96 77s var = 97 77s var = 98 77s var = 99 77s var = 100 77s var = 101 77s var = 102 77s var = 103 77s var = 104 77s var = 105 77s var = 106 77s var = 107 77s var = 108 77s var = 109 77s var = 110 77s var = 111 77s var = 112 77s var = 113 77s var = 114 77s var = 115 77s var = 116 77s var = 117 77s var = 118 77s var = 119 77s var = 120 77s var = 121 77s var = 122 77s var = 123 77s var = 124 77s var = 125 77s var = 126 77s var = 127 77s var = 128 77s var = 129 77s var = 130 77s var = 131 77s var = 132 77s var = 133 77s var = 134 77s var = 135 77s var = 136 77s var = 137 77s var = 138 77s var = 139 77s var = 140 77s var = 141 77s var = 142 77s var = 143 77s var = 144 77s var = 145 77s var = 146 77s var = 147 77s var = 148 77s var = 149 77s var = 150 77s var = 151 77s var = 152 77s var = 153 77s var = 154 77s var = 155 77s var = 156 77s var = 157 77s var = 158 77s var = 159 77s var = 160 77s var = 161 77s var = 162 77s var = 163 77s var = 164 77s var = 165 77s var = 166 77s var = 167 77s var = 168 77s var = 169 77s var = 170 77s var = 171 77s var = 172 77s var = 173 77s var = 174 77s var = 175 77s var = 176 77s var = 177 77s var = 178 77s var = 179 77s var = 180 77s var = 181 77s var = 182 77s var = 183 77s var = 184 77s var = 185 77s var = 186 77s var = 187 77s var = 188 77s var = 189 77s var = 190 77s var = 191 77s var = 192 77s var = 193 77s var = 194 77s var = 195 77s var = 196 77s var = 197 77s var = 198 77s var = 199 77s var = 200 77s var = 201 77s var = 202 77s var = 203 77s var = 204 77s var = 205 77s var = 206 77s var = 207 77s var = 208 77s var = 209 77s var = 210 77s var = 211 77s var = 212 77s var = 213 77s var = 214 77s var = 215 77s var = 216 77s var = 217 77s var = 218 77s var = 219 77s var = 220 77s var = 221 77s var = 222 77s var = 223 77s var = 224 77s var = 225 77s var = 226 77s var = 227 77s var = 228 77s var = 229 77s var = 230 77s var = 231 77s var = 232 77s var = 233 77s var = 234 77s var = 235 77s var = 236 77s var = 237 77s var = 238 77s var = 239 77s var = 240 77s var = 241 77s var = 242 77s var = 243 77s var = 244 77s var = 245 77s var = 246 77s var = 247 77s var = 248 77s var = 249 77s var = 250 77s var = 251 77s var = 252 77s var = 253 77s var = 254 77s var = 255 77s var = 256 77s var = 257 77s var = 258 77s var = 259 77s 77s return var 77s 77s test.__code__ = ConcreteBytecode.from_code( 77s test.__code__, extended_arg=True 77s > ).to_code() 77s 77s tests/test_concrete.py:1187: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____________ ConcreteFromCodeTests.test_extended_arg_make_function _____________ 77s 77s self = 77s 77s def test_extended_arg_make_function(self): 77s if (3, 9) <= sys.version_info < (3, 10): 77s from .util_annotation import get_code as get_code_future 77s 77s code_obj = get_code_future( 77s """ 77s def foo(x: int, y: int): 77s pass 77s """ 77s ) 77s else: 77s code_obj = get_code( 77s """ 77s def foo(x: int, y: int): 77s pass 77s """ 77s ) 77s 77s # without EXTENDED_ARG 77s concrete = ConcreteBytecode.from_code(code_obj) 77s if sys.version_info >= (3, 11): 77s func_code = concrete.consts[2] 77s names = ["int", "foo"] 77s consts = ["x", "y", func_code, None] 77s const_offset = 1 77s name_offset = 1 77s first_instrs = [ 77s ConcreteInstr("LOAD_CONST", 0, lineno=1), 77s ConcreteInstr("LOAD_NAME", 0, lineno=1), 77s ConcreteInstr("LOAD_CONST", 1, lineno=1), 77s ConcreteInstr("LOAD_NAME", 0, lineno=1), 77s ConcreteInstr("BUILD_TUPLE", 4, lineno=1), 77s ] 77s elif sys.version_info >= (3, 10): 77s func_code = concrete.consts[2] 77s names = ["int", "foo"] 77s consts = ["x", "y", func_code, "foo", None] 77s const_offset = 1 77s name_offset = 1 77s first_instrs = [ 77s ConcreteInstr("LOAD_CONST", 0, lineno=1), 77s ConcreteInstr("LOAD_NAME", 0, lineno=1), 77s ConcreteInstr("LOAD_CONST", 1, lineno=1), 77s ConcreteInstr("LOAD_NAME", 0, lineno=1), 77s ConcreteInstr("BUILD_TUPLE", 4, lineno=1), 77s ] 77s elif ( 77s sys.version_info >= (3, 7) 77s and concrete.flags & CompilerFlags.FUTURE_ANNOTATIONS 77s ): 77s func_code = concrete.consts[2] 77s names = ["foo"] 77s consts = ["int", ("x", "y"), func_code, "foo", None] 77s const_offset = 1 77s name_offset = 0 77s first_instrs = [ 77s ConcreteInstr("LOAD_CONST", 0, lineno=1), 77s ConcreteInstr("LOAD_CONST", 0, lineno=1), 77s ConcreteInstr("LOAD_CONST", 0 + const_offset, lineno=1), 77s ConcreteInstr("BUILD_CONST_KEY_MAP", 2, lineno=1), 77s ] 77s else: 77s func_code = concrete.consts[1] 77s names = ["int", "foo"] 77s consts = [("x", "y"), func_code, "foo", None] 77s const_offset = 0 77s name_offset = 1 77s first_instrs = [ 77s ConcreteInstr("LOAD_NAME", 0, lineno=1), 77s ConcreteInstr("LOAD_NAME", 0, lineno=1), 77s ConcreteInstr("LOAD_CONST", 0 + const_offset, lineno=1), 77s ConcreteInstr("BUILD_CONST_KEY_MAP", 2, lineno=1), 77s ] 77s 77s self.assertSequenceEqual(concrete.names, names) 77s self.assertSequenceEqual(concrete.consts, consts) 77s expected = ( 77s first_instrs 77s + [ 77s ConcreteInstr("LOAD_CONST", 1 + const_offset, lineno=1), 77s ConcreteInstr("LOAD_CONST", 2 + const_offset, lineno=1), 77s > ConcreteInstr("MAKE_FUNCTION", 4, lineno=1), 77s ConcreteInstr("STORE_NAME", name_offset, lineno=1), 77s ] 77s + ( 77s [ConcreteInstr("RETURN_CONST", 3 + const_offset, lineno=1)] 77s if sys.version_info >= (3, 12) 77s else [ 77s ConcreteInstr("LOAD_CONST", 3 + const_offset, lineno=1), 77s ConcreteInstr("RETURN_VALUE", lineno=1), 77s ] 77s ) 77s ) 77s 77s tests/test_concrete.py:816: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:99: in __init__ 77s super().__init__(name, arg, lineno=lineno, location=location, offset=offset) 77s /usr/lib/python3/dist-packages/bytecode/instr.py:537: in __init__ 77s self._set(name, arg) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:120: in _set 77s super()._set(name, arg) 77s /usr/lib/python3/dist-packages/bytecode/instr.py:747: in _set 77s self._check_arg(name, opcode, arg) 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = <[AttributeError("'bytecode.concrete.ConcreteInstr' object has no attribute '_arg'") raised in repr()] ConcreteInstr object at 0x7de525734520> 77s name = 'MAKE_FUNCTION', opcode = 26, arg = 4 77s 77s def _check_arg(self, name: str, opcode: int, arg: int) -> None: 77s if opcode_has_argument(opcode): 77s if arg is UNSET: 77s raise ValueError("operation %s requires an argument" % name) 77s 77s _check_arg_int(arg, name) 77s # opcode == 0 corresponds to CACHE instruction in 3.11+ and was unused before 77s elif opcode == 0: 77s arg = arg if arg is not UNSET else 0 77s _check_arg_int(arg, name) 77s else: 77s if arg is not UNSET: 77s > raise ValueError("operation %s has no argument" % name) 77s E ValueError: operation MAKE_FUNCTION has no argument 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:113: ValueError 77s _________________ ConcreteFromCodeTests.test_extended_arg_nop __________________ 77s 77s self = 77s 77s def test_extended_arg_nop(self): 77s constants = [None] * (0x000129 + 1) 77s constants[0x000129] = "Arbitrary String" 77s # EXTENDED_ARG 0x01, NOP 0xFF, EXTENDED_ARG 0x01, 77s # LOAD_CONST 0x29, RETURN_VALUE 0x00 77s codestring = bytes([0x90, 0x01, 0x09, 0xFF, 0x90, 0x01, 0x64, 0x29, 0x53, 0x00]) 77s codetype_list = [ 77s 0, 77s 0, 77s 0, 77s 1, 77s 64, 77s codestring, 77s tuple(constants), 77s (), 77s (), 77s "", 77s "code", 77s 1, 77s b"", 77s (), 77s (), 77s ] 77s if sys.version_info >= (3, 8): 77s codetype_list.insert(1, 0) 77s if sys.version_info >= (3, 11): 77s codetype_list.insert(12, "code") 77s codetype_list.insert(14, bytes()) 77s codetype_args = tuple(codetype_list) 77s code = types.CodeType(*codetype_args) 77s # Check it can be encoded and decoded 77s > codetype_output = Bytecode.from_code(code).to_code().co_consts 77s 77s tests/test_concrete.py:888: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 0 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ______________ ConcreteFromCodeTests.test_extended_arg_unpack_ex _______________ 77s 77s self = 77s 77s def test_extended_arg_unpack_ex(self): 77s def test(): 77s p = [1, 2, 3, 4, 5, 6] 77s q, r, *s, t = p 77s return q, r, s, t 77s 77s cpython_stacksize = test.__code__.co_stacksize 77s test.__code__ = ConcreteBytecode.from_code( 77s test.__code__, extended_arg=True 77s > ).to_code() 77s 77s tests/test_concrete.py:916: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ______________ ConcreteFromCodeTests.test_fail_extended_arg_jump _______________ 77s 77s self = 77s 77s def test_fail_extended_arg_jump(self): 77s def test(): 77s var = None 77s for _ in range(0, 1): 77s var = 0 77s var = 1 77s var = 2 77s var = 3 77s var = 4 77s var = 5 77s var = 6 77s var = 7 77s var = 8 77s var = 9 77s var = 10 77s var = 11 77s var = 12 77s var = 13 77s var = 14 77s var = 15 77s var = 16 77s var = 17 77s var = 18 77s var = 19 77s var = 20 77s var = 21 77s var = 22 77s var = 23 77s var = 24 77s var = 25 77s var = 26 77s var = 27 77s var = 28 77s var = 29 77s var = 30 77s var = 31 77s var = 32 77s var = 33 77s var = 34 77s var = 35 77s var = 36 77s var = 37 77s var = 38 77s var = 39 77s var = 40 77s var = 41 77s var = 42 77s var = 43 77s var = 44 77s var = 45 77s var = 46 77s var = 47 77s var = 48 77s var = 49 77s var = 50 77s var = 51 77s var = 52 77s var = 53 77s var = 54 77s var = 55 77s var = 56 77s var = 57 77s var = 58 77s var = 59 77s var = 60 77s var = 61 77s var = 62 77s var = 63 77s var = 64 77s var = 65 77s var = 66 77s var = 67 77s var = 68 77s var = 69 77s var = 70 77s return var 77s 77s # Generate the bytecode with extended arguments 77s bytecode = ConcreteBytecode.from_code(test.__code__, extended_arg=True) 77s > bytecode.to_code() 77s 77s tests/test_concrete.py:1270: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ___________________ ConcreteFromCodeTests.test_packing_lines ___________________ 77s 77s self = 77s 77s def test_packing_lines(self): 77s import dis 77s 77s from .long_lines_example import long_lines 77s 77s line_starts = list(dis.findlinestarts(long_lines.__code__)) 77s 77s concrete = ConcreteBytecode.from_code(long_lines.__code__) 77s > as_code = concrete.to_code() 77s 77s tests/test_concrete.py:1282: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____________________ BytecodeToConcreteTests.test_cellvars _____________________ 77s 77s self = 77s 77s def test_cellvars(self): 77s code = Bytecode() 77s code.cellvars = ["x"] 77s code.freevars = ["y"] 77s code.extend( 77s [ 77s Instr("LOAD_DEREF", CellVar("x"), lineno=1), 77s Instr("LOAD_DEREF", FreeVar("y"), lineno=1), 77s ] 77s ) 77s > concrete = code.to_concrete_bytecode() 77s 77s tests/test_concrete.py:1604: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 84 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____________ BytecodeToConcreteTests.test_compute_jumps_convergence ____________ 77s 77s self = 77s 77s def test_compute_jumps_convergence(self): 77s # Consider the following sequence of instructions: 77s # 77s # JUMP_FORWARD Label1 77s # JUMP_FORWARD Label2 77s # ...126 instructions... 77s # Label1: Offset 254 on first pass, 256 second pass 77s # NOP 77s # ... many more instructions ... 77s # Label2: Offset > 256 on first pass 77s # 77s # On first pass of compute_jumps(), Label2 will be at address 254, so 77s # that value encodes into the single byte arg of JUMP_ABSOLUTE. 77s # 77s # On second pass compute_jumps() the instr at Label1 will have offset 77s # of 256 so will also be given an EXTENDED_ARG. 77s # 77s # Thus we need to make an additional pass. This test only verifies 77s # case where 2 passes is insufficient but three is enough. 77s # 77s # On Python > 3.10 we need to double the number since the offset is now 77s # in term of instructions and not bytes. 77s 77s # Create code from comment above. 77s code = Bytecode() 77s label1 = Label() 77s label2 = Label() 77s nop = "NOP" 77s code.append(Instr("JUMP_FORWARD", label1)) 77s code.append(Instr("JUMP_FORWARD", label2)) 77s # range excludes the last point ... 77s for _ in range(4, 511 if OFFSET_AS_INSTRUCTION else 255, 2): 77s code.append(Instr(nop)) 77s code.append(label1) 77s code.append(Instr(nop)) 77s for _ in range( 77s 514 if OFFSET_AS_INSTRUCTION else 256, 77s 600 if OFFSET_AS_INSTRUCTION else 300, 77s 2, 77s ): 77s code.append(Instr(nop)) 77s code.append(label2) 77s code.append(Instr(nop)) 77s 77s # This should pass by default. 77s > code.to_code() 77s 77s tests/test_concrete.py:1653: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 79 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ______________ BytecodeToConcreteTests.test_dont_merge_constants _______________ 77s 77s self = 77s 77s def test_dont_merge_constants(self): 77s # test two constants which are equal but have a different type 77s code = Bytecode() 77s code.extend( 77s [ 77s Instr("LOAD_CONST", 5, lineno=1), 77s Instr("LOAD_CONST", 5.0, lineno=1), 77s Instr("LOAD_CONST", -0.0, lineno=1), 77s Instr("LOAD_CONST", +0.0, lineno=1), 77s ] 77s ) 77s 77s > code = code.to_concrete_bytecode() 77s 77s tests/test_concrete.py:1584: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s __________________ BytecodeToConcreteTests.test_extended_jump __________________ 77s 77s self = 77s 77s def test_extended_jump(self): 77s NOP = bytes((opcode.opmap["NOP"], 0)) 77s 77s # code using jumps > 0xffff to test extended arg 77s nb_nop = 2**16 if OFFSET_AS_INSTRUCTION else 2**15 77s # The length of the jump is independent of the number of instruction 77s # per the above logic. 77s jump = 2**16 77s code = ConcreteBytecode( 77s [ConcreteInstr("JUMP_FORWARD", jump)] 77s + [ConcreteInstr("NOP")] * nb_nop 77s + [ 77s ConcreteInstr("LOAD_CONST", 0), 77s ConcreteInstr("RETURN_VALUE"), 77s ], 77s consts=(None,), 77s ) 77s 77s > code_obj = code.to_code() 77s 77s tests/test_concrete.py:1514: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:862: in to_code 77s cfg = _bytecode.ControlFlowGraph.from_bytecode(self.to_bytecode()) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 79 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________ BytecodeToConcreteTests.test_extreme_compute_jumps_convergence ________ 77s 77s self = 77s 77s def test_extreme_compute_jumps_convergence(self): 77s """Test of compute_jumps() requiring absurd number of passes. 77s 77s NOTE: This test also serves to demonstrate that there is no worst 77s case: the number of passes can be unlimited (or, actually, limited by 77s the size of the provided code). 77s 77s This is an extension of test_compute_jumps_convergence. Instead of 77s two jumps, where the earlier gets extended after the latter, we 77s instead generate a series of many jumps. Each pass of compute_jumps() 77s extends one more instruction, which in turn causes the one behind it 77s to be extended on the next pass. 77s 77s """ 77s 77s # N: the number of unextended instructions that can be squeezed into a 77s # set of bytes adressable by the arg of an unextended instruction. 77s # The answer is "128", but here's how we arrive at it. 77s max_unextended_offset = 1 << 8 77s unextended_branch_instr_size = 2 77s N = max_unextended_offset // unextended_branch_instr_size 77s 77s # When using instruction rather than bytes in the offset multiply by 2 77s if OFFSET_AS_INSTRUCTION: 77s N *= 2 77s 77s nop = "UNARY_NEGATIVE" # don't use NOP, dis.stack_effect will raise 77s 77s # The number of jumps will be equal to the number of labels. The 77s # number of passes of compute_jumps() required will be one greater 77s # than this. 77s labels = [Label() for x in range(0, 3 * N)] 77s 77s code = Bytecode() 77s code.extend( 77s Instr("JUMP_FORWARD", labels[len(labels) - x - 1]) 77s for x in range(0, len(labels)) 77s ) 77s end_of_jumps = len(code) 77s code.extend(Instr(nop) for x in range(0, N)) 77s 77s # Now insert the labels. The first is N instructions (i.e. 256 77s # bytes) after the last jump. Then they proceed to earlier positions 77s # 4 bytes at a time. While the targets are in the range of the nop 77s # instructions, 4 bytes is two instructions. When the targets are in 77s # the range of JUMP_FORWARD instructions we have to allow for the fact 77s # that the instructions will have been extended to four bytes each, so 77s # working backwards 4 bytes per label means just one instruction per 77s # label. 77s offset = end_of_jumps + N 77s for index in range(0, len(labels)): 77s code.insert(offset, labels[index]) 77s if offset <= end_of_jumps: 77s offset -= 1 77s else: 77s offset -= 2 77s 77s code.insert(0, Instr("LOAD_CONST", 0)) 77s del end_of_jumps 77s code.append(Instr("RETURN_VALUE")) 77s 77s > code.to_code(compute_jumps_passes=(len(labels) + 1)) 77s 77s tests/test_concrete.py:1720: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________________ BytecodeToConcreteTests.test_general_constants ________________ 77s 77s self = 77s 77s def test_general_constants(self): 77s """Test if general object could be linked as constants.""" 77s 77s class CustomObject: 77s pass 77s 77s class UnHashableCustomObject: 77s __hash__ = None 77s 77s obj1 = [1, 2, 3] 77s obj2 = {1, 2, 3} 77s obj3 = CustomObject() 77s obj4 = UnHashableCustomObject() 77s code = Bytecode( 77s [ 77s Instr("LOAD_CONST", obj1, lineno=1), 77s Instr("LOAD_CONST", obj2, lineno=1), 77s Instr("LOAD_CONST", obj3, lineno=1), 77s Instr("LOAD_CONST", obj4, lineno=1), 77s Instr("BUILD_TUPLE", 4, lineno=1), 77s Instr("RETURN_VALUE", lineno=1), 77s ] 77s ) 77s > self.assertEqual(code.to_code().co_consts, (obj1, obj2, obj3, obj4)) 77s 77s tests/test_concrete.py:1745: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ______________________ BytecodeToConcreteTests.test_jumps ______________________ 77s 77s self = 77s 77s def test_jumps(self): 77s # if test: 77s # x = 12 77s # else: 77s # x = 37 77s code = Bytecode() 77s label_else = Label() 77s label_return = Label() 77s code.extend( 77s [ 77s Instr("LOAD_NAME", "test", lineno=1), 77s Instr( 77s "POP_JUMP_FORWARD_IF_FALSE" 77s if (3, 12) > sys.version_info >= (3, 11) 77s else "POP_JUMP_IF_FALSE", 77s label_else, 77s ), 77s Instr("LOAD_CONST", 12, lineno=2), 77s Instr("STORE_NAME", "x"), 77s Instr("JUMP_FORWARD", label_return), 77s label_else, 77s Instr("LOAD_CONST", 37, lineno=4), 77s Instr("STORE_NAME", "x"), 77s label_return, 77s Instr("LOAD_CONST", None, lineno=4), 77s Instr("RETURN_VALUE"), 77s ] 77s ) 77s 77s > code = code.to_concrete_bytecode() 77s 77s tests/test_concrete.py:1549: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 92 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ______________________ BytecodeToConcreteTests.test_label ______________________ 77s 77s self = 77s 77s def test_label(self): 77s code = Bytecode() 77s label = Label() 77s code.extend( 77s [ 77s Instr("LOAD_CONST", "hello", lineno=1), 77s Instr("JUMP_FORWARD", label, lineno=1), 77s label, 77s Instr("POP_TOP", lineno=1), 77s ] 77s ) 77s 77s > code = code.to_concrete_bytecode() 77s 77s tests/test_concrete.py:1341: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _____________________ BytecodeToConcreteTests.test_label2 ______________________ 77s 77s self = 77s 77s def test_label2(self): 77s bytecode = Bytecode() 77s label = Label() 77s bytecode.extend( 77s [ 77s Instr("LOAD_NAME", "test", lineno=1), 77s Instr( 77s "POP_JUMP_FORWARD_IF_FALSE" 77s if (3, 12) > sys.version_info >= (3, 11) 77s else "POP_JUMP_IF_FALSE", 77s label, 77s ), 77s Instr("LOAD_CONST", 5, lineno=2), 77s Instr("STORE_NAME", "x"), 77s Instr("JUMP_FORWARD", label), 77s Instr("LOAD_CONST", 7, lineno=4), 77s Instr("STORE_NAME", "x"), 77s label, 77s Instr("LOAD_CONST", None), 77s Instr("RETURN_VALUE"), 77s ] 77s ) 77s 77s > concrete = bytecode.to_concrete_bytecode() 77s 77s tests/test_concrete.py:1373: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 92 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _____________________ BytecodeToConcreteTests.test_label3 ______________________ 77s 77s self = 77s 77s def test_label3(self): 77s """ 77s CPython generates useless EXTENDED_ARG 0 in some cases. We need to 77s properly track them as otherwise we can end up with broken offset for 77s jumps. 77s """ 77s source = """ 77s def func(x): 77s if x == 1: 77s return x + 0 77s elif x == 2: 77s return x + 1 77s elif x == 3: 77s return x + 2 77s elif x == 4: 77s return x + 3 77s elif x == 5: 77s return x + 4 77s elif x == 6: 77s return x + 5 77s elif x == 7: 77s return x + 6 77s elif x == 8: 77s return x + 7 77s elif x == 9: 77s return x + 8 77s elif x == 10: 77s return x + 9 77s elif x == 11: 77s return x + 10 77s elif x == 12: 77s return x + 11 77s elif x == 13: 77s return x + 12 77s elif x == 14: 77s return x + 13 77s elif x == 15: 77s return x + 14 77s elif x == 16: 77s return x + 15 77s elif x == 17: 77s return x + 16 77s return -1 77s """ 77s code = get_code(source, function=True) 77s > bcode = Bytecode.from_code(code) 77s 77s tests/test_concrete.py:1441: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ____________________ BytecodeToConcreteTests.test_setlineno ____________________ 77s 77s self = 77s 77s def test_setlineno(self): 77s # x = 7 77s # y = 8 77s # z = 9 77s concrete = ConcreteBytecode() 77s concrete.consts = [7, 8, 9] 77s concrete.names = ["x", "y", "z"] 77s concrete.first_lineno = 3 77s concrete.extend( 77s [ 77s ConcreteInstr("LOAD_CONST", 0), 77s ConcreteInstr("STORE_NAME", 0), 77s SetLineno(4), 77s ConcreteInstr("LOAD_CONST", 1), 77s ConcreteInstr("STORE_NAME", 1), 77s SetLineno(5), 77s ConcreteInstr("LOAD_CONST", 2), 77s ConcreteInstr("STORE_NAME", 2), 77s ] 77s ) 77s 77s > code = concrete.to_bytecode() 77s 77s tests/test_concrete.py:1483: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 83 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _____________________________ InstrTests.test_attr _____________________________ 77s 77s self = 77s 77s def test_attr(self): 77s instr = Instr("LOAD_CONST", 3, lineno=5) 77s self.assertEqual(instr.name, "LOAD_CONST") 77s > self.assertEqual(instr.opcode, 100) 77s E AssertionError: 83 != 100 77s 77s tests/test_instr.py:232: AssertionError 77s _____________ InstrTests.test_code_object_containing_mutable_data ______________ 77s 77s self = 77s 77s def test_code_object_containing_mutable_data(self): 77s from types import CodeType 77s 77s from bytecode import Bytecode, Instr 77s 77s def f(): 77s def g(): 77s # Under Python 3.12+ we need a temporary var to be sure we use 77s # LOAD_CONST rather than RETURN_CONST 77s a = "value" 77s return a 77s 77s return g 77s 77s > f_code = Bytecode.from_code(f.__code__) 77s 77s tests/test_instr.py:434: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ________________________ CompareTests.test_compare_ops _________________________ 77s 77s self = 77s 77s def test_compare_ops(self): 77s from bytecode import Bytecode, Instr 77s 77s def f(): 77s pass 77s 77s params = zip(iter(Compare), (True, True, False, True, False, False)) 77s for cmp, expected in params: 77s with self.subTest(cmp): 77s bcode = Bytecode( 77s ([Instr("RESUME", 0)] if sys.version_info >= (3, 11) else []) 77s + [ 77s Instr("LOAD_CONST", 24), 77s Instr("LOAD_CONST", 42), 77s Instr("COMPARE_OP", cmp), 77s Instr("RETURN_VALUE"), 77s ] 77s ) 77s > f.__code__ = bcode.to_code() 77s 77s tests/test_instr.py:479: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:312: in to_code 77s bc = self.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:327: in to_concrete_bytecode 77s return converter.to_concrete_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1408: in to_concrete_bytecode 77s self.concrete_instructions() 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:1282: in concrete_instructions 77s self.required_caches = c_instr.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _________________________ DumpCodeTests.test_bytecode __________________________ 77s 77s self = 77s 77s def test_bytecode(self): 77s source = """ 77s def func(test): 77s if test == 1: 77s return 1 77s elif test == 2: 77s return 2 77s return 3 77s """ 77s > code = disassemble(source, function=True) 77s 77s tests/test_misc.py:37: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/__init__.py:143: in disassemble 77s return Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s ______________________ DumpCodeTests.test_bytecode_blocks ______________________ 77s 77s self = 77s 77s def test_bytecode_blocks(self): 77s source = """ 77s def func(test): 77s if test == 1: 77s return 1 77s elif test == 2: 77s return 2 77s return 3 77s """ 77s > code = disassemble(source, function=True) 77s 77s tests/test_misc.py:206: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/__init__.py:143: in disassemble 77s return Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s _____________________ DumpCodeTests.test_concrete_bytecode _____________________ 77s 77s self = 77s 77s def test_concrete_bytecode(self): 77s source = """ 77s def func(test): 77s if test == 1: 77s return 1 77s elif test == 2: 77s return 2 77s return 3 77s """ 77s > code = disassemble(source, function=True) 77s 77s tests/test_misc.py:409: 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s tests/__init__.py:143: in disassemble 77s return Bytecode.from_code(code) 77s /usr/lib/python3/dist-packages/bytecode/bytecode.py:283: in from_code 77s return concrete.to_bytecode( 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:943: in to_bytecode 77s target = c_instr.get_jump_target(offset) 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:145: in get_jump_target 77s ) + self.use_cache_opcodes() 77s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77s 77s self = 77s 77s def use_cache_opcodes(self) -> int: 77s return ( 77s # Not supposed to be used but we need it 77s > dis._inline_cache_entries[self._opcode] # type: ignore 77s if sys.version_info >= (3, 11) 77s else 0 77s ) 77s E KeyError: 149 77s 77s /usr/lib/python3/dist-packages/bytecode/concrete.py:188: KeyError 77s =========================== short test summary info ============================ 77s FAILED tests/test_bytecode.py::BytecodeTests::test_cellvar_freevar_roundtrip 77s FAILED tests/test_bytecode.py::BytecodeTests::test_eq - KeyError: 149 77s FAILED tests/test_bytecode.py::BytecodeTests::test_eq_with_try - KeyError: 149 77s FAILED tests/test_bytecode.py::BytecodeTests::test_exception_table_round_trip 77s FAILED tests/test_bytecode.py::BytecodeTests::test_from_code - KeyError: 149 77s FAILED tests/test_bytecode.py::BytecodeTests::test_from_code_freevars - KeyEr... 77s FAILED tests/test_bytecode.py::BytecodeTests::test_from_code_load_fast - KeyE... 77s FAILED tests/test_bytecode.py::BytecodeTests::test_negative_size_binary_with_disable_check_of_pre_and_post 77s FAILED tests/test_bytecode.py::BytecodeTests::test_negative_size_build_const_map_with_disable_check_of_pre_and_post 77s FAILED tests/test_bytecode.py::BytecodeTests::test_negative_size_build_map_with_disable_check_of_pre_and_post 77s FAILED tests/test_bytecode.py::BytecodeTests::test_negative_size_unary_with_disable_check_of_pre_and_post 77s FAILED tests/test_bytecode.py::BytecodeTests::test_not_enough_copy_with_disable_check_of_pre_and_post 77s FAILED tests/test_bytecode.py::BytecodeTests::test_not_enough_swap_with_disable_check_of_pre_and_post 77s FAILED tests/test_bytecode.py::BytecodeTests::test_setlineno - KeyError: 83 77s FAILED tests/test_bytecode.py::BytecodeTests::test_to_code - KeyError: 92 77s FAILED tests/test_cfg.py::BytecodeBlocksTests::test_attr - KeyError: 149 77s FAILED tests/test_cfg.py::BytecodeBlocksFunctionalTests::test_eq - KeyError: 149 77s FAILED tests/test_cfg.py::BytecodeBlocksFunctionalTests::test_eq_with_try_except 77s FAILED tests/test_cfg.py::BytecodeBlocksFunctionalTests::test_split_block - K... 77s FAILED tests/test_cfg.py::BytecodeBlocksFunctionalTests::test_split_block_dont_split 77s FAILED tests/test_cfg.py::BytecodeBlocksFunctionalTests::test_split_block_end 77s FAILED tests/test_cfg.py::BytecodeBlocksFunctionalTests::test_split_block_error 77s FAILED tests/test_cfg.py::BytecodeBlocksFunctionalTests::test_to_code - KeyEr... 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_and 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_for_loop_continue 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_if_else 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_nested_try_except_else_finally 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_nested_try_except_finally 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_or 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_try_except 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_try_except_else_finally 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_try_except_finally 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_try_finally 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_while_loop_break 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_computation_with 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_with_dead_code 77s FAILED tests/test_cfg.py::CFGStacksizeComputationTests::test_stack_size_with_dead_code2 77s FAILED tests/test_cfg.py::CFGRoundTripTests::test_cellvar_freevar_roundtrip 77s FAILED tests/test_cfg.py::CFGRoundTripTests::test_roundtrip_exception_handling 77s FAILED tests/test_code.py::CodeTests::test_async_func - KeyError: 35 77s FAILED tests/test_code.py::CodeTests::test_generator_func - KeyError: 35 77s FAILED tests/test_code.py::CodeTests::test_kwargs - KeyError: 149 77s FAILED tests/test_code.py::CodeTests::test_kwonlyargs - KeyError: 149 77s FAILED tests/test_code.py::CodeTests::test_loop - KeyError: 149 77s FAILED tests/test_code.py::CodeTests::test_varargs - KeyError: 149 77s FAILED tests/test_concrete.py::ConcreteInstrTests::test_assemble - AssertionE... 77s FAILED tests/test_concrete.py::ConcreteInstrTests::test_attr - AssertionError... 77s FAILED tests/test_concrete.py::ConcreteInstrTests::test_disassemble - Asserti... 77s FAILED tests/test_concrete.py::ConcreteInstrTests::test_get_jump_target - Key... 77s FAILED tests/test_concrete.py::ConcreteInstrTests::test_set_attr - AssertionE... 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_cellvar - KeyError... 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_cellvar_freevar - ... 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_eq - KeyError: 83 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_explicit_stacksize 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_extended_lnotab - ... 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_extended_lnotab2 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_freevar - KeyError... 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_load_classderef - ... 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_negative_lnotab - ... 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_to_bytecode_consts 77s FAILED tests/test_concrete.py::ConcreteBytecodeTests::test_to_code_lnotab - K... 77s FAILED tests/test_concrete.py::ConcreteFromCodeTests::test_cellvar_freevar_roundtrip 77s FAILED tests/test_concrete.py::ConcreteFromCodeTests::test_exception_table_round_trip 77s FAILED tests/test_concrete.py::ConcreteFromCodeTests::test_expected_arg_with_many_consts 77s FAILED tests/test_concrete.py::ConcreteFromCodeTests::test_extended_arg_make_function 77s FAILED tests/test_concrete.py::ConcreteFromCodeTests::test_extended_arg_nop 77s FAILED tests/test_concrete.py::ConcreteFromCodeTests::test_extended_arg_unpack_ex 77s FAILED tests/test_concrete.py::ConcreteFromCodeTests::test_fail_extended_arg_jump 77s FAILED tests/test_concrete.py::ConcreteFromCodeTests::test_packing_lines - Ke... 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_cellvars - KeyEr... 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_compute_jumps_convergence 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_dont_merge_constants 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_extended_jump - ... 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_extreme_compute_jumps_convergence 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_general_constants 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_jumps - KeyError... 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_label - KeyError... 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_label2 - KeyErro... 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_label3 - KeyErro... 77s FAILED tests/test_concrete.py::BytecodeToConcreteTests::test_setlineno - KeyE... 77s FAILED tests/test_instr.py::InstrTests::test_attr - AssertionError: 83 != 100 77s FAILED tests/test_instr.py::InstrTests::test_code_object_containing_mutable_data 77s FAILED tests/test_instr.py::CompareTests::test_compare_ops - KeyError: 149 77s FAILED tests/test_misc.py::DumpCodeTests::test_bytecode - KeyError: 149 77s FAILED tests/test_misc.py::DumpCodeTests::test_bytecode_blocks - KeyError: 149 77s FAILED tests/test_misc.py::DumpCodeTests::test_concrete_bytecode - KeyError: 149 77s =================== 86 failed, 71 passed, 8 skipped in 3.92s =================== 77s autopkgtest [23:17:05]: test pytest: -----------------------] 77s pytest FAIL non-zero exit status 1 77s autopkgtest [23:17:05]: test pytest: - - - - - - - - - - results - - - - - - - - - - 78s autopkgtest [23:17:06]: @@@@@@@@@@@@@@@@@@@@ summary 78s pytest FAIL non-zero exit status 1 89s nova [W] Skipping flock for amd64 89s Creating nova instance adt-plucky-i386-python-bytecode-20241114-231548-juju-7f2275-prod-proposed-migration-environment-20-91a3d12f-832c-4348-bc89-d4bcfbfdd048 from image adt/ubuntu-plucky-amd64-server-20241114.img (UUID 79d80331-8736-463c-82c6-8c9e13c0a4ca)...