tobgu / pyrsistent

Persistent/Immutable/Functional data structures for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pvector_field with large amount of nested precord object structure failed in pypy

pasinsjr opened this issue · comments

import pyrsistent as pyrs

class C(pyrs.PRecord):
    value = pyrs.field(int)

class B(pyrs.PRecord):
    dump_int: int = pyrs.field(int)
    value = pyrs.pvector_field(C)

class A(pyrs.PRecord):
    values_list = pyrs.pvector_field(B)

c_list = [
    C(value=3)
    for j in range(500)  # if you reduce this number to 100, it would work correctly
]

b_list = [
    B(
        dump_int=2,
        value=c_list
    )
    for i in range(8000)
]

dump_obj = A(
    values_list=b_list
)

print(type(dump_obj.values_list[0]))

got 'list' instead of 'B', the length number of array is different depend on machine

environment: PyPy 7.3.5 with GCC 7.3.1 20180303 (Red Hat 7.3.1-5)

That's weird! I don't know off the top of my head why this would be but will try to find some time to dig into it. If you have further input please let me know.