Skip to content

Commit 227a006

Browse files
committed
match args without n_*_fields
1 parent 76a94d5 commit 227a006

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Lib/test/test_structseq.py

-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ def test_extended_getslice(self):
124124
self.assertEqual(list(t[start:stop:step]),
125125
L[start:stop:step])
126126

127-
# TODO: RUSTPYTHON
128-
@unittest.expectedFailure
129127
def test_match_args(self):
130128
expected_args = ('tm_year', 'tm_mon', 'tm_mday', 'tm_hour', 'tm_min',
131129
'tm_sec', 'tm_wday', 'tm_yday', 'tm_isdst')

vm/src/types/structseq.rs

+11
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,16 @@ pub trait PyStructSequence: StaticType + PyClassImpl + Sized + 'static {
8686
.into(),
8787
);
8888
}
89+
90+
class.set_attr(
91+
identifier!(ctx, __match_args__),
92+
ctx.new_tuple(
93+
Self::FIELD_NAMES
94+
.iter()
95+
.map(|name| ctx.new_str(name.clone()).into())
96+
.collect::<Vec<_>>(),
97+
)
98+
.into(),
99+
);
89100
}
90101
}

0 commit comments

Comments
 (0)