mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 12:40:15 +01:00
py/objnamedtuple: Fix segfault with empty namedtuple.
The empty tuple is usually a constant object, but named tuples must be allocated to allow modification. Added explicit allocation to fix this. Also added a regression test to verify creating an empty named tuple works. Fixes issue #7870. Signed-off-by: Lars Haulin <lars.haulin@gmail.com>
This commit is contained in:
committed by
Damien George
parent
2076f2efcc
commit
5bf3765631
@@ -85,3 +85,8 @@ print(t.foo, t.bar)
|
||||
# Not implemented so far
|
||||
#T2 = namedtuple("TupComma", "foo,bar")
|
||||
#t = T2(1, 2)
|
||||
|
||||
# Creating an empty namedtuple should not segfault
|
||||
T5 = namedtuple("TupEmpty", [])
|
||||
t = T5()
|
||||
print(t)
|
||||
|
||||
Reference in New Issue
Block a user