==> Building on scovillain ==> Checking for remote environment... ==> Syncing package to remote host... sending incremental file list ./ .SRCINFO 700 95% 0.00kB/s 0:00:00 731 100% 30.27kB/s 0:00:00 (xfr#1, to-chk=3/5) .nvchecker.toml 99 100% 96.68kB/s 0:00:00 99 100% 96.68kB/s 0:00:00 (xfr#2, to-chk=2/5) PKGBUILD 700 60% 683.59kB/s 0:00:00 1,153 100% 1.10MB/s 0:00:00 (xfr#3, to-chk=1/5) python-executing-2.1.0-1.log 502 100% 490.23kB/s 0:00:00 502 100% 490.23kB/s 0:00:00 (xfr#4, to-chk=0/5) sent 585 bytes received 131 bytes 1,432.00 bytes/sec total size is 2,180 speedup is 3.04 ==> Applying RISC-V patches... sending incremental file list ./ fix-test-many-source-for-filename-calls-timeout.patch 522 100% 0.00kB/s 0:00:00 522 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=1/3) riscv64.patch 534 100% 521.48kB/s 0:00:00 534 100% 521.48kB/s 0:00:00 (xfr#2, to-chk=0/3) sent 580 bytes received 69 bytes 432.67 bytes/sec total size is 1,056 speedup is 1.63 patching file PKGBUILD ==> Running extra-riscv64-build -- -d /home/felix/packages/riscv64-pkg-cache:/var/cache/pacman/pkg -l felix44 on remote host... ]2;🔵 Container arch-nspawn-2765225 on scovillain.felixc.at[?25l:: Synchronizing package databases... core downloading... extra downloading... :: Starting full system upgrade... there is nothing to do [?25h==> Building in chroot for [extra] (riscv64)... ==> Synchronizing chroot copy [/var/lib/archbuild/extra-riscv64/root] -> [felix44]...done ==> Making package: python-executing 2.1.0-1 (Tue Sep 17 15:31:06 2024) ==> Retrieving sources...  -> Cloning executing git repo... Cloning into bare repository '/home/felix/packages/python-executing/executing'... remote: Enumerating objects: 2999, done. remote: Counting objects: 0% (1/1114) remote: Counting objects: 1% (12/1114) remote: Counting objects: 2% (23/1114) remote: Counting objects: 3% (34/1114) remote: Counting objects: 4% (45/1114) remote: Counting objects: 5% (56/1114) remote: Counting objects: 6% (67/1114) remote: Counting objects: 7% (78/1114) remote: Counting objects: 8% (90/1114) remote: Counting objects: 9% (101/1114) remote: Counting objects: 10% (112/1114) remote: Counting objects: 11% (123/1114) remote: Counting objects: 12% (134/1114) remote: Counting objects: 13% (145/1114) remote: Counting objects: 14% (156/1114) remote: Counting objects: 15% (168/1114) remote: Counting objects: 16% (179/1114) remote: Counting objects: 17% (190/1114) remote: Counting objects: 18% (201/1114) remote: Counting objects: 19% (212/1114) remote: Counting objects: 20% (223/1114) remote: Counting objects: 21% (234/1114) remote: Counting objects: 22% (246/1114) remote: Counting objects: 23% (257/1114) remote: Counting objects: 24% (268/1114) remote: Counting objects: 25% (279/1114) remote: Counting objects: 26% (290/1114) remote: Counting objects: 27% (301/1114) remote: Counting objects: 28% (312/1114) remote: Counting objects: 29% (324/1114) remote: Counting objects: 30% (335/1114) remote: Counting objects: 31% (346/1114) remote: Counting objects: 32% (357/1114) remote: Counting objects: 33% (368/1114) remote: Counting objects: 34% (379/1114) remote: Counting objects: 35% (390/1114) remote: Counting objects: 36% (402/1114) remote: Counting objects: 37% (413/1114) remote: Counting objects: 38% (424/1114) remote: Counting objects: 39% (435/1114) remote: Counting objects: 40% (446/1114) remote: Counting objects: 41% (457/1114) remote: Counting objects: 42% (468/1114) remote: Counting objects: 43% (480/1114) remote: Counting objects: 44% (491/1114) remote: Counting objects: 45% (502/1114) remote: Counting objects: 46% (513/1114) remote: Counting objects: 47% (524/1114) remote: Counting objects: 48% (535/1114) remote: Counting objects: 49% (546/1114) remote: Counting objects: 50% (557/1114) remote: Counting objects: 51% (569/1114) remote: Counting objects: 52% (580/1114) remote: Counting objects: 53% (591/1114) remote: Counting objects: 54% (602/1114) remote: Counting objects: 55% (613/1114) remote: Counting objects: 56% (624/1114) remote: Counting objects: 57% (635/1114) remote: Counting objects: 58% (647/1114) remote: Counting objects: 59% (658/1114) remote: Counting objects: 60% (669/1114) remote: Counting objects: 61% (680/1114) remote: Counting objects: 62% (691/1114) remote: Counting objects: 63% (702/1114) remote: Counting objects: 64% (713/1114) remote: Counting objects: 65% (725/1114) remote: Counting objects: 66% (736/1114) remote: Counting objects: 67% (747/1114) remote: Counting objects: 68% (758/1114) remote: Counting objects: 69% (769/1114) remote: Counting objects: 70% (780/1114) remote: Counting objects: 71% (791/1114) remote: Counting objects: 72% (803/1114) remote: Counting objects: 73% (814/1114) remote: Counting objects: 74% (825/1114) remote: Counting objects: 75% (836/1114) remote: Counting objects: 76% (847/1114) remote: Counting objects: 77% (858/1114) remote: Counting objects: 78% (869/1114) remote: Counting objects: 79% (881/1114) remote: Counting objects: 80% (892/1114) remote: Counting objects: 81% (903/1114) remote: Counting objects: 82% (914/1114) remote: Counting objects: 83% (925/1114) remote: Counting objects: 84% (936/1114) remote: Counting objects: 85% (947/1114) remote: Counting objects: 86% (959/1114) remote: Counting objects: 87% (970/1114) remote: Counting objects: 88% (981/1114) remote: Counting objects: 89% (992/1114) remote: Counting objects: 90% (1003/1114) remote: Counting objects: 91% (1014/1114) remote: Counting objects: 92% (1025/1114) remote: Counting objects: 93% (1037/1114) remote: Counting objects: 94% (1048/1114) remote: Counting objects: 95% (1059/1114) remote: Counting objects: 96% (1070/1114) remote: Counting objects: 97% (1081/1114) remote: Counting objects: 98% (1092/1114) remote: Counting objects: 99% (1103/1114) remote: Counting objects: 100% (1114/1114) remote: Counting objects: 100% (1114/1114), done. remote: Compressing objects: 0% (1/314) remote: Compressing objects: 1% (4/314) remote: Compressing objects: 2% (7/314) remote: Compressing objects: 3% (10/314) remote: Compressing objects: 4% (13/314) remote: Compressing objects: 5% (16/314) remote: Compressing objects: 6% (19/314) remote: Compressing objects: 7% (22/314) remote: Compressing objects: 8% (26/314) remote: Compressing objects: 9% (29/314) remote: Compressing objects: 10% (32/314) remote: Compressing objects: 11% (35/314) remote: Compressing objects: 12% (38/314) remote: Compressing objects: 13% (41/314) remote: Compressing objects: 14% (44/314) remote: Compressing objects: 15% (48/314) remote: Compressing objects: 16% (51/314) remote: Compressing objects: 17% (54/314) remote: Compressing objects: 18% (57/314) remote: Compressing objects: 19% (60/314) remote: Compressing objects: 20% (63/314) remote: Compressing objects: 21% (66/314) remote: Compressing objects: 22% (70/314) remote: Compressing objects: 23% (73/314) remote: Compressing objects: 24% (76/314) remote: Compressing objects: 25% (79/314) remote: Compressing objects: 26% (82/314) remote: Compressing objects: 27% (85/314) remote: Compressing objects: 28% (88/314) remote: Compressing objects: 29% (92/314) remote: Compressing objects: 30% (95/314) remote: Compressing objects: 31% (98/314) remote: Compressing objects: 32% (101/314) remote: Compressing objects: 33% (104/314) remote: Compressing objects: 34% (107/314) remote: Compressing objects: 35% (110/314) remote: Compressing objects: 36% (114/314) remote: Compressing objects: 37% (117/314) remote: Compressing objects: 38% (120/314) remote: Compressing objects: 39% (123/314) remote: Compressing objects: 40% (126/314) remote: Compressing objects: 41% (129/314) remote: Compressing objects: 42% (132/314) remote: Compressing objects: 43% (136/314) remote: Compressing objects: 44% (139/314) remote: Compressing objects: 45% (142/314) remote: Compressing objects: 46% (145/314) remote: Compressing objects: 47% (148/314) remote: Compressing objects: 48% (151/314) remote: Compressing objects: 49% (154/314) remote: Compressing objects: 50% (157/314) remote: Compressing objects: 51% (161/314) remote: Compressing objects: 52% (164/314) remote: Compressing objects: 53% (167/314) remote: Compressing objects: 54% (170/314) remote: Compressing objects: 55% (173/314) remote: Compressing objects: 56% (176/314) remote: Compressing objects: 57% (179/314) remote: Compressing objects: 58% (183/314) remote: Compressing objects: 59% (186/314) remote: Compressing objects: 60% (189/314) remote: Compressing objects: 61% (192/314) remote: Compressing objects: 62% (195/314) remote: Compressing objects: 63% (198/314) remote: Compressing objects: 64% (201/314) remote: Compressing objects: 65% (205/314) remote: Compressing objects: 66% (208/314) remote: Compressing objects: 67% (211/314) remote: Compressing objects: 68% (214/314) remote: Compressing objects: 69% (217/314) remote: Compressing objects: 70% (220/314) remote: Compressing objects: 71% (223/314) remote: Compressing objects: 72% (227/314) remote: Compressing objects: 73% (230/314) remote: Compressing objects: 74% (233/314) remote: Compressing objects: 75% (236/314) remote: Compressing objects: 76% (239/314) remote: Compressing objects: 77% (242/314) remote: Compressing objects: 78% (245/314) remote: Compressing objects: 79% (249/314) remote: Compressing objects: 80% (252/314) remote: Compressing objects: 81% (255/314) remote: Compressing objects: 82% (258/314) remote: Compressing objects: 83% (261/314) remote: Compressing objects: 84% (264/314) remote: Compressing objects: 85% (267/314) remote: Compressing objects: 86% (271/314) remote: Compressing objects: 87% (274/314) remote: Compressing objects: 88% (277/314) remote: Compressing objects: 89% (280/314) remote: Compressing objects: 90% (283/314) remote: Compressing objects: 91% (286/314) remote: Compressing objects: 92% (289/314) remote: Compressing objects: 93% (293/314) remote: Compressing objects: 94% (296/314) remote: Compressing objects: 95% (299/314) remote: Compressing objects: 96% (302/314) remote: Compressing objects: 97% (305/314) remote: Compressing objects: 98% (308/314) remote: Compressing objects: 99% (311/314) remote: Compressing objects: 100% (314/314) remote: Compressing objects: 100% (314/314), done. Receiving objects: 0% (1/2999) Receiving objects: 1% (30/2999) Receiving objects: 2% (60/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 3% (90/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 4% (120/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 5% (150/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 6% (180/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 7% (210/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 8% (240/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 9% (270/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 10% (300/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 11% (330/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 12% (360/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 12% (369/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 13% (390/2999), 180.00 KiB | 293.00 KiB/s Receiving objects: 14% (420/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 15% (450/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 16% (480/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 17% (510/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 18% (540/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 19% (570/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 20% (600/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 21% (630/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 22% (660/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 23% (690/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 24% (720/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 25% (750/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 26% (780/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 27% (810/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 28% (840/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 29% (870/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 30% (900/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 31% (930/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 32% (960/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 33% (990/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 34% (1020/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 35% (1050/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 36% (1080/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 37% (1110/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 38% (1140/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 39% (1170/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 40% (1200/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 41% (1230/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 42% (1260/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 43% (1290/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 44% (1320/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 45% (1350/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 46% (1380/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 47% (1410/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 48% (1440/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 49% (1470/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 50% (1500/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 51% (1530/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 52% (1560/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 53% (1590/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 54% (1620/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 55% (1650/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 56% (1680/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 57% (1710/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 58% (1740/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 59% (1770/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 60% (1800/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 61% (1830/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 62% (1860/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 63% (1890/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 64% (1920/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 65% (1950/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 66% (1980/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 67% (2010/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 68% (2040/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 69% (2070/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 70% (2100/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 71% (2130/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 72% (2160/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 73% (2190/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 74% (2220/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 75% (2250/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 76% (2280/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 77% (2310/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 78% (2340/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 79% (2370/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 80% (2400/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 81% (2430/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 82% (2460/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 83% (2490/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 84% (2520/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 85% (2550/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 86% (2580/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 87% (2610/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 88% (2640/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 89% (2670/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 90% (2700/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 91% (2730/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 92% (2760/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 93% (2790/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 94% (2820/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 95% (2850/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 96% (2880/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 97% (2910/2999), 900.00 KiB | 817.00 KiB/s remote: Total 2999 (delta 850), reused 872 (delta 772), pack-reused 1885 (from 1) Receiving objects: 98% (2940/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 99% (2970/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 100% (2999/2999), 900.00 KiB | 817.00 KiB/s Receiving objects: 100% (2999/2999), 2.63 MiB | 1.66 MiB/s, done. Resolving deltas: 0% (0/1910) Resolving deltas: 1% (21/1910) Resolving deltas: 2% (39/1910) Resolving deltas: 3% (58/1910) Resolving deltas: 4% (84/1910) Resolving deltas: 5% (96/1910) Resolving deltas: 6% (116/1910) Resolving deltas: 7% (136/1910) Resolving deltas: 8% (158/1910) Resolving deltas: 9% (177/1910) Resolving deltas: 10% (197/1910) Resolving deltas: 11% (212/1910) Resolving deltas: 12% (232/1910) Resolving deltas: 13% (251/1910) Resolving deltas: 14% (268/1910) Resolving deltas: 15% (287/1910) Resolving deltas: 16% (312/1910) Resolving deltas: 17% (326/1910) Resolving deltas: 18% (345/1910) Resolving deltas: 19% (363/1910) Resolving deltas: 20% (382/1910) Resolving deltas: 21% (402/1910) Resolving deltas: 22% (421/1910) Resolving deltas: 23% (440/1910) Resolving deltas: 24% (459/1910) Resolving deltas: 25% (478/1910) Resolving deltas: 26% (498/1910) Resolving deltas: 27% (517/1910) Resolving deltas: 28% (537/1910) Resolving deltas: 29% (555/1910) Resolving deltas: 30% (573/1910) Resolving deltas: 31% (593/1910) Resolving deltas: 32% (612/1910) Resolving deltas: 33% (631/1910) Resolving deltas: 34% (650/1910) Resolving deltas: 35% (669/1910) Resolving deltas: 36% (688/1910) Resolving deltas: 37% (707/1910) Resolving deltas: 38% (726/1910) Resolving deltas: 39% (745/1910) Resolving deltas: 40% (764/1910) Resolving deltas: 41% (785/1910) Resolving deltas: 42% (805/1910) Resolving deltas: 43% (823/1910) Resolving deltas: 44% (846/1910) Resolving deltas: 45% (860/1910) Resolving deltas: 46% (879/1910) Resolving deltas: 47% (898/1910) Resolving deltas: 48% (917/1910) Resolving deltas: 49% (936/1910) Resolving deltas: 50% (956/1910) Resolving deltas: 51% (975/1910) Resolving deltas: 52% (994/1910) Resolving deltas: 53% (1014/1910) Resolving deltas: 54% (1033/1910) Resolving deltas: 55% (1051/1910) Resolving deltas: 56% (1073/1910) Resolving deltas: 57% (1089/1910) Resolving deltas: 58% (1108/1910) Resolving deltas: 59% (1127/1910) Resolving deltas: 60% (1146/1910) Resolving deltas: 61% (1166/1910) Resolving deltas: 62% (1190/1910) Resolving deltas: 63% (1204/1910) Resolving deltas: 64% (1223/1910) Resolving deltas: 65% (1242/1910) Resolving deltas: 66% (1261/1910) Resolving deltas: 67% (1280/1910) Resolving deltas: 68% (1299/1910) Resolving deltas: 69% (1319/1910) Resolving deltas: 70% (1339/1910) Resolving deltas: 71% (1357/1910) Resolving deltas: 72% (1376/1910) Resolving deltas: 73% (1397/1910) Resolving deltas: 74% (1416/1910) Resolving deltas: 75% (1433/1910) Resolving deltas: 76% (1453/1910) Resolving deltas: 77% (1473/1910) Resolving deltas: 78% (1490/1910) Resolving deltas: 79% (1510/1910) Resolving deltas: 80% (1529/1910) Resolving deltas: 81% (1554/1910) Resolving deltas: 82% (1567/1910) Resolving deltas: 83% (1587/1910) Resolving deltas: 84% (1605/1910) Resolving deltas: 85% (1625/1910) Resolving deltas: 86% (1651/1910) Resolving deltas: 87% (1662/1910) Resolving deltas: 88% (1681/1910) Resolving deltas: 89% (1700/1910) Resolving deltas: 90% (1719/1910) Resolving deltas: 91% (1739/1910) Resolving deltas: 92% (1758/1910) Resolving deltas: 93% (1777/1910) Resolving deltas: 94% (1797/1910) Resolving deltas: 95% (1815/1910) Resolving deltas: 96% (1834/1910) Resolving deltas: 97% (1853/1910) Resolving deltas: 98% (1872/1910) Resolving deltas: 99% (1891/1910) Resolving deltas: 100% (1910/1910) Resolving deltas: 100% (1910/1910), done.  -> Found fix-test-many-source-for-filename-calls-timeout.patch ==> Validating source files with b2sums... executing ... Passed fix-test-many-source-for-filename-calls-timeout.patch ... Passed ]2;🔵 Container arch-nspawn-2766471 on scovillain.felixc.at==> Making package: python-executing 2.1.0-1 (Tue Sep 17 15:31:30 2024) ==> Checking runtime dependencies... ==> Installing missing dependencies... [?25lresolving dependencies... looking for conflicting packages... Package (2) New Version Net Change extra/mpdecimal 4.0.0-2 0.29 MiB core/python 3.12.6-1 106.60 MiB Total Installed Size: 106.89 MiB :: Proceed with installation? [Y/n] checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing mpdecimal... installing python... Optional dependencies for python python-setuptools: for building Python packages using tooling that is usually bundled with Python python-pip: for installing Python packages using tooling that is usually bundled with Python python-pipx: for installing Python software not packaged on Arch Linux sqlite: for a default database integration [installed] xz: for lzma [installed] tk: for tkinter :: Running post-transaction hooks... (1/1) Arming ConditionNeedsUpdate... [?25h==> Checking buildtime dependencies... ==> Installing missing dependencies... [?25lresolving dependencies... looking for conflicting packages... Package (44) New Version Net Change Download Size extra/perl-error 0.17029-7 0.04 MiB extra/perl-mailtools 2.21-9 0.10 MiB extra/perl-timedate 2.33-7 0.08 MiB extra/python-argcomplete 3.4.0-1 0.27 MiB extra/python-autocommand 2.2.2-6 0.08 MiB extra/python-decorator 5.1.1-4 0.06 MiB extra/python-executing 2.0.0-3 0.23 MiB extra/python-fastjsonschema 2.20.0-1 0.27 MiB extra/python-iniconfig 2.0.0-5 0.04 MiB extra/python-jaraco.context 5.3.0-1 0.04 MiB extra/python-jaraco.functools 4.0.2-1 0.07 MiB extra/python-jaraco.text 4.0.0-1 0.08 MiB extra/python-jedi 0.19.1-2 6.35 MiB extra/python-matplotlib-inline 0.1.6-4.1 0.06 MiB extra/python-more-itertools 10.3.0-1 0.63 MiB extra/python-ordered-set 4.1.0-5 0.06 MiB extra/python-packaging 24.1-1 0.49 MiB extra/python-parso 1:0.8.4-2 0.97 MiB extra/python-pexpect 4.9.0-2 0.39 MiB extra/python-platformdirs 4.2.2-1 0.24 MiB extra/python-pluggy 1.5.0-1 0.20 MiB extra/python-prompt_toolkit 3.0.47-1 4.39 MiB extra/python-ptyprocess 0.7.0-6 0.12 MiB extra/python-pure-eval 0.2.3-1 0.10 MiB extra/python-pygments 2.18.0-1 14.10 MiB extra/python-pyproject-hooks 1.1.0-1 0.10 MiB extra/python-setuptools 1:69.5.1-1 4.41 MiB extra/python-six 1.16.0-9 0.11 MiB extra/python-stack-data 0.6.3-2 0.22 MiB extra/python-tomli 2.0.1-4 0.10 MiB extra/python-traitlets 5.14.3-2 1.00 MiB extra/python-trove-classifiers 2024.9.12-1 0.12 MiB 0.02 MiB extra/python-typing_extensions 4.12.2-1 0.41 MiB extra/python-validate-pyproject 0.19-1 0.33 MiB extra/python-wcwidth 0.2.13-2 0.57 MiB extra/git 2.46.1-1 26.98 MiB extra/ipython 8.27.0-1 8.21 MiB extra/python-asttokens 2.4.1-2 0.20 MiB extra/python-build 1.2.1-3 0.19 MiB extra/python-installer 0.7.0-8 0.18 MiB extra/python-littleutils 0.2.4-1 0.08 MiB 0.02 MiB extra/python-pytest 1:8.3.3-1 3.90 MiB extra/python-setuptools-scm 8.1.0-1 0.36 MiB extra/python-wheel 0.44.0-1 0.26 MiB Total Download Size: 0.04 MiB Total Installed Size: 77.22 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... python-littleutils-0.2.4-1-any downloading... python-trove-classifiers-2024.9.12-1-any downloading... checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing perl-error... installing perl-timedate... installing perl-mailtools... installing git... Optional dependencies for git tk: gitk and git gui openssh: ssh transport and crypto perl-libwww: git svn perl-term-readkey: git svn and interactive.singlekey setting perl-io-socket-ssl: git send-email TLS support perl-authen-sasl: git send-email TLS support perl-mediawiki-api: git mediawiki support perl-datetime-format-iso8601: git mediawiki support perl-lwp-protocol-https: git mediawiki https support perl-cgi: gitweb (web interface) support python: git svn & git p4 [installed] subversion: git svn org.freedesktop.secrets: keyring credential helper libsecret: libsecret credential helper [installed] installing python-packaging... installing python-pyproject-hooks... installing python-build... Optional dependencies for python-build python-pip: to use as the Python package installer (default) python-uv: to use as the Python package installer python-virtualenv: to use virtualenv for build isolation installing python-installer... installing python-more-itertools... installing python-jaraco.functools... installing python-jaraco.context... installing python-autocommand... installing python-jaraco.text... Optional dependencies for python-jaraco.text python-inflect: for show-newlines script installing python-ordered-set... installing python-platformdirs... installing python-tomli... installing python-fastjsonschema... installing python-trove-classifiers... installing python-validate-pyproject... installing python-setuptools... installing python-setuptools-scm... installing python-wheel... Optional dependencies for python-wheel python-keyring: for wheel.signatures python-xdg: for wheel.signatures installing python-decorator... installing python-parso... installing python-jedi... installing python-argcomplete... installing python-typing_extensions... installing python-traitlets... installing python-matplotlib-inline... Optional dependencies for python-matplotlib-inline python-matplotlib installing python-ptyprocess... installing python-pexpect... installing python-pygments... installing python-wcwidth... installing python-prompt_toolkit... installing python-six... installing python-asttokens... installing python-executing... installing python-pure-eval... installing python-stack-data... installing ipython... Optional dependencies for ipython python-black: to auto format with Black python-pickleshare: for the ip.db database yapf: to auto format with YAPF installing python-littleutils... installing python-iniconfig... installing python-pluggy... installing python-pytest... :: Running post-transaction hooks... (1/4) Creating system user accounts... Creating group 'git' with GID 972. Creating user 'git' (git daemon user) with UID 972 and GID 972. (2/4) Reloading system manager configuration... Skipped: Current root is not booted. (3/4) Arming ConditionNeedsUpdate... (4/4) Warn about old perl modules [?25h==> Retrieving sources...  -> Found fix-test-many-source-for-filename-calls-timeout.patch ==> WARNING: Skipping all source file integrity checks. ==> Extracting sources...  -> Creating working copy of executing git repo... Cloning into 'executing'... done. Switched to a new branch 'makepkg' ==> Starting prepare()... patching file tests/test_main.py Hunk #1 succeeded at 309 (offset 11 lines). ==> Starting build()... * Building wheel... running bdist_wheel running build running build_py creating build creating build/lib creating build/lib/executing copying executing/__init__.py -> build/lib/executing copying executing/version.py -> build/lib/executing copying executing/executing.py -> build/lib/executing copying executing/_exceptions.py -> build/lib/executing copying executing/_position_node_finder.py -> build/lib/executing running egg_info creating executing.egg-info writing executing.egg-info/PKG-INFO writing dependency_links to executing.egg-info/dependency_links.txt writing requirements to executing.egg-info/requires.txt writing top-level names to executing.egg-info/top_level.txt writing manifest file 'executing.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE.txt' writing manifest file 'executing.egg-info/SOURCES.txt' copying executing/py.typed -> build/lib/executing installing to build/bdist.linux-riscv64/wheel running install running install_lib creating build/bdist.linux-riscv64 creating build/bdist.linux-riscv64/wheel creating build/bdist.linux-riscv64/wheel/executing copying build/lib/executing/__init__.py -> build/bdist.linux-riscv64/wheel/executing copying build/lib/executing/version.py -> build/bdist.linux-riscv64/wheel/executing copying build/lib/executing/executing.py -> build/bdist.linux-riscv64/wheel/executing copying build/lib/executing/py.typed -> build/bdist.linux-riscv64/wheel/executing copying build/lib/executing/_exceptions.py -> build/bdist.linux-riscv64/wheel/executing copying build/lib/executing/_position_node_finder.py -> build/bdist.linux-riscv64/wheel/executing running install_egg_info Copying executing.egg-info to build/bdist.linux-riscv64/wheel/executing-2.1.1.dev0+g8827340.d20240917-py3.12.egg-info running install_scripts creating build/bdist.linux-riscv64/wheel/executing-2.1.1.dev0+g8827340.d20240917.dist-info/WHEEL creating '/build/python-executing/src/executing/dist/.tmp-putplg37/executing-2.1.1.dev0+g8827340.d20240917-py2.py3-none-any.whl' and adding 'build/bdist.linux-riscv64/wheel' to it adding 'executing/__init__.py' adding 'executing/_exceptions.py' adding 'executing/_position_node_finder.py' adding 'executing/executing.py' adding 'executing/py.typed' adding 'executing/version.py' adding 'executing-2.1.1.dev0+g8827340.d20240917.dist-info/LICENSE.txt' adding 'executing-2.1.1.dev0+g8827340.d20240917.dist-info/METADATA' adding 'executing-2.1.1.dev0+g8827340.d20240917.dist-info/WHEEL' adding 'executing-2.1.1.dev0+g8827340.d20240917.dist-info/top_level.txt' adding 'executing-2.1.1.dev0+g8827340.d20240917.dist-info/RECORD' removing build/bdist.linux-riscv64/wheel Successfully built executing-2.1.1.dev0+g8827340.d20240917-py2.py3-none-any.whl ==> Starting check()... ============================= test session starts ============================== platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0 rootdir: /build/python-executing/src/executing configfile: pyproject.toml collected 208 items tests/test_ipython.py .. [ 0%] tests/test_main.py ...............F..ss............F.................... [ 26%] ...F.F.................................................................. [ 61%] F.......F............................................sssssssssssssss. [ 94%] tests/test_pytest.py ............ [100%] =================================== FAILURES =================================== _____________________________ TestStuff.test_iter ______________________________ self = def test_iter(self): class iter_test: def __init__(self, typ): self.typ = typ self.it = iter([1, 2]) def __iter__(self): assert isinstance(calling_expression(), self.typ) return self def __next__(self): assert isinstance(calling_expression(), self.typ) return next(self.it) assert list(iter_test(ast.Call)) == [1, 2] assert next(iter(iter_test(ast.Call))) == 1 if sys.version_info >= (3, 11): > assert [i for i in iter_test(ast.ListComp)] == [1, 2] tests/test_main.py:607: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_main.py:595: in __iter__ assert isinstance(calling_expression(), self.typ) tests/test_main.py:48: in calling_expression return Source.executing(frame).node executing/executing.py:273: in executing node_finder = NodeFinder(frame, stmts, tree, lasti, source) executing/_position_node_finder.py:170: in __init__ self.verify(self.result, instruction) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = node = instruction = Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', offset=268, starts_line=None, is_jump_target=False, positions=Positions(lineno=607, end_lineno=607, col_offset=31, end_col_offset=54)) def verify(self, node: EnhancedAST, instruction: dis.Instruction) -> None: """ checks if this node could gererate this instruction """ op_name = instruction.opname extra_filter: Callable[[EnhancedAST], bool] = lambda e: True ctx: Type = type(None) def inst_match(opnames: Union[str, Sequence[str]], **kwargs: Any) -> bool: """ match instruction Parameters: opnames: (str|Seq[str]): inst.opname has to be equal to or in `opname` **kwargs: every arg has to match inst.arg Returns: True if all conditions match the instruction """ if isinstance(opnames, str): opnames = [opnames] return instruction.opname in opnames and kwargs == { k: getattr(instruction, k) for k in kwargs } def node_match(node_type: Union[Type, Tuple[Type, ...]], **kwargs: Any) -> bool: """ match the ast-node Parameters: node_type: type of the node **kwargs: every `arg` has to be equal `node.arg` or `node.arg` has to be an instance of `arg` if it is a type. """ return isinstance(node, node_type) and all( isinstance(getattr(node, k), v) if isinstance(v, type) else getattr(node, k) == v for k, v in kwargs.items() ) if op_name == "CACHE": return if inst_match("CALL") and node_match((ast.With, ast.AsyncWith)): # call to context.__exit__ return if inst_match(("CALL", "LOAD_FAST")) and node_match( (ast.ListComp, ast.GeneratorExp, ast.SetComp, ast.DictComp) ): # call to the generator function return if ( sys.version_info >= (3, 12) and inst_match(("LOAD_FAST_AND_CLEAR", "STORE_FAST")) and node_match((ast.ListComp, ast.SetComp, ast.DictComp)) ): return if inst_match(("CALL", "CALL_FUNCTION_EX")) and node_match( (ast.ClassDef, ast.Call) ): return if inst_match(("COMPARE_OP", "IS_OP", "CONTAINS_OP")) and node_match( ast.Compare ): return if inst_match("LOAD_NAME", argval="__annotations__") and node_match( ast.AnnAssign ): return if ( ( inst_match("LOAD_METHOD", argval="join") or inst_match("LOAD_ATTR", argval="join") # 3.12 or inst_match(("CALL", "BUILD_STRING")) ) and node_match(ast.BinOp, left=ast.Constant, op=ast.Mod) and isinstance(cast(ast.Constant, cast(ast.BinOp, node).left).value, str) ): # "..."%(...) uses "".join return if inst_match("STORE_SUBSCR") and node_match(ast.AnnAssign): # data: int return if inst_match(("DELETE_NAME", "DELETE_FAST")) and node_match( ast.Name, id=instruction.argval, ctx=ast.Del ): return if inst_match("BUILD_STRING") and ( node_match(ast.JoinedStr) or node_match(ast.BinOp, op=ast.Mod) ): return if inst_match(("BEFORE_WITH","WITH_EXCEPT_START")) and node_match(ast.With): return if inst_match(("STORE_NAME", "STORE_GLOBAL"), argval="__doc__") and node_match( ast.Constant ): # store docstrings return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_GLOBAL", "STORE_DEREF")) and node_match(ast.ExceptHandler) and instruction.argval == mangled_name(node) ): # store exception in variable return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_DEREF", "STORE_GLOBAL")) and node_match((ast.Import, ast.ImportFrom)) and any(mangled_name(cast(EnhancedAST, alias)) == instruction.argval for alias in cast(ast.Import, node).names) ): # store imported module in variable return if ( inst_match(("STORE_FAST", "STORE_DEREF", "STORE_NAME", "STORE_GLOBAL")) and ( node_match((ast.FunctionDef, ast.ClassDef, ast.AsyncFunctionDef)) or node_match( ast.Name, ctx=ast.Store, ) ) and instruction.argval == mangled_name(node) ): return if False: # TODO: match expressions are not supported for now if inst_match(("STORE_FAST", "STORE_NAME")) and node_match( ast.MatchAs, name=instruction.argval ): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchSequence): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchValue): return if inst_match("BINARY_OP") and node_match( ast.AugAssign, op=op_type_map[instruction.argrepr.removesuffix("=")] ): # a+=5 return if node_match(ast.Attribute, ctx=ast.Del) and inst_match( "DELETE_ATTR", argval=mangled_name(node) ): return if inst_match( ( "JUMP_IF_TRUE_OR_POP", "JUMP_IF_FALSE_OR_POP", "POP_JUMP_IF_TRUE", "POP_JUMP_IF_FALSE", ) ) and node_match(ast.BoolOp): # and/or short circuit return if inst_match("DELETE_SUBSCR") and node_match(ast.Subscript, ctx=ast.Del): return if ( node_match(ast.Name, ctx=ast.Load) or ( node_match(ast.Name, ctx=ast.Store) and isinstance(node.parent, ast.AugAssign) ) ) and inst_match( ( "LOAD_NAME", "LOAD_FAST", "LOAD_FAST_CHECK", "LOAD_GLOBAL", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF", ), argval=mangled_name(node), ): return if node_match(ast.Name, ctx=ast.Del) and inst_match( ("DELETE_NAME", "DELETE_GLOBAL", "DELETE_DEREF"), argval=mangled_name(node) ): return if node_match(ast.Constant) and inst_match( "LOAD_CONST", argval=cast(ast.Constant, node).value ): return if node_match( (ast.ListComp, ast.SetComp, ast.DictComp, ast.GeneratorExp, ast.For) ) and inst_match(("GET_ITER", "FOR_ITER")): return if sys.version_info >= (3, 12): if node_match(ast.UnaryOp, op=ast.UAdd) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_UNARY_POSITIVE" ): return if node_match(ast.Subscript) and inst_match("BINARY_SLICE"): return if node_match(ast.ImportFrom) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_IMPORT_STAR" ): return if ( node_match(ast.Yield) or isinstance(node.parent, ast.GeneratorExp) ) and inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_ASYNC_GEN_WRAP"): return if node_match(ast.Name) and inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match(ast.TypeVar) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVAR") or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_BOUND" ) or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_CONSTRAINTS" ) or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=mangled_name(node)) ): return if node_match(ast.TypeVarTuple) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVARTUPLE") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name) ): return if node_match(ast.ParamSpec) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_PARAMSPEC") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name)): return if node_match(ast.TypeAlias): if( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEALIAS") or inst_match( ("STORE_NAME", "STORE_FAST", "STORE_DEREF"), argrepr=node.name.id ) or inst_match("CALL") ): return if node_match(ast.ClassDef) and node.type_params: if inst_match( ("STORE_DEREF", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF"), argrepr=".type_params", ): return if inst_match(("STORE_FAST", "LOAD_FAST"), argrepr=".generic_base"): return if inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_SUBSCRIPT_GENERIC" ): return if inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match((ast.FunctionDef,ast.AsyncFunctionDef)) and node.type_params: if inst_match("CALL"): return if inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_SET_FUNCTION_TYPE_PARAMS" ): return if inst_match("LOAD_FAST",argval=".defaults"): return if inst_match("LOAD_FAST",argval=".kwdefaults"): return if inst_match("STORE_NAME", argval="__classdictcell__"): # this is a general thing return # f-strings if node_match(ast.JoinedStr) and ( inst_match("LOAD_ATTR", argval="join") or inst_match(("LIST_APPEND", "CALL")) ): return if node_match(ast.FormattedValue) and inst_match("FORMAT_VALUE"): return if sys.version_info >= (3, 13): if inst_match("NOP"): return if inst_match("TO_BOOL") and node_match(ast.BoolOp): return if inst_match("CALL_KW") and node_match((ast.Call, ast.ClassDef)): return if inst_match("LOAD_FAST", argval=".type_params"): return if inst_match("LOAD_FAST", argval="__classdict__"): return if inst_match("LOAD_FAST") and node_match( ( ast.FunctionDef, ast.ClassDef, ast.TypeAlias, ast.TypeVar, ast.Lambda, ast.AsyncFunctionDef, ) ): # These are loads for closure variables. # It is difficult to check that this is actually closure variable, see: # https://github.com/alexmojaki/executing/pull/80#discussion_r1716027317 return if ( inst_match("LOAD_FAST") and node_match(ast.TypeAlias) and node.name.id == instruction.argval ): return if inst_match("STORE_NAME",argval="__static_attributes__"): # the node is the first node in the body return if inst_match("LOAD_FAST") and isinstance(node.parent,ast.TypeVar): return # old verifier typ: Type = type(None) op_type: Type = type(None) if op_name.startswith(("BINARY_SUBSCR", "SLICE+")): typ = ast.Subscript ctx = ast.Load elif op_name.startswith("BINARY_"): typ = ast.BinOp op_type = op_type_map[instruction.argrepr] extra_filter = lambda e: isinstance(cast(ast.BinOp, e).op, op_type) elif op_name.startswith("UNARY_"): typ = ast.UnaryOp op_type = dict( UNARY_POSITIVE=ast.UAdd, UNARY_NEGATIVE=ast.USub, UNARY_NOT=ast.Not, UNARY_INVERT=ast.Invert, )[op_name] extra_filter = lambda e: isinstance(cast(ast.UnaryOp, e).op, op_type) elif op_name in ("LOAD_ATTR", "LOAD_METHOD", "LOOKUP_METHOD","LOAD_SUPER_ATTR"): typ = ast.Attribute ctx = ast.Load extra_filter = lambda e: mangled_name(e) == instruction.argval elif op_name in ( "LOAD_NAME", "LOAD_GLOBAL", "LOAD_FAST", "LOAD_DEREF", "LOAD_CLASSDEREF", ): typ = ast.Name ctx = ast.Load extra_filter = lambda e: cast(ast.Name, e).id == instruction.argval elif op_name in ("COMPARE_OP", "IS_OP", "CONTAINS_OP"): typ = ast.Compare extra_filter = lambda e: len(cast(ast.Compare, e).ops) == 1 elif op_name.startswith(("STORE_SLICE", "STORE_SUBSCR")): ctx = ast.Store typ = ast.Subscript elif op_name.startswith("STORE_ATTR"): ctx = ast.Store typ = ast.Attribute extra_filter = lambda e: mangled_name(e) == instruction.argval node_ctx = getattr(node, "ctx", None) ctx_match = ( ctx is not type(None) or not hasattr(node, "ctx") or isinstance(node_ctx, ctx) ) # check for old verifier if isinstance(node, typ) and ctx_match and extra_filter(node): return # generate error title = "ast.%s is not created from %s" % ( type(node).__name__, instruction.opname, ) > raise VerifierFailure(title, node, instruction) E executing._exceptions.VerifierFailure: ast.Call is not created from GET_ITER executing/_position_node_finder.py:878: VerifierFailure _____________________________ TestStuff.test_with ______________________________ self = def test_with(self): if sys.version_info >= (3, 11): > with tester: tests/test_main.py:576: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/utils.py:157: in __enter__ self.get_node(ast.With) tests/utils.py:35: in get_node ex = self.get_executing(inspect.currentframe().f_back.f_back) tests/utils.py:42: in get_executing return Source.executing(frame) executing/executing.py:273: in executing node_finder = NodeFinder(frame, stmts, tree, lasti, source) executing/_position_node_finder.py:170: in __init__ self.verify(self.result, instruction) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = node = instruction = Instruction(opname='BEFORE_WITH', opcode=53, arg=None, argval=None, argrepr='', offset=50, starts_line=None, is_jump_target=False, positions=Positions(lineno=576, end_lineno=576, col_offset=17, end_col_offset=23)) def verify(self, node: EnhancedAST, instruction: dis.Instruction) -> None: """ checks if this node could gererate this instruction """ op_name = instruction.opname extra_filter: Callable[[EnhancedAST], bool] = lambda e: True ctx: Type = type(None) def inst_match(opnames: Union[str, Sequence[str]], **kwargs: Any) -> bool: """ match instruction Parameters: opnames: (str|Seq[str]): inst.opname has to be equal to or in `opname` **kwargs: every arg has to match inst.arg Returns: True if all conditions match the instruction """ if isinstance(opnames, str): opnames = [opnames] return instruction.opname in opnames and kwargs == { k: getattr(instruction, k) for k in kwargs } def node_match(node_type: Union[Type, Tuple[Type, ...]], **kwargs: Any) -> bool: """ match the ast-node Parameters: node_type: type of the node **kwargs: every `arg` has to be equal `node.arg` or `node.arg` has to be an instance of `arg` if it is a type. """ return isinstance(node, node_type) and all( isinstance(getattr(node, k), v) if isinstance(v, type) else getattr(node, k) == v for k, v in kwargs.items() ) if op_name == "CACHE": return if inst_match("CALL") and node_match((ast.With, ast.AsyncWith)): # call to context.__exit__ return if inst_match(("CALL", "LOAD_FAST")) and node_match( (ast.ListComp, ast.GeneratorExp, ast.SetComp, ast.DictComp) ): # call to the generator function return if ( sys.version_info >= (3, 12) and inst_match(("LOAD_FAST_AND_CLEAR", "STORE_FAST")) and node_match((ast.ListComp, ast.SetComp, ast.DictComp)) ): return if inst_match(("CALL", "CALL_FUNCTION_EX")) and node_match( (ast.ClassDef, ast.Call) ): return if inst_match(("COMPARE_OP", "IS_OP", "CONTAINS_OP")) and node_match( ast.Compare ): return if inst_match("LOAD_NAME", argval="__annotations__") and node_match( ast.AnnAssign ): return if ( ( inst_match("LOAD_METHOD", argval="join") or inst_match("LOAD_ATTR", argval="join") # 3.12 or inst_match(("CALL", "BUILD_STRING")) ) and node_match(ast.BinOp, left=ast.Constant, op=ast.Mod) and isinstance(cast(ast.Constant, cast(ast.BinOp, node).left).value, str) ): # "..."%(...) uses "".join return if inst_match("STORE_SUBSCR") and node_match(ast.AnnAssign): # data: int return if inst_match(("DELETE_NAME", "DELETE_FAST")) and node_match( ast.Name, id=instruction.argval, ctx=ast.Del ): return if inst_match("BUILD_STRING") and ( node_match(ast.JoinedStr) or node_match(ast.BinOp, op=ast.Mod) ): return if inst_match(("BEFORE_WITH","WITH_EXCEPT_START")) and node_match(ast.With): return if inst_match(("STORE_NAME", "STORE_GLOBAL"), argval="__doc__") and node_match( ast.Constant ): # store docstrings return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_GLOBAL", "STORE_DEREF")) and node_match(ast.ExceptHandler) and instruction.argval == mangled_name(node) ): # store exception in variable return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_DEREF", "STORE_GLOBAL")) and node_match((ast.Import, ast.ImportFrom)) and any(mangled_name(cast(EnhancedAST, alias)) == instruction.argval for alias in cast(ast.Import, node).names) ): # store imported module in variable return if ( inst_match(("STORE_FAST", "STORE_DEREF", "STORE_NAME", "STORE_GLOBAL")) and ( node_match((ast.FunctionDef, ast.ClassDef, ast.AsyncFunctionDef)) or node_match( ast.Name, ctx=ast.Store, ) ) and instruction.argval == mangled_name(node) ): return if False: # TODO: match expressions are not supported for now if inst_match(("STORE_FAST", "STORE_NAME")) and node_match( ast.MatchAs, name=instruction.argval ): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchSequence): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchValue): return if inst_match("BINARY_OP") and node_match( ast.AugAssign, op=op_type_map[instruction.argrepr.removesuffix("=")] ): # a+=5 return if node_match(ast.Attribute, ctx=ast.Del) and inst_match( "DELETE_ATTR", argval=mangled_name(node) ): return if inst_match( ( "JUMP_IF_TRUE_OR_POP", "JUMP_IF_FALSE_OR_POP", "POP_JUMP_IF_TRUE", "POP_JUMP_IF_FALSE", ) ) and node_match(ast.BoolOp): # and/or short circuit return if inst_match("DELETE_SUBSCR") and node_match(ast.Subscript, ctx=ast.Del): return if ( node_match(ast.Name, ctx=ast.Load) or ( node_match(ast.Name, ctx=ast.Store) and isinstance(node.parent, ast.AugAssign) ) ) and inst_match( ( "LOAD_NAME", "LOAD_FAST", "LOAD_FAST_CHECK", "LOAD_GLOBAL", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF", ), argval=mangled_name(node), ): return if node_match(ast.Name, ctx=ast.Del) and inst_match( ("DELETE_NAME", "DELETE_GLOBAL", "DELETE_DEREF"), argval=mangled_name(node) ): return if node_match(ast.Constant) and inst_match( "LOAD_CONST", argval=cast(ast.Constant, node).value ): return if node_match( (ast.ListComp, ast.SetComp, ast.DictComp, ast.GeneratorExp, ast.For) ) and inst_match(("GET_ITER", "FOR_ITER")): return if sys.version_info >= (3, 12): if node_match(ast.UnaryOp, op=ast.UAdd) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_UNARY_POSITIVE" ): return if node_match(ast.Subscript) and inst_match("BINARY_SLICE"): return if node_match(ast.ImportFrom) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_IMPORT_STAR" ): return if ( node_match(ast.Yield) or isinstance(node.parent, ast.GeneratorExp) ) and inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_ASYNC_GEN_WRAP"): return if node_match(ast.Name) and inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match(ast.TypeVar) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVAR") or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_BOUND" ) or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_CONSTRAINTS" ) or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=mangled_name(node)) ): return if node_match(ast.TypeVarTuple) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVARTUPLE") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name) ): return if node_match(ast.ParamSpec) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_PARAMSPEC") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name)): return if node_match(ast.TypeAlias): if( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEALIAS") or inst_match( ("STORE_NAME", "STORE_FAST", "STORE_DEREF"), argrepr=node.name.id ) or inst_match("CALL") ): return if node_match(ast.ClassDef) and node.type_params: if inst_match( ("STORE_DEREF", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF"), argrepr=".type_params", ): return if inst_match(("STORE_FAST", "LOAD_FAST"), argrepr=".generic_base"): return if inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_SUBSCRIPT_GENERIC" ): return if inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match((ast.FunctionDef,ast.AsyncFunctionDef)) and node.type_params: if inst_match("CALL"): return if inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_SET_FUNCTION_TYPE_PARAMS" ): return if inst_match("LOAD_FAST",argval=".defaults"): return if inst_match("LOAD_FAST",argval=".kwdefaults"): return if inst_match("STORE_NAME", argval="__classdictcell__"): # this is a general thing return # f-strings if node_match(ast.JoinedStr) and ( inst_match("LOAD_ATTR", argval="join") or inst_match(("LIST_APPEND", "CALL")) ): return if node_match(ast.FormattedValue) and inst_match("FORMAT_VALUE"): return if sys.version_info >= (3, 13): if inst_match("NOP"): return if inst_match("TO_BOOL") and node_match(ast.BoolOp): return if inst_match("CALL_KW") and node_match((ast.Call, ast.ClassDef)): return if inst_match("LOAD_FAST", argval=".type_params"): return if inst_match("LOAD_FAST", argval="__classdict__"): return if inst_match("LOAD_FAST") and node_match( ( ast.FunctionDef, ast.ClassDef, ast.TypeAlias, ast.TypeVar, ast.Lambda, ast.AsyncFunctionDef, ) ): # These are loads for closure variables. # It is difficult to check that this is actually closure variable, see: # https://github.com/alexmojaki/executing/pull/80#discussion_r1716027317 return if ( inst_match("LOAD_FAST") and node_match(ast.TypeAlias) and node.name.id == instruction.argval ): return if inst_match("STORE_NAME",argval="__static_attributes__"): # the node is the first node in the body return if inst_match("LOAD_FAST") and isinstance(node.parent,ast.TypeVar): return # old verifier typ: Type = type(None) op_type: Type = type(None) if op_name.startswith(("BINARY_SUBSCR", "SLICE+")): typ = ast.Subscript ctx = ast.Load elif op_name.startswith("BINARY_"): typ = ast.BinOp op_type = op_type_map[instruction.argrepr] extra_filter = lambda e: isinstance(cast(ast.BinOp, e).op, op_type) elif op_name.startswith("UNARY_"): typ = ast.UnaryOp op_type = dict( UNARY_POSITIVE=ast.UAdd, UNARY_NEGATIVE=ast.USub, UNARY_NOT=ast.Not, UNARY_INVERT=ast.Invert, )[op_name] extra_filter = lambda e: isinstance(cast(ast.UnaryOp, e).op, op_type) elif op_name in ("LOAD_ATTR", "LOAD_METHOD", "LOOKUP_METHOD","LOAD_SUPER_ATTR"): typ = ast.Attribute ctx = ast.Load extra_filter = lambda e: mangled_name(e) == instruction.argval elif op_name in ( "LOAD_NAME", "LOAD_GLOBAL", "LOAD_FAST", "LOAD_DEREF", "LOAD_CLASSDEREF", ): typ = ast.Name ctx = ast.Load extra_filter = lambda e: cast(ast.Name, e).id == instruction.argval elif op_name in ("COMPARE_OP", "IS_OP", "CONTAINS_OP"): typ = ast.Compare extra_filter = lambda e: len(cast(ast.Compare, e).ops) == 1 elif op_name.startswith(("STORE_SLICE", "STORE_SUBSCR")): ctx = ast.Store typ = ast.Subscript elif op_name.startswith("STORE_ATTR"): ctx = ast.Store typ = ast.Attribute extra_filter = lambda e: mangled_name(e) == instruction.argval node_ctx = getattr(node, "ctx", None) ctx_match = ( ctx is not type(None) or not hasattr(node, "ctx") or isinstance(node_ctx, ctx) ) # check for old verifier if isinstance(node, typ) and ctx_match and extra_filter(node): return # generate error title = "ast.%s is not created from %s" % ( type(node).__name__, instruction.opname, ) > raise VerifierFailure(title, node, instruction) E executing._exceptions.VerifierFailure: ast.Name is not created from BEFORE_WITH executing/_position_node_finder.py:878: VerifierFailure _ test_small_samples[635d56ede8cbcb2824d42291eb9fe9288d5f09c768636aaa19984ffdfc91e9fe.py] _ full_filename = '/build/python-executing/src/executing/tests/small_samples/635d56ede8cbcb2824d42291eb9fe9288d5f09c768636aaa19984ffdfc91e9fe.py' result_filename = '/build/python-executing/src/executing/tests/sample_results/635d56ede8cbcb2824d42291eb9fe9288d5f09c768636aaa19984ffdfc91e9fe-py-3.12.json' @pytest.mark.parametrize( "full_filename,result_filename", list(sample_files("small_samples")) ) @pytest.mark.skipif(sys.version_info<(3,),reason="no 2.7 support") def test_small_samples(full_filename, result_filename): skip_sentinel = [ "load_deref", "4851dc1b626a95e97dbe0c53f96099d165b755dd1bd552c6ca771f7bca6d30f5", "508ccd0dcac13ecee6f0cea939b73ba5319c780ddbb6c496be96fe5614871d4a", "fc6eb521024986baa84af2634f638e40af090be4aa70ab3c22f3d022e8068228", "42a37b8a823eb2e510b967332661afd679c82c60b7177b992a47c16d81117c8a", "206e0609ff0589a0a32422ee902f09156af91746e27157c32c9595d12072f92a", ] skip_annotations = [ "d98e27d8963331b58e4e6b84c7580dafde4d9e2980ad4277ce55e6b186113c1d", "9b3db37076d3c7c76bdfd9badcc70d8047584433e1eea89f45014453d58bbc43", ] if any(s in full_filename for s in skip_sentinel) and sys.version_info < (3, 11): pytest.xfail("SentinelNodeFinder does not find some of the nodes (maybe a bug)") if any(s in full_filename for s in skip_annotations) and sys.version_info < (3, 7): pytest.xfail("no `from __future__ import annotations`") if ( (sys.version_info[:2] == (3, 7)) and "ad8aa993e6ee4eb5ee764d55f2e3fd636a99b2ecb8c5aff2b35fbb78a074ea30" in full_filename ): pytest.xfail("(i async for i in arange) can not be analyzed in 3.7") if ( (sys.version_info[:2] == (3, 5) or PYPY) and "1656dc52edd2385921104de7bb255ca369713f4b8c034ebeba5cf946058109bc" in full_filename ): pytest.skip("recursion takes to long in 3.5") > TestFiles().check_filename(full_filename, check_names=True) tests/test_main.py:751: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_main.py:888: in check_filename result = list(self.check_code(code, nodes, decorators, check_names=check_names)) tests/test_main.py:1243: in check_code ex = Source.executing(frame) executing/executing.py:273: in executing node_finder = NodeFinder(frame, stmts, tree, lasti, source) executing/_position_node_finder.py:170: in __init__ self.verify(self.result, instruction) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = node = instruction = Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=34, starts_line=None, is_jump_target=False, positions=Positions(lineno=16, end_lineno=16, col_offset=5, end_col_offset=9)) def verify(self, node: EnhancedAST, instruction: dis.Instruction) -> None: """ checks if this node could gererate this instruction """ op_name = instruction.opname extra_filter: Callable[[EnhancedAST], bool] = lambda e: True ctx: Type = type(None) def inst_match(opnames: Union[str, Sequence[str]], **kwargs: Any) -> bool: """ match instruction Parameters: opnames: (str|Seq[str]): inst.opname has to be equal to or in `opname` **kwargs: every arg has to match inst.arg Returns: True if all conditions match the instruction """ if isinstance(opnames, str): opnames = [opnames] return instruction.opname in opnames and kwargs == { k: getattr(instruction, k) for k in kwargs } def node_match(node_type: Union[Type, Tuple[Type, ...]], **kwargs: Any) -> bool: """ match the ast-node Parameters: node_type: type of the node **kwargs: every `arg` has to be equal `node.arg` or `node.arg` has to be an instance of `arg` if it is a type. """ return isinstance(node, node_type) and all( isinstance(getattr(node, k), v) if isinstance(v, type) else getattr(node, k) == v for k, v in kwargs.items() ) if op_name == "CACHE": return if inst_match("CALL") and node_match((ast.With, ast.AsyncWith)): # call to context.__exit__ return if inst_match(("CALL", "LOAD_FAST")) and node_match( (ast.ListComp, ast.GeneratorExp, ast.SetComp, ast.DictComp) ): # call to the generator function return if ( sys.version_info >= (3, 12) and inst_match(("LOAD_FAST_AND_CLEAR", "STORE_FAST")) and node_match((ast.ListComp, ast.SetComp, ast.DictComp)) ): return if inst_match(("CALL", "CALL_FUNCTION_EX")) and node_match( (ast.ClassDef, ast.Call) ): return if inst_match(("COMPARE_OP", "IS_OP", "CONTAINS_OP")) and node_match( ast.Compare ): return if inst_match("LOAD_NAME", argval="__annotations__") and node_match( ast.AnnAssign ): return if ( ( inst_match("LOAD_METHOD", argval="join") or inst_match("LOAD_ATTR", argval="join") # 3.12 or inst_match(("CALL", "BUILD_STRING")) ) and node_match(ast.BinOp, left=ast.Constant, op=ast.Mod) and isinstance(cast(ast.Constant, cast(ast.BinOp, node).left).value, str) ): # "..."%(...) uses "".join return if inst_match("STORE_SUBSCR") and node_match(ast.AnnAssign): # data: int return if inst_match(("DELETE_NAME", "DELETE_FAST")) and node_match( ast.Name, id=instruction.argval, ctx=ast.Del ): return if inst_match("BUILD_STRING") and ( node_match(ast.JoinedStr) or node_match(ast.BinOp, op=ast.Mod) ): return if inst_match(("BEFORE_WITH","WITH_EXCEPT_START")) and node_match(ast.With): return if inst_match(("STORE_NAME", "STORE_GLOBAL"), argval="__doc__") and node_match( ast.Constant ): # store docstrings return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_GLOBAL", "STORE_DEREF")) and node_match(ast.ExceptHandler) and instruction.argval == mangled_name(node) ): # store exception in variable return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_DEREF", "STORE_GLOBAL")) and node_match((ast.Import, ast.ImportFrom)) and any(mangled_name(cast(EnhancedAST, alias)) == instruction.argval for alias in cast(ast.Import, node).names) ): # store imported module in variable return if ( inst_match(("STORE_FAST", "STORE_DEREF", "STORE_NAME", "STORE_GLOBAL")) and ( node_match((ast.FunctionDef, ast.ClassDef, ast.AsyncFunctionDef)) or node_match( ast.Name, ctx=ast.Store, ) ) and instruction.argval == mangled_name(node) ): return if False: # TODO: match expressions are not supported for now if inst_match(("STORE_FAST", "STORE_NAME")) and node_match( ast.MatchAs, name=instruction.argval ): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchSequence): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchValue): return if inst_match("BINARY_OP") and node_match( ast.AugAssign, op=op_type_map[instruction.argrepr.removesuffix("=")] ): # a+=5 return if node_match(ast.Attribute, ctx=ast.Del) and inst_match( "DELETE_ATTR", argval=mangled_name(node) ): return if inst_match( ( "JUMP_IF_TRUE_OR_POP", "JUMP_IF_FALSE_OR_POP", "POP_JUMP_IF_TRUE", "POP_JUMP_IF_FALSE", ) ) and node_match(ast.BoolOp): # and/or short circuit return if inst_match("DELETE_SUBSCR") and node_match(ast.Subscript, ctx=ast.Del): return if ( node_match(ast.Name, ctx=ast.Load) or ( node_match(ast.Name, ctx=ast.Store) and isinstance(node.parent, ast.AugAssign) ) ) and inst_match( ( "LOAD_NAME", "LOAD_FAST", "LOAD_FAST_CHECK", "LOAD_GLOBAL", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF", ), argval=mangled_name(node), ): return if node_match(ast.Name, ctx=ast.Del) and inst_match( ("DELETE_NAME", "DELETE_GLOBAL", "DELETE_DEREF"), argval=mangled_name(node) ): return if node_match(ast.Constant) and inst_match( "LOAD_CONST", argval=cast(ast.Constant, node).value ): return if node_match( (ast.ListComp, ast.SetComp, ast.DictComp, ast.GeneratorExp, ast.For) ) and inst_match(("GET_ITER", "FOR_ITER")): return if sys.version_info >= (3, 12): if node_match(ast.UnaryOp, op=ast.UAdd) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_UNARY_POSITIVE" ): return if node_match(ast.Subscript) and inst_match("BINARY_SLICE"): return if node_match(ast.ImportFrom) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_IMPORT_STAR" ): return if ( node_match(ast.Yield) or isinstance(node.parent, ast.GeneratorExp) ) and inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_ASYNC_GEN_WRAP"): return if node_match(ast.Name) and inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match(ast.TypeVar) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVAR") or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_BOUND" ) or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_CONSTRAINTS" ) or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=mangled_name(node)) ): return if node_match(ast.TypeVarTuple) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVARTUPLE") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name) ): return if node_match(ast.ParamSpec) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_PARAMSPEC") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name)): return if node_match(ast.TypeAlias): if( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEALIAS") or inst_match( ("STORE_NAME", "STORE_FAST", "STORE_DEREF"), argrepr=node.name.id ) or inst_match("CALL") ): return if node_match(ast.ClassDef) and node.type_params: if inst_match( ("STORE_DEREF", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF"), argrepr=".type_params", ): return if inst_match(("STORE_FAST", "LOAD_FAST"), argrepr=".generic_base"): return if inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_SUBSCRIPT_GENERIC" ): return if inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match((ast.FunctionDef,ast.AsyncFunctionDef)) and node.type_params: if inst_match("CALL"): return if inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_SET_FUNCTION_TYPE_PARAMS" ): return if inst_match("LOAD_FAST",argval=".defaults"): return if inst_match("LOAD_FAST",argval=".kwdefaults"): return if inst_match("STORE_NAME", argval="__classdictcell__"): # this is a general thing return # f-strings if node_match(ast.JoinedStr) and ( inst_match("LOAD_ATTR", argval="join") or inst_match(("LIST_APPEND", "CALL")) ): return if node_match(ast.FormattedValue) and inst_match("FORMAT_VALUE"): return if sys.version_info >= (3, 13): if inst_match("NOP"): return if inst_match("TO_BOOL") and node_match(ast.BoolOp): return if inst_match("CALL_KW") and node_match((ast.Call, ast.ClassDef)): return if inst_match("LOAD_FAST", argval=".type_params"): return if inst_match("LOAD_FAST", argval="__classdict__"): return if inst_match("LOAD_FAST") and node_match( ( ast.FunctionDef, ast.ClassDef, ast.TypeAlias, ast.TypeVar, ast.Lambda, ast.AsyncFunctionDef, ) ): # These are loads for closure variables. # It is difficult to check that this is actually closure variable, see: # https://github.com/alexmojaki/executing/pull/80#discussion_r1716027317 return if ( inst_match("LOAD_FAST") and node_match(ast.TypeAlias) and node.name.id == instruction.argval ): return if inst_match("STORE_NAME",argval="__static_attributes__"): # the node is the first node in the body return if inst_match("LOAD_FAST") and isinstance(node.parent,ast.TypeVar): return # old verifier typ: Type = type(None) op_type: Type = type(None) if op_name.startswith(("BINARY_SUBSCR", "SLICE+")): typ = ast.Subscript ctx = ast.Load elif op_name.startswith("BINARY_"): typ = ast.BinOp op_type = op_type_map[instruction.argrepr] extra_filter = lambda e: isinstance(cast(ast.BinOp, e).op, op_type) elif op_name.startswith("UNARY_"): typ = ast.UnaryOp op_type = dict( UNARY_POSITIVE=ast.UAdd, UNARY_NEGATIVE=ast.USub, UNARY_NOT=ast.Not, UNARY_INVERT=ast.Invert, )[op_name] extra_filter = lambda e: isinstance(cast(ast.UnaryOp, e).op, op_type) elif op_name in ("LOAD_ATTR", "LOAD_METHOD", "LOOKUP_METHOD","LOAD_SUPER_ATTR"): typ = ast.Attribute ctx = ast.Load extra_filter = lambda e: mangled_name(e) == instruction.argval elif op_name in ( "LOAD_NAME", "LOAD_GLOBAL", "LOAD_FAST", "LOAD_DEREF", "LOAD_CLASSDEREF", ): typ = ast.Name ctx = ast.Load extra_filter = lambda e: cast(ast.Name, e).id == instruction.argval elif op_name in ("COMPARE_OP", "IS_OP", "CONTAINS_OP"): typ = ast.Compare extra_filter = lambda e: len(cast(ast.Compare, e).ops) == 1 elif op_name.startswith(("STORE_SLICE", "STORE_SUBSCR")): ctx = ast.Store typ = ast.Subscript elif op_name.startswith("STORE_ATTR"): ctx = ast.Store typ = ast.Attribute extra_filter = lambda e: mangled_name(e) == instruction.argval node_ctx = getattr(node, "ctx", None) ctx_match = ( ctx is not type(None) or not hasattr(node, "ctx") or isinstance(node_ctx, ctx) ) # check for old verifier if isinstance(node, typ) and ctx_match and extra_filter(node): return # generate error title = "ast.%s is not created from %s" % ( type(node).__name__, instruction.opname, ) > raise VerifierFailure(title, node, instruction) E executing._exceptions.VerifierFailure: ast.Name is not created from CALL executing/_position_node_finder.py:878: VerifierFailure ----------------------------- Captured stdout call ----------------------------- check /build/python-executing/src/executing/tests/small_samples/635d56ede8cbcb2824d42291eb9fe9288d5f09c768636aaa19984ffdfc91e9fe.py VerifierFailure: ast.Name is not created from CALL instruction: Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=34, starts_line=None, is_jump_target=False, positions=Positions(lineno=16, end_lineno=16, col_offset=5, end_col_offset=9)) node: Name(id='self', ctx=Load(), lineno=16, col_offset=5, end_lineno=16, end_col_offset=9) parent node: withitem source code: 12: # if else_is_dead and not contains_break(node.body): 13: # # for a in l: 14: # 15: 16: with self: 17: for _ in tester: 18: pass 19: else: 20: tester None bytecode: _ test_small_samples[2fa69a57eb3b16f9ce0d5be427ad471c93a54c6d7e68b5be024b6a046ecc6bb2.py] _ full_filename = '/build/python-executing/src/executing/tests/small_samples/2fa69a57eb3b16f9ce0d5be427ad471c93a54c6d7e68b5be024b6a046ecc6bb2.py' result_filename = '/build/python-executing/src/executing/tests/sample_results/2fa69a57eb3b16f9ce0d5be427ad471c93a54c6d7e68b5be024b6a046ecc6bb2-py-3.12.json' @pytest.mark.parametrize( "full_filename,result_filename", list(sample_files("small_samples")) ) @pytest.mark.skipif(sys.version_info<(3,),reason="no 2.7 support") def test_small_samples(full_filename, result_filename): skip_sentinel = [ "load_deref", "4851dc1b626a95e97dbe0c53f96099d165b755dd1bd552c6ca771f7bca6d30f5", "508ccd0dcac13ecee6f0cea939b73ba5319c780ddbb6c496be96fe5614871d4a", "fc6eb521024986baa84af2634f638e40af090be4aa70ab3c22f3d022e8068228", "42a37b8a823eb2e510b967332661afd679c82c60b7177b992a47c16d81117c8a", "206e0609ff0589a0a32422ee902f09156af91746e27157c32c9595d12072f92a", ] skip_annotations = [ "d98e27d8963331b58e4e6b84c7580dafde4d9e2980ad4277ce55e6b186113c1d", "9b3db37076d3c7c76bdfd9badcc70d8047584433e1eea89f45014453d58bbc43", ] if any(s in full_filename for s in skip_sentinel) and sys.version_info < (3, 11): pytest.xfail("SentinelNodeFinder does not find some of the nodes (maybe a bug)") if any(s in full_filename for s in skip_annotations) and sys.version_info < (3, 7): pytest.xfail("no `from __future__ import annotations`") if ( (sys.version_info[:2] == (3, 7)) and "ad8aa993e6ee4eb5ee764d55f2e3fd636a99b2ecb8c5aff2b35fbb78a074ea30" in full_filename ): pytest.xfail("(i async for i in arange) can not be analyzed in 3.7") if ( (sys.version_info[:2] == (3, 5) or PYPY) and "1656dc52edd2385921104de7bb255ca369713f4b8c034ebeba5cf946058109bc" in full_filename ): pytest.skip("recursion takes to long in 3.5") > TestFiles().check_filename(full_filename, check_names=True) tests/test_main.py:751: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_main.py:888: in check_filename result = list(self.check_code(code, nodes, decorators, check_names=check_names)) tests/test_main.py:1243: in check_code ex = Source.executing(frame) executing/executing.py:273: in executing node_finder = NodeFinder(frame, stmts, tree, lasti, source) executing/_position_node_finder.py:170: in __init__ self.verify(self.result, instruction) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = node = instruction = Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=26, starts_line=None, is_jump_target=False, positions=Positions(lineno=16, end_lineno=16, col_offset=5, end_col_offset=9)) def verify(self, node: EnhancedAST, instruction: dis.Instruction) -> None: """ checks if this node could gererate this instruction """ op_name = instruction.opname extra_filter: Callable[[EnhancedAST], bool] = lambda e: True ctx: Type = type(None) def inst_match(opnames: Union[str, Sequence[str]], **kwargs: Any) -> bool: """ match instruction Parameters: opnames: (str|Seq[str]): inst.opname has to be equal to or in `opname` **kwargs: every arg has to match inst.arg Returns: True if all conditions match the instruction """ if isinstance(opnames, str): opnames = [opnames] return instruction.opname in opnames and kwargs == { k: getattr(instruction, k) for k in kwargs } def node_match(node_type: Union[Type, Tuple[Type, ...]], **kwargs: Any) -> bool: """ match the ast-node Parameters: node_type: type of the node **kwargs: every `arg` has to be equal `node.arg` or `node.arg` has to be an instance of `arg` if it is a type. """ return isinstance(node, node_type) and all( isinstance(getattr(node, k), v) if isinstance(v, type) else getattr(node, k) == v for k, v in kwargs.items() ) if op_name == "CACHE": return if inst_match("CALL") and node_match((ast.With, ast.AsyncWith)): # call to context.__exit__ return if inst_match(("CALL", "LOAD_FAST")) and node_match( (ast.ListComp, ast.GeneratorExp, ast.SetComp, ast.DictComp) ): # call to the generator function return if ( sys.version_info >= (3, 12) and inst_match(("LOAD_FAST_AND_CLEAR", "STORE_FAST")) and node_match((ast.ListComp, ast.SetComp, ast.DictComp)) ): return if inst_match(("CALL", "CALL_FUNCTION_EX")) and node_match( (ast.ClassDef, ast.Call) ): return if inst_match(("COMPARE_OP", "IS_OP", "CONTAINS_OP")) and node_match( ast.Compare ): return if inst_match("LOAD_NAME", argval="__annotations__") and node_match( ast.AnnAssign ): return if ( ( inst_match("LOAD_METHOD", argval="join") or inst_match("LOAD_ATTR", argval="join") # 3.12 or inst_match(("CALL", "BUILD_STRING")) ) and node_match(ast.BinOp, left=ast.Constant, op=ast.Mod) and isinstance(cast(ast.Constant, cast(ast.BinOp, node).left).value, str) ): # "..."%(...) uses "".join return if inst_match("STORE_SUBSCR") and node_match(ast.AnnAssign): # data: int return if inst_match(("DELETE_NAME", "DELETE_FAST")) and node_match( ast.Name, id=instruction.argval, ctx=ast.Del ): return if inst_match("BUILD_STRING") and ( node_match(ast.JoinedStr) or node_match(ast.BinOp, op=ast.Mod) ): return if inst_match(("BEFORE_WITH","WITH_EXCEPT_START")) and node_match(ast.With): return if inst_match(("STORE_NAME", "STORE_GLOBAL"), argval="__doc__") and node_match( ast.Constant ): # store docstrings return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_GLOBAL", "STORE_DEREF")) and node_match(ast.ExceptHandler) and instruction.argval == mangled_name(node) ): # store exception in variable return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_DEREF", "STORE_GLOBAL")) and node_match((ast.Import, ast.ImportFrom)) and any(mangled_name(cast(EnhancedAST, alias)) == instruction.argval for alias in cast(ast.Import, node).names) ): # store imported module in variable return if ( inst_match(("STORE_FAST", "STORE_DEREF", "STORE_NAME", "STORE_GLOBAL")) and ( node_match((ast.FunctionDef, ast.ClassDef, ast.AsyncFunctionDef)) or node_match( ast.Name, ctx=ast.Store, ) ) and instruction.argval == mangled_name(node) ): return if False: # TODO: match expressions are not supported for now if inst_match(("STORE_FAST", "STORE_NAME")) and node_match( ast.MatchAs, name=instruction.argval ): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchSequence): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchValue): return if inst_match("BINARY_OP") and node_match( ast.AugAssign, op=op_type_map[instruction.argrepr.removesuffix("=")] ): # a+=5 return if node_match(ast.Attribute, ctx=ast.Del) and inst_match( "DELETE_ATTR", argval=mangled_name(node) ): return if inst_match( ( "JUMP_IF_TRUE_OR_POP", "JUMP_IF_FALSE_OR_POP", "POP_JUMP_IF_TRUE", "POP_JUMP_IF_FALSE", ) ) and node_match(ast.BoolOp): # and/or short circuit return if inst_match("DELETE_SUBSCR") and node_match(ast.Subscript, ctx=ast.Del): return if ( node_match(ast.Name, ctx=ast.Load) or ( node_match(ast.Name, ctx=ast.Store) and isinstance(node.parent, ast.AugAssign) ) ) and inst_match( ( "LOAD_NAME", "LOAD_FAST", "LOAD_FAST_CHECK", "LOAD_GLOBAL", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF", ), argval=mangled_name(node), ): return if node_match(ast.Name, ctx=ast.Del) and inst_match( ("DELETE_NAME", "DELETE_GLOBAL", "DELETE_DEREF"), argval=mangled_name(node) ): return if node_match(ast.Constant) and inst_match( "LOAD_CONST", argval=cast(ast.Constant, node).value ): return if node_match( (ast.ListComp, ast.SetComp, ast.DictComp, ast.GeneratorExp, ast.For) ) and inst_match(("GET_ITER", "FOR_ITER")): return if sys.version_info >= (3, 12): if node_match(ast.UnaryOp, op=ast.UAdd) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_UNARY_POSITIVE" ): return if node_match(ast.Subscript) and inst_match("BINARY_SLICE"): return if node_match(ast.ImportFrom) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_IMPORT_STAR" ): return if ( node_match(ast.Yield) or isinstance(node.parent, ast.GeneratorExp) ) and inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_ASYNC_GEN_WRAP"): return if node_match(ast.Name) and inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match(ast.TypeVar) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVAR") or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_BOUND" ) or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_CONSTRAINTS" ) or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=mangled_name(node)) ): return if node_match(ast.TypeVarTuple) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVARTUPLE") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name) ): return if node_match(ast.ParamSpec) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_PARAMSPEC") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name)): return if node_match(ast.TypeAlias): if( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEALIAS") or inst_match( ("STORE_NAME", "STORE_FAST", "STORE_DEREF"), argrepr=node.name.id ) or inst_match("CALL") ): return if node_match(ast.ClassDef) and node.type_params: if inst_match( ("STORE_DEREF", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF"), argrepr=".type_params", ): return if inst_match(("STORE_FAST", "LOAD_FAST"), argrepr=".generic_base"): return if inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_SUBSCRIPT_GENERIC" ): return if inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match((ast.FunctionDef,ast.AsyncFunctionDef)) and node.type_params: if inst_match("CALL"): return if inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_SET_FUNCTION_TYPE_PARAMS" ): return if inst_match("LOAD_FAST",argval=".defaults"): return if inst_match("LOAD_FAST",argval=".kwdefaults"): return if inst_match("STORE_NAME", argval="__classdictcell__"): # this is a general thing return # f-strings if node_match(ast.JoinedStr) and ( inst_match("LOAD_ATTR", argval="join") or inst_match(("LIST_APPEND", "CALL")) ): return if node_match(ast.FormattedValue) and inst_match("FORMAT_VALUE"): return if sys.version_info >= (3, 13): if inst_match("NOP"): return if inst_match("TO_BOOL") and node_match(ast.BoolOp): return if inst_match("CALL_KW") and node_match((ast.Call, ast.ClassDef)): return if inst_match("LOAD_FAST", argval=".type_params"): return if inst_match("LOAD_FAST", argval="__classdict__"): return if inst_match("LOAD_FAST") and node_match( ( ast.FunctionDef, ast.ClassDef, ast.TypeAlias, ast.TypeVar, ast.Lambda, ast.AsyncFunctionDef, ) ): # These are loads for closure variables. # It is difficult to check that this is actually closure variable, see: # https://github.com/alexmojaki/executing/pull/80#discussion_r1716027317 return if ( inst_match("LOAD_FAST") and node_match(ast.TypeAlias) and node.name.id == instruction.argval ): return if inst_match("STORE_NAME",argval="__static_attributes__"): # the node is the first node in the body return if inst_match("LOAD_FAST") and isinstance(node.parent,ast.TypeVar): return # old verifier typ: Type = type(None) op_type: Type = type(None) if op_name.startswith(("BINARY_SUBSCR", "SLICE+")): typ = ast.Subscript ctx = ast.Load elif op_name.startswith("BINARY_"): typ = ast.BinOp op_type = op_type_map[instruction.argrepr] extra_filter = lambda e: isinstance(cast(ast.BinOp, e).op, op_type) elif op_name.startswith("UNARY_"): typ = ast.UnaryOp op_type = dict( UNARY_POSITIVE=ast.UAdd, UNARY_NEGATIVE=ast.USub, UNARY_NOT=ast.Not, UNARY_INVERT=ast.Invert, )[op_name] extra_filter = lambda e: isinstance(cast(ast.UnaryOp, e).op, op_type) elif op_name in ("LOAD_ATTR", "LOAD_METHOD", "LOOKUP_METHOD","LOAD_SUPER_ATTR"): typ = ast.Attribute ctx = ast.Load extra_filter = lambda e: mangled_name(e) == instruction.argval elif op_name in ( "LOAD_NAME", "LOAD_GLOBAL", "LOAD_FAST", "LOAD_DEREF", "LOAD_CLASSDEREF", ): typ = ast.Name ctx = ast.Load extra_filter = lambda e: cast(ast.Name, e).id == instruction.argval elif op_name in ("COMPARE_OP", "IS_OP", "CONTAINS_OP"): typ = ast.Compare extra_filter = lambda e: len(cast(ast.Compare, e).ops) == 1 elif op_name.startswith(("STORE_SLICE", "STORE_SUBSCR")): ctx = ast.Store typ = ast.Subscript elif op_name.startswith("STORE_ATTR"): ctx = ast.Store typ = ast.Attribute extra_filter = lambda e: mangled_name(e) == instruction.argval node_ctx = getattr(node, "ctx", None) ctx_match = ( ctx is not type(None) or not hasattr(node, "ctx") or isinstance(node_ctx, ctx) ) # check for old verifier if isinstance(node, typ) and ctx_match and extra_filter(node): return # generate error title = "ast.%s is not created from %s" % ( type(node).__name__, instruction.opname, ) > raise VerifierFailure(title, node, instruction) E executing._exceptions.VerifierFailure: ast.Name is not created from CALL executing/_position_node_finder.py:878: VerifierFailure ----------------------------- Captured stdout call ----------------------------- check /build/python-executing/src/executing/tests/small_samples/2fa69a57eb3b16f9ce0d5be427ad471c93a54c6d7e68b5be024b6a046ecc6bb2.py VerifierFailure: ast.Name is not created from CALL instruction: Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=26, starts_line=None, is_jump_target=False, positions=Positions(lineno=16, end_lineno=16, col_offset=5, end_col_offset=9)) node: Name(id='self', ctx=Load(), lineno=16, col_offset=5, end_lineno=16, end_col_offset=9) parent node: withitem source code: 12: # self.walk_deadcode(node.msg, deadcode) 13: # deadcode = True 14: # 15: 16: with self as session: 17: assert isinstance 18: db_func None bytecode: _ test_small_samples[0675309754ba4277c9cb3c52d7131377fe69c7744a271e2b7471917dabb5aaa1.py] _ full_filename = '/build/python-executing/src/executing/tests/small_samples/0675309754ba4277c9cb3c52d7131377fe69c7744a271e2b7471917dabb5aaa1.py' result_filename = '/build/python-executing/src/executing/tests/sample_results/0675309754ba4277c9cb3c52d7131377fe69c7744a271e2b7471917dabb5aaa1-py-3.12.json' @pytest.mark.parametrize( "full_filename,result_filename", list(sample_files("small_samples")) ) @pytest.mark.skipif(sys.version_info<(3,),reason="no 2.7 support") def test_small_samples(full_filename, result_filename): skip_sentinel = [ "load_deref", "4851dc1b626a95e97dbe0c53f96099d165b755dd1bd552c6ca771f7bca6d30f5", "508ccd0dcac13ecee6f0cea939b73ba5319c780ddbb6c496be96fe5614871d4a", "fc6eb521024986baa84af2634f638e40af090be4aa70ab3c22f3d022e8068228", "42a37b8a823eb2e510b967332661afd679c82c60b7177b992a47c16d81117c8a", "206e0609ff0589a0a32422ee902f09156af91746e27157c32c9595d12072f92a", ] skip_annotations = [ "d98e27d8963331b58e4e6b84c7580dafde4d9e2980ad4277ce55e6b186113c1d", "9b3db37076d3c7c76bdfd9badcc70d8047584433e1eea89f45014453d58bbc43", ] if any(s in full_filename for s in skip_sentinel) and sys.version_info < (3, 11): pytest.xfail("SentinelNodeFinder does not find some of the nodes (maybe a bug)") if any(s in full_filename for s in skip_annotations) and sys.version_info < (3, 7): pytest.xfail("no `from __future__ import annotations`") if ( (sys.version_info[:2] == (3, 7)) and "ad8aa993e6ee4eb5ee764d55f2e3fd636a99b2ecb8c5aff2b35fbb78a074ea30" in full_filename ): pytest.xfail("(i async for i in arange) can not be analyzed in 3.7") if ( (sys.version_info[:2] == (3, 5) or PYPY) and "1656dc52edd2385921104de7bb255ca369713f4b8c034ebeba5cf946058109bc" in full_filename ): pytest.skip("recursion takes to long in 3.5") > TestFiles().check_filename(full_filename, check_names=True) tests/test_main.py:751: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_main.py:888: in check_filename result = list(self.check_code(code, nodes, decorators, check_names=check_names)) tests/test_main.py:1448: in check_code for x in self.check_code(inst.argval, nodes, decorators, check_names=check_names): tests/test_main.py:1243: in check_code ex = Source.executing(frame) executing/executing.py:273: in executing node_finder = NodeFinder(frame, stmts, tree, lasti, source) executing/_position_node_finder.py:170: in __init__ self.verify(self.result, instruction) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = node = instruction = Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=48, starts_line=None, is_jump_target=False, positions=Positions(lineno=2, end_lineno=2, col_offset=9, end_col_offset=15)) def verify(self, node: EnhancedAST, instruction: dis.Instruction) -> None: """ checks if this node could gererate this instruction """ op_name = instruction.opname extra_filter: Callable[[EnhancedAST], bool] = lambda e: True ctx: Type = type(None) def inst_match(opnames: Union[str, Sequence[str]], **kwargs: Any) -> bool: """ match instruction Parameters: opnames: (str|Seq[str]): inst.opname has to be equal to or in `opname` **kwargs: every arg has to match inst.arg Returns: True if all conditions match the instruction """ if isinstance(opnames, str): opnames = [opnames] return instruction.opname in opnames and kwargs == { k: getattr(instruction, k) for k in kwargs } def node_match(node_type: Union[Type, Tuple[Type, ...]], **kwargs: Any) -> bool: """ match the ast-node Parameters: node_type: type of the node **kwargs: every `arg` has to be equal `node.arg` or `node.arg` has to be an instance of `arg` if it is a type. """ return isinstance(node, node_type) and all( isinstance(getattr(node, k), v) if isinstance(v, type) else getattr(node, k) == v for k, v in kwargs.items() ) if op_name == "CACHE": return if inst_match("CALL") and node_match((ast.With, ast.AsyncWith)): # call to context.__exit__ return if inst_match(("CALL", "LOAD_FAST")) and node_match( (ast.ListComp, ast.GeneratorExp, ast.SetComp, ast.DictComp) ): # call to the generator function return if ( sys.version_info >= (3, 12) and inst_match(("LOAD_FAST_AND_CLEAR", "STORE_FAST")) and node_match((ast.ListComp, ast.SetComp, ast.DictComp)) ): return if inst_match(("CALL", "CALL_FUNCTION_EX")) and node_match( (ast.ClassDef, ast.Call) ): return if inst_match(("COMPARE_OP", "IS_OP", "CONTAINS_OP")) and node_match( ast.Compare ): return if inst_match("LOAD_NAME", argval="__annotations__") and node_match( ast.AnnAssign ): return if ( ( inst_match("LOAD_METHOD", argval="join") or inst_match("LOAD_ATTR", argval="join") # 3.12 or inst_match(("CALL", "BUILD_STRING")) ) and node_match(ast.BinOp, left=ast.Constant, op=ast.Mod) and isinstance(cast(ast.Constant, cast(ast.BinOp, node).left).value, str) ): # "..."%(...) uses "".join return if inst_match("STORE_SUBSCR") and node_match(ast.AnnAssign): # data: int return if inst_match(("DELETE_NAME", "DELETE_FAST")) and node_match( ast.Name, id=instruction.argval, ctx=ast.Del ): return if inst_match("BUILD_STRING") and ( node_match(ast.JoinedStr) or node_match(ast.BinOp, op=ast.Mod) ): return if inst_match(("BEFORE_WITH","WITH_EXCEPT_START")) and node_match(ast.With): return if inst_match(("STORE_NAME", "STORE_GLOBAL"), argval="__doc__") and node_match( ast.Constant ): # store docstrings return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_GLOBAL", "STORE_DEREF")) and node_match(ast.ExceptHandler) and instruction.argval == mangled_name(node) ): # store exception in variable return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_DEREF", "STORE_GLOBAL")) and node_match((ast.Import, ast.ImportFrom)) and any(mangled_name(cast(EnhancedAST, alias)) == instruction.argval for alias in cast(ast.Import, node).names) ): # store imported module in variable return if ( inst_match(("STORE_FAST", "STORE_DEREF", "STORE_NAME", "STORE_GLOBAL")) and ( node_match((ast.FunctionDef, ast.ClassDef, ast.AsyncFunctionDef)) or node_match( ast.Name, ctx=ast.Store, ) ) and instruction.argval == mangled_name(node) ): return if False: # TODO: match expressions are not supported for now if inst_match(("STORE_FAST", "STORE_NAME")) and node_match( ast.MatchAs, name=instruction.argval ): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchSequence): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchValue): return if inst_match("BINARY_OP") and node_match( ast.AugAssign, op=op_type_map[instruction.argrepr.removesuffix("=")] ): # a+=5 return if node_match(ast.Attribute, ctx=ast.Del) and inst_match( "DELETE_ATTR", argval=mangled_name(node) ): return if inst_match( ( "JUMP_IF_TRUE_OR_POP", "JUMP_IF_FALSE_OR_POP", "POP_JUMP_IF_TRUE", "POP_JUMP_IF_FALSE", ) ) and node_match(ast.BoolOp): # and/or short circuit return if inst_match("DELETE_SUBSCR") and node_match(ast.Subscript, ctx=ast.Del): return if ( node_match(ast.Name, ctx=ast.Load) or ( node_match(ast.Name, ctx=ast.Store) and isinstance(node.parent, ast.AugAssign) ) ) and inst_match( ( "LOAD_NAME", "LOAD_FAST", "LOAD_FAST_CHECK", "LOAD_GLOBAL", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF", ), argval=mangled_name(node), ): return if node_match(ast.Name, ctx=ast.Del) and inst_match( ("DELETE_NAME", "DELETE_GLOBAL", "DELETE_DEREF"), argval=mangled_name(node) ): return if node_match(ast.Constant) and inst_match( "LOAD_CONST", argval=cast(ast.Constant, node).value ): return if node_match( (ast.ListComp, ast.SetComp, ast.DictComp, ast.GeneratorExp, ast.For) ) and inst_match(("GET_ITER", "FOR_ITER")): return if sys.version_info >= (3, 12): if node_match(ast.UnaryOp, op=ast.UAdd) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_UNARY_POSITIVE" ): return if node_match(ast.Subscript) and inst_match("BINARY_SLICE"): return if node_match(ast.ImportFrom) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_IMPORT_STAR" ): return if ( node_match(ast.Yield) or isinstance(node.parent, ast.GeneratorExp) ) and inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_ASYNC_GEN_WRAP"): return if node_match(ast.Name) and inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match(ast.TypeVar) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVAR") or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_BOUND" ) or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_CONSTRAINTS" ) or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=mangled_name(node)) ): return if node_match(ast.TypeVarTuple) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVARTUPLE") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name) ): return if node_match(ast.ParamSpec) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_PARAMSPEC") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name)): return if node_match(ast.TypeAlias): if( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEALIAS") or inst_match( ("STORE_NAME", "STORE_FAST", "STORE_DEREF"), argrepr=node.name.id ) or inst_match("CALL") ): return if node_match(ast.ClassDef) and node.type_params: if inst_match( ("STORE_DEREF", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF"), argrepr=".type_params", ): return if inst_match(("STORE_FAST", "LOAD_FAST"), argrepr=".generic_base"): return if inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_SUBSCRIPT_GENERIC" ): return if inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match((ast.FunctionDef,ast.AsyncFunctionDef)) and node.type_params: if inst_match("CALL"): return if inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_SET_FUNCTION_TYPE_PARAMS" ): return if inst_match("LOAD_FAST",argval=".defaults"): return if inst_match("LOAD_FAST",argval=".kwdefaults"): return if inst_match("STORE_NAME", argval="__classdictcell__"): # this is a general thing return # f-strings if node_match(ast.JoinedStr) and ( inst_match("LOAD_ATTR", argval="join") or inst_match(("LIST_APPEND", "CALL")) ): return if node_match(ast.FormattedValue) and inst_match("FORMAT_VALUE"): return if sys.version_info >= (3, 13): if inst_match("NOP"): return if inst_match("TO_BOOL") and node_match(ast.BoolOp): return if inst_match("CALL_KW") and node_match((ast.Call, ast.ClassDef)): return if inst_match("LOAD_FAST", argval=".type_params"): return if inst_match("LOAD_FAST", argval="__classdict__"): return if inst_match("LOAD_FAST") and node_match( ( ast.FunctionDef, ast.ClassDef, ast.TypeAlias, ast.TypeVar, ast.Lambda, ast.AsyncFunctionDef, ) ): # These are loads for closure variables. # It is difficult to check that this is actually closure variable, see: # https://github.com/alexmojaki/executing/pull/80#discussion_r1716027317 return if ( inst_match("LOAD_FAST") and node_match(ast.TypeAlias) and node.name.id == instruction.argval ): return if inst_match("STORE_NAME",argval="__static_attributes__"): # the node is the first node in the body return if inst_match("LOAD_FAST") and isinstance(node.parent,ast.TypeVar): return # old verifier typ: Type = type(None) op_type: Type = type(None) if op_name.startswith(("BINARY_SUBSCR", "SLICE+")): typ = ast.Subscript ctx = ast.Load elif op_name.startswith("BINARY_"): typ = ast.BinOp op_type = op_type_map[instruction.argrepr] extra_filter = lambda e: isinstance(cast(ast.BinOp, e).op, op_type) elif op_name.startswith("UNARY_"): typ = ast.UnaryOp op_type = dict( UNARY_POSITIVE=ast.UAdd, UNARY_NEGATIVE=ast.USub, UNARY_NOT=ast.Not, UNARY_INVERT=ast.Invert, )[op_name] extra_filter = lambda e: isinstance(cast(ast.UnaryOp, e).op, op_type) elif op_name in ("LOAD_ATTR", "LOAD_METHOD", "LOOKUP_METHOD","LOAD_SUPER_ATTR"): typ = ast.Attribute ctx = ast.Load extra_filter = lambda e: mangled_name(e) == instruction.argval elif op_name in ( "LOAD_NAME", "LOAD_GLOBAL", "LOAD_FAST", "LOAD_DEREF", "LOAD_CLASSDEREF", ): typ = ast.Name ctx = ast.Load extra_filter = lambda e: cast(ast.Name, e).id == instruction.argval elif op_name in ("COMPARE_OP", "IS_OP", "CONTAINS_OP"): typ = ast.Compare extra_filter = lambda e: len(cast(ast.Compare, e).ops) == 1 elif op_name.startswith(("STORE_SLICE", "STORE_SUBSCR")): ctx = ast.Store typ = ast.Subscript elif op_name.startswith("STORE_ATTR"): ctx = ast.Store typ = ast.Attribute extra_filter = lambda e: mangled_name(e) == instruction.argval node_ctx = getattr(node, "ctx", None) ctx_match = ( ctx is not type(None) or not hasattr(node, "ctx") or isinstance(node_ctx, ctx) ) # check for old verifier if isinstance(node, typ) and ctx_match and extra_filter(node): return # generate error title = "ast.%s is not created from %s" % ( type(node).__name__, instruction.opname, ) > raise VerifierFailure(title, node, instruction) E executing._exceptions.VerifierFailure: ast.Name is not created from CALL executing/_position_node_finder.py:878: VerifierFailure ----------------------------- Captured stdout call ----------------------------- check /build/python-executing/src/executing/tests/small_samples/0675309754ba4277c9cb3c52d7131377fe69c7744a271e2b7471917dabb5aaa1.py VerifierFailure: ast.Name is not created from CALL instruction: Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=48, starts_line=None, is_jump_target=False, positions=Positions(lineno=2, end_lineno=2, col_offset=9, end_col_offset=15)) node: Name(id='name_0', ctx=Load(), lineno=2, col_offset=9, end_lineno=2, end_col_offset=15) parent node: withitem source code: 1: class name_2: 2: with name_0: # type: ignoresome text 3: 4: class name_2[name_5]: 5: pass None bytecode: _ test_small_samples[ea94f24a1d9b57c7a7d62c428082790caae2fa16429db2e58b2f4addb67a1964.py] _ full_filename = '/build/python-executing/src/executing/tests/small_samples/ea94f24a1d9b57c7a7d62c428082790caae2fa16429db2e58b2f4addb67a1964.py' result_filename = '/build/python-executing/src/executing/tests/sample_results/ea94f24a1d9b57c7a7d62c428082790caae2fa16429db2e58b2f4addb67a1964-py-3.12.json' @pytest.mark.parametrize( "full_filename,result_filename", list(sample_files("small_samples")) ) @pytest.mark.skipif(sys.version_info<(3,),reason="no 2.7 support") def test_small_samples(full_filename, result_filename): skip_sentinel = [ "load_deref", "4851dc1b626a95e97dbe0c53f96099d165b755dd1bd552c6ca771f7bca6d30f5", "508ccd0dcac13ecee6f0cea939b73ba5319c780ddbb6c496be96fe5614871d4a", "fc6eb521024986baa84af2634f638e40af090be4aa70ab3c22f3d022e8068228", "42a37b8a823eb2e510b967332661afd679c82c60b7177b992a47c16d81117c8a", "206e0609ff0589a0a32422ee902f09156af91746e27157c32c9595d12072f92a", ] skip_annotations = [ "d98e27d8963331b58e4e6b84c7580dafde4d9e2980ad4277ce55e6b186113c1d", "9b3db37076d3c7c76bdfd9badcc70d8047584433e1eea89f45014453d58bbc43", ] if any(s in full_filename for s in skip_sentinel) and sys.version_info < (3, 11): pytest.xfail("SentinelNodeFinder does not find some of the nodes (maybe a bug)") if any(s in full_filename for s in skip_annotations) and sys.version_info < (3, 7): pytest.xfail("no `from __future__ import annotations`") if ( (sys.version_info[:2] == (3, 7)) and "ad8aa993e6ee4eb5ee764d55f2e3fd636a99b2ecb8c5aff2b35fbb78a074ea30" in full_filename ): pytest.xfail("(i async for i in arange) can not be analyzed in 3.7") if ( (sys.version_info[:2] == (3, 5) or PYPY) and "1656dc52edd2385921104de7bb255ca369713f4b8c034ebeba5cf946058109bc" in full_filename ): pytest.skip("recursion takes to long in 3.5") > TestFiles().check_filename(full_filename, check_names=True) tests/test_main.py:751: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_main.py:888: in check_filename result = list(self.check_code(code, nodes, decorators, check_names=check_names)) tests/test_main.py:1448: in check_code for x in self.check_code(inst.argval, nodes, decorators, check_names=check_names): tests/test_main.py:1243: in check_code ex = Source.executing(frame) executing/executing.py:273: in executing node_finder = NodeFinder(frame, stmts, tree, lasti, source) executing/_position_node_finder.py:170: in __init__ self.verify(self.result, instruction) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = node = instruction = Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=84, starts_line=None, is_jump_target=False, positions=Positions(lineno=18, end_lineno=18, col_offset=9, end_col_offset=33)) def verify(self, node: EnhancedAST, instruction: dis.Instruction) -> None: """ checks if this node could gererate this instruction """ op_name = instruction.opname extra_filter: Callable[[EnhancedAST], bool] = lambda e: True ctx: Type = type(None) def inst_match(opnames: Union[str, Sequence[str]], **kwargs: Any) -> bool: """ match instruction Parameters: opnames: (str|Seq[str]): inst.opname has to be equal to or in `opname` **kwargs: every arg has to match inst.arg Returns: True if all conditions match the instruction """ if isinstance(opnames, str): opnames = [opnames] return instruction.opname in opnames and kwargs == { k: getattr(instruction, k) for k in kwargs } def node_match(node_type: Union[Type, Tuple[Type, ...]], **kwargs: Any) -> bool: """ match the ast-node Parameters: node_type: type of the node **kwargs: every `arg` has to be equal `node.arg` or `node.arg` has to be an instance of `arg` if it is a type. """ return isinstance(node, node_type) and all( isinstance(getattr(node, k), v) if isinstance(v, type) else getattr(node, k) == v for k, v in kwargs.items() ) if op_name == "CACHE": return if inst_match("CALL") and node_match((ast.With, ast.AsyncWith)): # call to context.__exit__ return if inst_match(("CALL", "LOAD_FAST")) and node_match( (ast.ListComp, ast.GeneratorExp, ast.SetComp, ast.DictComp) ): # call to the generator function return if ( sys.version_info >= (3, 12) and inst_match(("LOAD_FAST_AND_CLEAR", "STORE_FAST")) and node_match((ast.ListComp, ast.SetComp, ast.DictComp)) ): return if inst_match(("CALL", "CALL_FUNCTION_EX")) and node_match( (ast.ClassDef, ast.Call) ): return if inst_match(("COMPARE_OP", "IS_OP", "CONTAINS_OP")) and node_match( ast.Compare ): return if inst_match("LOAD_NAME", argval="__annotations__") and node_match( ast.AnnAssign ): return if ( ( inst_match("LOAD_METHOD", argval="join") or inst_match("LOAD_ATTR", argval="join") # 3.12 or inst_match(("CALL", "BUILD_STRING")) ) and node_match(ast.BinOp, left=ast.Constant, op=ast.Mod) and isinstance(cast(ast.Constant, cast(ast.BinOp, node).left).value, str) ): # "..."%(...) uses "".join return if inst_match("STORE_SUBSCR") and node_match(ast.AnnAssign): # data: int return if inst_match(("DELETE_NAME", "DELETE_FAST")) and node_match( ast.Name, id=instruction.argval, ctx=ast.Del ): return if inst_match("BUILD_STRING") and ( node_match(ast.JoinedStr) or node_match(ast.BinOp, op=ast.Mod) ): return if inst_match(("BEFORE_WITH","WITH_EXCEPT_START")) and node_match(ast.With): return if inst_match(("STORE_NAME", "STORE_GLOBAL"), argval="__doc__") and node_match( ast.Constant ): # store docstrings return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_GLOBAL", "STORE_DEREF")) and node_match(ast.ExceptHandler) and instruction.argval == mangled_name(node) ): # store exception in variable return if ( inst_match(("STORE_NAME", "STORE_FAST", "STORE_DEREF", "STORE_GLOBAL")) and node_match((ast.Import, ast.ImportFrom)) and any(mangled_name(cast(EnhancedAST, alias)) == instruction.argval for alias in cast(ast.Import, node).names) ): # store imported module in variable return if ( inst_match(("STORE_FAST", "STORE_DEREF", "STORE_NAME", "STORE_GLOBAL")) and ( node_match((ast.FunctionDef, ast.ClassDef, ast.AsyncFunctionDef)) or node_match( ast.Name, ctx=ast.Store, ) ) and instruction.argval == mangled_name(node) ): return if False: # TODO: match expressions are not supported for now if inst_match(("STORE_FAST", "STORE_NAME")) and node_match( ast.MatchAs, name=instruction.argval ): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchSequence): return if inst_match("COMPARE_OP", argval="==") and node_match(ast.MatchValue): return if inst_match("BINARY_OP") and node_match( ast.AugAssign, op=op_type_map[instruction.argrepr.removesuffix("=")] ): # a+=5 return if node_match(ast.Attribute, ctx=ast.Del) and inst_match( "DELETE_ATTR", argval=mangled_name(node) ): return if inst_match( ( "JUMP_IF_TRUE_OR_POP", "JUMP_IF_FALSE_OR_POP", "POP_JUMP_IF_TRUE", "POP_JUMP_IF_FALSE", ) ) and node_match(ast.BoolOp): # and/or short circuit return if inst_match("DELETE_SUBSCR") and node_match(ast.Subscript, ctx=ast.Del): return if ( node_match(ast.Name, ctx=ast.Load) or ( node_match(ast.Name, ctx=ast.Store) and isinstance(node.parent, ast.AugAssign) ) ) and inst_match( ( "LOAD_NAME", "LOAD_FAST", "LOAD_FAST_CHECK", "LOAD_GLOBAL", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF", ), argval=mangled_name(node), ): return if node_match(ast.Name, ctx=ast.Del) and inst_match( ("DELETE_NAME", "DELETE_GLOBAL", "DELETE_DEREF"), argval=mangled_name(node) ): return if node_match(ast.Constant) and inst_match( "LOAD_CONST", argval=cast(ast.Constant, node).value ): return if node_match( (ast.ListComp, ast.SetComp, ast.DictComp, ast.GeneratorExp, ast.For) ) and inst_match(("GET_ITER", "FOR_ITER")): return if sys.version_info >= (3, 12): if node_match(ast.UnaryOp, op=ast.UAdd) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_UNARY_POSITIVE" ): return if node_match(ast.Subscript) and inst_match("BINARY_SLICE"): return if node_match(ast.ImportFrom) and inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_IMPORT_STAR" ): return if ( node_match(ast.Yield) or isinstance(node.parent, ast.GeneratorExp) ) and inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_ASYNC_GEN_WRAP"): return if node_match(ast.Name) and inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match(ast.TypeVar) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVAR") or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_BOUND" ) or inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_TYPEVAR_WITH_CONSTRAINTS" ) or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=mangled_name(node)) ): return if node_match(ast.TypeVarTuple) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEVARTUPLE") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name) ): return if node_match(ast.ParamSpec) and ( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_PARAMSPEC") or inst_match(("STORE_FAST", "STORE_DEREF"), argrepr=node.name)): return if node_match(ast.TypeAlias): if( inst_match("CALL_INTRINSIC_1", argrepr="INTRINSIC_TYPEALIAS") or inst_match( ("STORE_NAME", "STORE_FAST", "STORE_DEREF"), argrepr=node.name.id ) or inst_match("CALL") ): return if node_match(ast.ClassDef) and node.type_params: if inst_match( ("STORE_DEREF", "LOAD_DEREF", "LOAD_FROM_DICT_OR_DEREF"), argrepr=".type_params", ): return if inst_match(("STORE_FAST", "LOAD_FAST"), argrepr=".generic_base"): return if inst_match( "CALL_INTRINSIC_1", argrepr="INTRINSIC_SUBSCRIPT_GENERIC" ): return if inst_match("LOAD_DEREF",argval="__classdict__"): return if node_match((ast.FunctionDef,ast.AsyncFunctionDef)) and node.type_params: if inst_match("CALL"): return if inst_match( "CALL_INTRINSIC_2", argrepr="INTRINSIC_SET_FUNCTION_TYPE_PARAMS" ): return if inst_match("LOAD_FAST",argval=".defaults"): return if inst_match("LOAD_FAST",argval=".kwdefaults"): return if inst_match("STORE_NAME", argval="__classdictcell__"): # this is a general thing return # f-strings if node_match(ast.JoinedStr) and ( inst_match("LOAD_ATTR", argval="join") or inst_match(("LIST_APPEND", "CALL")) ): return if node_match(ast.FormattedValue) and inst_match("FORMAT_VALUE"): return if sys.version_info >= (3, 13): if inst_match("NOP"): return if inst_match("TO_BOOL") and node_match(ast.BoolOp): return if inst_match("CALL_KW") and node_match((ast.Call, ast.ClassDef)): return if inst_match("LOAD_FAST", argval=".type_params"): return if inst_match("LOAD_FAST", argval="__classdict__"): return if inst_match("LOAD_FAST") and node_match( ( ast.FunctionDef, ast.ClassDef, ast.TypeAlias, ast.TypeVar, ast.Lambda, ast.AsyncFunctionDef, ) ): # These are loads for closure variables. # It is difficult to check that this is actually closure variable, see: # https://github.com/alexmojaki/executing/pull/80#discussion_r1716027317 return if ( inst_match("LOAD_FAST") and node_match(ast.TypeAlias) and node.name.id == instruction.argval ): return if inst_match("STORE_NAME",argval="__static_attributes__"): # the node is the first node in the body return if inst_match("LOAD_FAST") and isinstance(node.parent,ast.TypeVar): return # old verifier typ: Type = type(None) op_type: Type = type(None) if op_name.startswith(("BINARY_SUBSCR", "SLICE+")): typ = ast.Subscript ctx = ast.Load elif op_name.startswith("BINARY_"): typ = ast.BinOp op_type = op_type_map[instruction.argrepr] extra_filter = lambda e: isinstance(cast(ast.BinOp, e).op, op_type) elif op_name.startswith("UNARY_"): typ = ast.UnaryOp op_type = dict( UNARY_POSITIVE=ast.UAdd, UNARY_NEGATIVE=ast.USub, UNARY_NOT=ast.Not, UNARY_INVERT=ast.Invert, )[op_name] extra_filter = lambda e: isinstance(cast(ast.UnaryOp, e).op, op_type) elif op_name in ("LOAD_ATTR", "LOAD_METHOD", "LOOKUP_METHOD","LOAD_SUPER_ATTR"): typ = ast.Attribute ctx = ast.Load extra_filter = lambda e: mangled_name(e) == instruction.argval elif op_name in ( "LOAD_NAME", "LOAD_GLOBAL", "LOAD_FAST", "LOAD_DEREF", "LOAD_CLASSDEREF", ): typ = ast.Name ctx = ast.Load extra_filter = lambda e: cast(ast.Name, e).id == instruction.argval elif op_name in ("COMPARE_OP", "IS_OP", "CONTAINS_OP"): typ = ast.Compare extra_filter = lambda e: len(cast(ast.Compare, e).ops) == 1 elif op_name.startswith(("STORE_SLICE", "STORE_SUBSCR")): ctx = ast.Store typ = ast.Subscript elif op_name.startswith("STORE_ATTR"): ctx = ast.Store typ = ast.Attribute extra_filter = lambda e: mangled_name(e) == instruction.argval node_ctx = getattr(node, "ctx", None) ctx_match = ( ctx is not type(None) or not hasattr(node, "ctx") or isinstance(node_ctx, ctx) ) # check for old verifier if isinstance(node, typ) and ctx_match and extra_filter(node): return # generate error title = "ast.%s is not created from %s" % ( type(node).__name__, instruction.opname, ) > raise VerifierFailure(title, node, instruction) E executing._exceptions.VerifierFailure: ast.Name is not created from CALL executing/_position_node_finder.py:878: VerifierFailure ----------------------------- Captured stdout call ----------------------------- check /build/python-executing/src/executing/tests/small_samples/ea94f24a1d9b57c7a7d62c428082790caae2fa16429db2e58b2f4addb67a1964.py VerifierFailure: ast.Name is not created from CALL instruction: Instruction(opname='CALL', opcode=171, arg=2, argval=2, argrepr='', offset=84, starts_line=None, is_jump_target=False, positions=Positions(lineno=18, end_lineno=18, col_offset=9, end_col_offset=33)) node: Name(id='open_with_encoding_check', ctx=Load(), lineno=18, col_offset=9, end_lineno=18, end_col_offset=33) parent node: withitem source code: 14: # 15: 16: def read_source_file(filename): 17: from lib2to3.pgen2.tokenize import cookie_re 18: with open_with_encoding_check as f: 19: [cookie_re for i, line in enumerate] None bytecode: =============================== warnings summary =============================== tests/test_main.py::test_small_samples[4851dc1b626a95e97dbe0c53f96099d165b755dd1bd552c6ca771f7bca6d30f5.py] /build/python-executing/src/executing/tests/small_samples/4851dc1b626a95e97dbe0c53f96099d165b755dd1bd552c6ca771f7bca6d30f5.py:16: SyntaxWarning: "is" with 'int' literal. Did you mean "=="? if 1 < 1 > 1 == 1 >= 1 <= 1 != 1 in 1 not in 1 is 1 is not 1: -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED tests/test_main.py::TestStuff::test_iter - executing._exceptions.Verif... FAILED tests/test_main.py::TestStuff::test_with - executing._exceptions.Verif... FAILED tests/test_main.py::test_small_samples[635d56ede8cbcb2824d42291eb9fe9288d5f09c768636aaa19984ffdfc91e9fe.py] FAILED tests/test_main.py::test_small_samples[2fa69a57eb3b16f9ce0d5be427ad471c93a54c6d7e68b5be024b6a046ecc6bb2.py] FAILED tests/test_main.py::test_small_samples[0675309754ba4277c9cb3c52d7131377fe69c7744a271e2b7471917dabb5aaa1.py] FAILED tests/test_main.py::test_small_samples[ea94f24a1d9b57c7a7d62c428082790caae2fa16429db2e58b2f4addb67a1964.py] ============ 6 failed, 185 passed, 17 skipped, 1 warning in 40.19s ============= ==> ERROR: A failure occurred in check().  Aborting... ==> ERROR: Build failed, check /var/lib/archbuild/extra-riscv64/felix44/build [?25h[?25hreceiving incremental file list python-executing-2.1.0-1-riscv64-build.log python-executing-2.1.0-1-riscv64-check.log python-executing-2.1.0-1-riscv64-prepare.log sent 81 bytes received 8,300 bytes 16,762.00 bytes/sec total size is 114,078 speedup is 13.61