Skip to content

[Bug] Memory issue using Record with Array  #173

@Vincouux

Description

@Vincouux

Version

OS: Ubuntu 22.04
Python: 3.10.2
Pulsar: pulsar-client==3.2.0

Minimal reproduce step

from pulsar.schema import Record, Array, Integer

class A(Record):
    a = Array(Integer(), required=False, default=[])

# Create a first instance of object A
a = A()
a.a # Correctly show empty list
a.a.append(1) # Adding an integer
a.a # Correctly showing list with single element 1 inside

# Instanciating a second object A
b = A()
b.a # Incorrectly show list with single element 1

What did you expect to see?

I expected the A class not to re-use the previous reference to the list.

What did you see instead?

As a developer, instantiating a fresh object in Python generally means it's built from scratch. Therefore, no reference to previously built objects should be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions