diff --git a/Cargo.lock b/Cargo.lock index 079c2c3e18..cc5d7a31eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,30 +132,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bindgen" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c85344eb535a31b62f0af37be84441ba9e7f0f4111eb0530f43d15e513fe57" -dependencies = [ - "bitflags", - "cexpr", - "cfg-if 0.1.10", - "clang-sys", - "clap", - "env_logger", - "lazy_static 1.4.0", - "lazycell", - "log", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "which", -] - [[package]] name = "bit-set" version = "0.5.2" @@ -273,15 +249,6 @@ version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" -[[package]] -name = "cexpr" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "0.1.10" @@ -309,17 +276,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "clang-sys" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853" -dependencies = [ - "glob", - "libc", - "libloading", -] - [[package]] name = "clap" version = "2.33.3" @@ -378,9 +334,9 @@ dependencies = [ [[package]] name = "cranelift" -version = "0.66.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc21c925da7fbb64597c86521b59726426fb660ad30f898a01b957f39d15558" +checksum = "60686f89c5145bc9a961dabbb83954baa429bde4c5977a0a5d3f8552f2990273" dependencies = [ "cranelift-codegen", "cranelift-frontend", @@ -388,18 +344,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.66.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dcc286b052ee24a1e5a222e7c1125e6010ad35b0f248709b9b3737a8fedcfdf" +checksum = "9221545c0507dc08a62b2d8b5ffe8e17ac580b0a74d1813b496b8d70b070fbd0" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.66.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d9badfe36176cb653506091693bc2bb1970c9bddfcd6ec7fac404f7eaec6f38" +checksum = "7e9936ea608b6cd176f107037f6adbb4deac933466fc7231154f96598b2d3ab1" dependencies = [ "byteorder", "cranelift-bforest", @@ -415,9 +371,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.66.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3f460031861e4f4ad510be62b2ae50bba6cc886b598a36f9c0a970feab9598" +checksum = "4ef2b2768568306540f4c8db3acce9105534d34c4a1e440529c1e702d7f8c8d7" dependencies = [ "cranelift-codegen-shared", "cranelift-entity", @@ -425,21 +381,21 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.66.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ad12409e922e7697cd0bdc7dc26992f64a77c31880dfe5e3c7722f4710206d" +checksum = "6759012d6d19c4caec95793f052613e9d4113e925e7f14154defbac0f1d4c938" [[package]] name = "cranelift-entity" -version = "0.66.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97cdc58972ea065d107872cfb9079f4c92ade78a8af85aaff519a65b5d13f71" +checksum = "86badbce14e15f52a45b666b38abe47b204969dd7f8fb7488cb55dd46b361fa6" [[package]] name = "cranelift-frontend" -version = "0.66.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef419efb4f94ecc02e5d9fbcc910d2bb7f0040e2de570e63a454f883bc891d6" +checksum = "b608bb7656c554d0a4cf8f50c7a10b857e80306f6ff829ad6d468a7e2323c8d8" dependencies = [ "cranelift-codegen", "log", @@ -449,9 +405,9 @@ dependencies = [ [[package]] name = "cranelift-module" -version = "0.66.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001d9b320ce30999c618db554ae9b23ec16d410493a502be674e2ef146bbdf0d" +checksum = "fdaf0b5c93a610ff988fe5e2adbb7f6afa89cf702ca41acc3479dc35638d3a8d" dependencies = [ "anyhow", "cranelift-codegen", @@ -462,9 +418,9 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.66.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e69d44d59826eef6794066ac2c0f4ad3975f02d97030c60dbc04e3886adf36e" +checksum = "5246a1af14b7812ee4d94a3f0c4b295ec02c370c08b0ecc3dec512890fdad175" dependencies = [ "cranelift-codegen", "raw-cpuid", @@ -473,15 +429,17 @@ dependencies = [ [[package]] name = "cranelift-simplejit" -version = "0.66.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7506acda1b0df5419e8de5f1706cfcd8779d3d40d70c179f361e647fe9b18f0" +checksum = "b2522ebdff6ba637c0b5e75bc3d40cc990ac1128e13547b740f10fc7b16d3991" dependencies = [ "cranelift-codegen", + "cranelift-entity", "cranelift-module", "cranelift-native", "errno", "libc", + "log", "region", "target-lexicon", "winapi", @@ -853,12 +811,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - [[package]] name = "hashbrown" version = "0.9.1" @@ -1017,12 +969,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "lexical-core" version = "0.7.4" @@ -1044,9 +990,9 @@ checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" [[package]] name = "libffi" -version = "0.9.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c18efe55925cc7f83bf60a61394696a734ae90e668d1f2bbd954354416fec6f2" +checksum = "bafef83ee22d51c27348aaf6b2da007a32b9f5004809d09271432e5ea2a795dd" dependencies = [ "abort_on_panic", "libc", @@ -1055,24 +1001,12 @@ dependencies = [ [[package]] name = "libffi-sys" -version = "0.9.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f00e48ce437c5741a4da3b51738498343b5158c37bfa02bcb969efcc44e4e06" +checksum = "3b6d65142f1c3b06ca3f4216da4d32b3124d14d932cef8dfd8792037acd2160b" dependencies = [ - "bindgen", "cc", "make-cmd", - "pkg-config", -] - -[[package]] -name = "libloading" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" -dependencies = [ - "cc", - "winapi", ] [[package]] @@ -1206,16 +1140,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nom" -version = "4.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" -dependencies = [ - "memchr", - "version_check", -] - [[package]] name = "num-bigint" version = "0.3.0" @@ -1412,12 +1336,6 @@ dependencies = [ "proc-macro-hack", ] -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "petgraph" version = "0.5.1" @@ -1586,9 +1504,9 @@ dependencies = [ [[package]] name = "regalloc" -version = "0.0.27" +version = "0.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ba8aaf5fe7cf307c6dbdaeed85478961d29e25e3bee5169e11b92fa9f027a8" +checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" dependencies = [ "log", "rustc-hash", @@ -2078,12 +1996,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "shlex" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" - [[package]] name = "siphasher" version = "0.3.3" @@ -2176,9 +2088,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" +checksum = "4ee5a98e506fb7231a304c3a1bd7c132a55016cf65001e0282480665870dfcb9" [[package]] name = "term" @@ -2517,12 +2429,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" - [[package]] name = "volatile" version = "0.3.0" @@ -2617,15 +2523,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "which" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" -dependencies = [ - "libc", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 0ad09cb230..a8f0aa7f35 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -562,8 +562,6 @@ def keys(self): return 1 # used to be 'a' but that's no longer an error self.assertRaises(TypeError, eval, 'dir()', globals(), C()) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_exec(self): g = {} exec('z = 1', g) diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 29137b1b52..258e501882 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -1067,8 +1067,6 @@ def g2(x): self.assertEqual(g2(False), 0) self.assertEqual(g2(True), ('end', 1)) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_yield(self): # Allowed as standalone statement def g(): yield 1 diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py index 7b41376520..edb745c2cd 100644 --- a/Lib/test/test_importlib/test_api.py +++ b/Lib/test/test_importlib/test_api.py @@ -242,8 +242,6 @@ def test_reload_loader_replaced(self): self.assertIs(reloaded, types) self.assertIs(sys.modules['types'], types) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_reload_location_changed(self): name = 'spam' with support.temp_cwd(None) as cwd: @@ -295,8 +293,6 @@ def test_reload_location_changed(self): self.maxDiff = None self.assertEqual(ns, expected) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_reload_namespace_changed(self): name = 'spam' with support.temp_cwd(None) as cwd: diff --git a/Lib/test/test_named_expression.py b/Lib/test/test_named_expression.py index 3b946865c7..acdfe67fa3 100644 --- a/Lib/test/test_named_expression.py +++ b/Lib/test/test_named_expression.py @@ -336,9 +336,6 @@ def spam(a): self.assertEqual(res, [(1, 1, 1.0), (2, 2, 1.0), (3, 3, 1.0)]) self.assertEqual(y, 3) - # TODO RustPython, added test_named_expression_scope_06_rp_modified as - # minimaly modified variant of this test. - @unittest.expectedFailure def test_named_expression_scope_06(self): res = [[spam := i for i in range(3)] for j in range(2)] @@ -385,8 +382,6 @@ def eggs(b): self.assertEqual(res, [0, 2]) self.assertEqual(a, 2) - # TODO RustPython, added test_named_expression_scope_10_rp_modified - @unittest.expectedFailure def test_named_expression_scope_10(self): res = [b := [a := 1 for i in range(2)] for j in range(2)] @@ -522,7 +517,6 @@ def test_named_expression_variable_reuse_in_comprehensions(self): self.assertEqual(ns["x"], 2) self.assertEqual(ns["result"], [0, 1, 2]) - @unittest.expectedFailure # TODO: RUSTPYTHON def test_named_expression_global_scope(self): sentinel = object() global GLOBAL_VAR diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py index 4a56e858e2..1f821e629b 100644 --- a/Lib/test/test_opcodes.py +++ b/Lib/test/test_opcodes.py @@ -38,8 +38,6 @@ class C: pass with self.assertRaises(AttributeError): C.__annotations__ - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_use_existing_annotations(self): ns = {'__annotations__': {1: 2}} exec('x: int', ns) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 43d93f58b5..95db6f15ed 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1888,6 +1888,12 @@ def get_single(f): def helper(self): if hasattr(os, f): self.check(getattr(os, f)) + + # TODO: RUSTPYTHON; io.FileIO(fd) should check if the fd passed is valid + if f == "fdopen": + # this is test_fdopen + helper = unittest.expectedFailure(helper) + return helper for f in singles: locals()["test_"+f] = get_single(f) diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py index 0cb5ec572a..be868e50e2 100644 --- a/Lib/test/test_scope.py +++ b/Lib/test/test_scope.py @@ -136,7 +136,6 @@ def h(): h = g(2, 4, 6) self.assertEqual(h(), 39) - @unittest.expectedFailure # TODO: RUSTPYTHON def testFreeVarInMethod(self): def test(): @@ -202,7 +201,6 @@ def fact(n): self.assertEqual(f(6), 720) - @unittest.expectedFailure # TODO: RUSTPYTHON def testUnoptimizedNamespaces(self): check_syntax_error(self, """if 1: @@ -262,7 +260,6 @@ def testLambdas(self): h = g(2, 4, 6) self.assertEqual(h(), 18) - @unittest.expectedFailure # TODO: RUSTPYTHON def testUnboundLocal(self): def errorInOuter(): @@ -280,7 +277,6 @@ def inner(): self.assertRaises(UnboundLocalError, errorInOuter) self.assertRaises(NameError, errorInInner) - @unittest.expectedFailure # TODO: RUSTPYTHON def testUnboundLocal_AfterDel(self): # #4617: It is now legal to delete a cell variable. # The following functions must obviously compile, @@ -302,7 +298,6 @@ def inner(): self.assertRaises(UnboundLocalError, errorInOuter) self.assertRaises(NameError, errorInInner) - @unittest.expectedFailure # TODO: RUSTPYTHON def testUnboundLocal_AugAssign(self): # test for bug #1501934: incorrect LOAD/STORE_GLOBAL generation exec("""if 1: @@ -335,7 +330,6 @@ def returner(): self.assertEqual(makeReturner2(a=11)()['a'], 11) - @unittest.expectedFailure # TODO: RUSTPYTHON def testScopeOfGlobalStmt(self): # Examples posted by Samuele Pedroni to python-dev on 3/1/2001 @@ -414,7 +408,6 @@ def get(self): self.assertEqual(g.get(), 13) """) - @unittest.expectedFailure # TODO: RUSTPYTHON def testLeaks(self): class Foo: @@ -437,7 +430,6 @@ def f2(): self.assertEqual(Foo.count, 0) - @unittest.expectedFailure # TODO: RUSTPYTHON def testClassAndGlobal(self): exec("""if 1: @@ -460,7 +452,6 @@ class X: self.assertTrue(X.passed) """) - @unittest.expectedFailure # TODO: RUSTPYTHON def testLocalsFunction(self): def f(x): @@ -568,7 +559,6 @@ class TestClass: self.assertRaises(TypeError, sys.settrace) - @unittest.expectedFailure # TODO: RUSTPYTHON def testEvalExecFreeVars(self): def f(x): @@ -603,7 +593,6 @@ def x(): except NameError: pass - @unittest.expectedFailure # TODO: RUSTPYTHON def testEvalFreeVars(self): def f(x): @@ -661,7 +650,10 @@ def dec(self): self.assertEqual(c.dec(), 1) self.assertEqual(c.dec(), 0) - @unittest.expectedFailure # TODO: RUSTPYTHON + # TODO: RUSTPYTHON, figure out how to communicate that `y = 9` should be + # stored as a global rather than a STORE_NAME, even when + # the `global y` is in a nested subscope + @unittest.expectedFailure def testGlobalInParallelNestedFunctions(self): # A symbol table bug leaked the global statement from one # function to other nested functions in the same block. @@ -741,7 +733,6 @@ def top(a): def b(): global a - @unittest.expectedFailure # TODO: RUSTPYTHON def testClassNamespaceOverridesClosure(self): # See #17853. x = 42 diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py index 65c081681e..d853e0d66a 100644 --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@ -121,6 +121,8 @@ def test_nonlocal(self): expected = ("some_var",) self.assertEqual(self.other_internal.get_nonlocals(), expected) + # TODO: RUSTPYTHON + @unittest.expectedFailure def test_local(self): self.assertTrue(self.spam.lookup("x").is_local()) self.assertFalse(self.spam.lookup("bar").is_local()) diff --git a/Lib/unittest/test/test_runner.py b/Lib/unittest/test/test_runner.py index c00d6e5327..3759696043 100644 --- a/Lib/unittest/test/test_runner.py +++ b/Lib/unittest/test/test_runner.py @@ -277,8 +277,6 @@ def MockResultClass(*args): self.assertEqual(runner._makeResult(), expectedresult) - # TODO: RUSTPYTHON; -W arg for warning control - @unittest.expectedFailure def test_warnings(self): """ Check that warnings argument of TextTestRunner correctly affects the diff --git a/bytecode/src/bytecode.rs b/bytecode/src/bytecode.rs index 74a74af506..778455581f 100644 --- a/bytecode/src/bytecode.rs +++ b/bytecode/src/bytecode.rs @@ -93,8 +93,8 @@ impl ConstantBag for BasicBag { /// a codeobject. Also a module has a codeobject. #[derive(Clone, PartialEq, Serialize, Deserialize)] pub struct CodeObject { - pub instructions: Vec, - pub locations: Vec, + pub instructions: Box<[Instruction]>, + pub locations: Box<[Location]>, pub flags: CodeFlags, pub posonlyarg_count: usize, // Number of positional-only arguments pub arg_count: usize, @@ -102,12 +102,16 @@ pub struct CodeObject { pub source_path: String, pub first_line_number: usize, pub obj_name: String, // Name of the object that created this code object - pub constants: Vec, + pub cell2arg: Option>, + pub constants: Box<[C]>, #[serde(bound( deserialize = "C::Name: serde::Deserialize<'de>", serialize = "C::Name: serde::Serialize" ))] - pub names: Vec, + pub names: Box<[C::Name]>, + pub varnames: Box<[C::Name]>, + pub cellvars: Box<[C::Name]>, + pub freevars: Box<[C::Name]>, } bitflags! { @@ -121,12 +125,7 @@ bitflags! { const IS_COROUTINE = 0x20; const HAS_VARARGS = 0x40; const HAS_VARKEYWORDS = 0x80; - } -} - -impl Default for CodeFlags { - fn default() -> Self { - Self::NEW_LOCALS + const IS_OPTIMIZED = 0x0100; } } @@ -154,22 +153,6 @@ impl fmt::Display for Label { } } -#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] -/// An indication where the name must be accessed. -pub enum NameScope { - /// The name will be in the local scope. - Local, - - /// The name will be located in scope surrounding the current scope. - NonLocal, - - /// The name will be in global scope. - Global, - - /// The name will be located in any scope between the current scope and the top scope. - Free, -} - /// Transforms a value prior to formatting it. #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum ConversionFlag { @@ -195,17 +178,20 @@ pub enum Instruction { ImportFrom { idx: NameIdx, }, - LoadName { - idx: NameIdx, - scope: NameScope, - }, - StoreName { - idx: NameIdx, - scope: NameScope, - }, - DeleteName { - idx: NameIdx, - }, + LoadFast(NameIdx), + LoadNameAny(NameIdx), + LoadGlobal(NameIdx), + LoadDeref(NameIdx), + LoadClassDeref(NameIdx), + StoreFast(NameIdx), + StoreLocal(NameIdx), + StoreGlobal(NameIdx), + StoreDeref(NameIdx), + DeleteFast(NameIdx), + DeleteLocal(NameIdx), + DeleteGlobal(NameIdx), + DeleteDeref(NameIdx), + LoadClosure(NameIdx), Subscript, StoreSubscript, DeleteSubscript, @@ -550,8 +536,8 @@ impl CodeObject { obj_name: String, ) -> Self { CodeObject { - instructions: Vec::new(), - locations: Vec::new(), + instructions: Box::new([]), + locations: Box::new([]), flags, posonlyarg_count, arg_count, @@ -559,8 +545,12 @@ impl CodeObject { source_path, first_line_number, obj_name, - constants: Vec::new(), - names: Vec::new(), + cell2arg: None, + constants: Box::new([]), + names: Box::new([]), + varnames: Box::new([]), + cellvars: Box::new([]), + freevars: Box::new([]), } } @@ -569,19 +559,19 @@ impl CodeObject { let nargs = self.arg_count; let nkwargs = self.kwonlyarg_count; let mut varargspos = nargs + nkwargs; - let posonlyargs = &self.names[..self.posonlyarg_count]; - let args = &self.names[..nargs]; - let kwonlyargs = &self.names[nargs..varargspos]; + let posonlyargs = &self.varnames[..self.posonlyarg_count]; + let args = &self.varnames[..nargs]; + let kwonlyargs = &self.varnames[nargs..varargspos]; let vararg = if self.flags.contains(CodeFlags::HAS_VARARGS) { - let vararg = &self.names[varargspos]; + let vararg = &self.varnames[varargspos]; varargspos += 1; Some(vararg) } else { None }; let varkwarg = if self.flags.contains(CodeFlags::HAS_VARKEYWORDS) { - Some(&self.names[varargspos]) + Some(&self.varnames[varargspos]) } else { None }; @@ -597,7 +587,7 @@ impl CodeObject { pub fn label_targets(&self) -> BTreeSet