pyrsistent icon indicating copy to clipboard operation
pyrsistent copied to clipboard

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

Open pasinsjr opened this issue 4 years ago • 1 comments
trafficstars

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)

pasinsjr avatar Jul 30 '21 08:07 pasinsjr

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.

tobgu avatar Aug 14 '21 20:08 tobgu