Repository navigation
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Defects in the value-object core of 0.28.1 (each one reproduced). The 1.0.0 core (pyvalueobjects/_core.py) is designed to remove them; every item gets a regression test and is ticked when the fix lands.
- C00
ValueObject.__eq__raisesValueObjectErrorwhen compared with a non-VO:Int(1) == None,Int(2) in [1, Int(2)],Int(1) in {1: 0},{Int(1), 1}and frozen-dataclass entities with an optional VO all crash. (d8793bf) Fixed in the core (pyvalueobjects/_core.py); the 0.x classes the root still exports keep the old behaviour until their family switches (B3-B9). - X00 Equality and hashing ignore the type:
UserId(x) == OrderId(x),Int(1) == Float(1.0),Int(1) == PositiveInt(1); unrelated VOs collide as dict/set keys. (d8793bf) Fixed in the core (pyvalueobjects/_core.py); the 0.x classes the root still exports keep the old behaviour until their family switches (B3-B9). - C01 The VO stores and returns the caller's mutable object, so a validated
ArrayList(Int)can end up holding'x'. - C03 VOs are mutable:
_valuecan be reassigned, attributes added,__init__re-run in place (corrupts sets/dicts). (833f137, ff48b21, a15af5d) Fixed in the core (pyvalueobjects/_core.py); the 0.x classes the root still exports keep the old behaviour until their family switches (B3-B9). - C04
ValueObject.__hash__assumes a hashable value:hash(ArrayList(Int)([1]))raisesTypeError. - C06
ValueObjectErrordoes not callsuper().__init__: keyword construction gives an empty message and it cannot be pickled/copied. (a0c9ce5) - X05
from pyvalueobjects.errors import ValueObjectErrorimports a module, soexcept ValueObjectErrorraisesTypeError. - C07
from pyvalueobjects import *exports the subpackage names (numbers,strings, ...) and shadows the stdlibnumbersmodule. - C02/C15
build_nullablemakesNullablePositiveInt(None)an instance ofPositiveIntholdingNone(Liskov violation;x.value() > 0crashes). - C05/C17
str_value()of a null VO returns the string'None', indistinguishable from a real'None'string.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
otsobide commentedon Oct 26, 2026
Status of the core items on
v1-redesign:pyvalueobjects/_core.py, with regression tests intests/test_core.py. The original repros (from pyvalueobjects import Int, PositiveInt) still show the old behaviour, because the package root keeps exporting the 0.x classes until each family switches to the core (B3-B9). Re-running the repros at those switches confirms the fix for the public names.__init__) and a15af5d (a base class without__slots__can no longer give instances a__dict__).from pyvalueobjects import *gives only the core names, andpyvalueobjects.numbersno longer exists. It stays unticked until the block that finalizes__init__.pyand__all__(B10) adds its regression test and cites these commits.