Skip to content

Bugs: ArrayList (0.28.1) #38

Open
Open

Description

@otsobide

Defects in ArrayList / NullableArrayList (0.28.1; each one reproduced). Fixed by the new lists.py (ArrayList[E]); every item gets a regression test and is ticked when the fix lands.

  • C33 ArrayList instances are unhashable: hash() raises TypeError although __eq__ is value-based and isinstance(x, Hashable) is True.
  • C34 ArrayList aliases the caller's list and exposes it mutably: validated invariants can be broken after construction.
  • C35 ArrayList(Int)([Int(1)]) is rejected although the elements are instances of the element type.
  • C36 With a non-VO element type, ArrayList coerces instead of validating: ArrayList(int)(['1', 2.7, True]) is accepted.
  • C37 Element validation runs after _validate, so subclasses see unvalidated elements (TypeError instead of ValueObjectError).
  • C38 List VOs cannot be pickled (generated classes are function-local), unlike every other VO.
  • C39 typing.get_type_hints fails on generated list classes (annotation list[cls] refers to a closure variable).
  • C40 The factory accepts and caches any element "type", including None or non-callables; the error appears only with a non-empty list.
  • C41 NullableArrayList(X)() has no None default, unlike every other nullable VO, and its _validate repeats the parent's check.
  • C48 The ArrayList suites skip the hash/equality tests every other suite has, hiding C33 and C34.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions