8000 fix __parametesr__ · RustPython/RustPython@999976a · GitHub
[go: up one dir, main page]

Skip to content

Commit 999976a

Browse files
committed
fix __parametesr__
1 parent 7ebe018 commit 999976a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Lib/test/test_typing.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6106,8 +6106,6 @@ class C(Generic[T]): pass
61066106
self.assertIs(get_origin((*tuple[*Ts],)[0]), tuple)
61076107
self.assertIs(get_origin(Unpack[Tuple[Unpack[Ts]]]), Unpack)
61086108

6109-
# TODO: RUSTPYTHON
6110-
@unittest.expectedFailure
61116109
def test_get_args(self):
61126110
T = TypeVar('T')
61136111
class C(Generic[T]): pass

vm/src/stdlib/builtins.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,9 @@ mod builtins {
10091009
{
10101010
if let Some(type_params_tuple) = type_params.downcast_ref::<PyTuple>() {
10111011
if !type_params_tuple.is_empty() {
1012-
class.set_attr(identifier!(vm, __type_params__), type_params, vm)?;
1012+
class.set_attr(identifier!(vm, __type_params__), type_params.clone(), vm)?;
1013+
// Also set __parameters__ for compatibility with typing module
1014+
class.set_attr(identifier!(vm, __parameters__), type_params, vm)?;
10131015
}
10141016
}
10151017
}

0 commit comments

Comments
 (0)
0