Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ jobs:
uses: ./.github/workflows/build-linux-wheel.yml
with:
python-version: ${{ matrix.python-version }}

build-windows:
uses: ./.github/workflows/build-windows-wheel.yml
with:
python-version: "3.12"
python-tag: "312"
architecture: "AMD64"

build-macos:
uses: ./.github/workflows/build-mac-wheel.yml
with:
python-version: "3.12"

test-wheels-linux:
needs: build-linux
Expand All @@ -26,6 +38,18 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

test-wheels-windows:
needs: build-windows
uses: ./.github/workflows/test-windows-wheel.yml
with:
python-version: "3.12"

test-wheels-macos:
needs: build-macos
uses: ./.github/workflows/test-mac-wheel.yml
with:
python-version: "3.12"

stress-test-linux:
needs: build-linux
strategy:
Expand Down
33 changes: 24 additions & 9 deletions python_tests/test_memo_immutable.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
BASE32_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"


def _reopen_rw():
db0.close()
db0.init(DB0_DIR)
db0.open("my-test-prefix", "rw")


def _base32_encode(data):
table = (
(0b11111000, 3), (0b00000111, -2), (0b11000000, 6), (0b00111110, 1),
Expand Down Expand Up @@ -563,16 +569,18 @@ def test_find_embedded_immutable_instances_by_base_type_default_tags(db0_fixture
derived_result = list(db0.find(MemoImmutableDefaultTagDerived))
leaf_result = list(db0.find(MemoImmutableDefaultTagDerivedLeaf))

assert [db0.uuid(item) for item in base_result] == [child_uuid, leaf_uuid]
assert [db0.uuid(item) for item in derived_result] == [child_uuid, leaf_uuid]
base_by_uuid = {db0.uuid(item): item for item in base_result}
derived_by_uuid = {db0.uuid(item): item for item in derived_result}
assert set(base_by_uuid) == {child_uuid, leaf_uuid}
assert set(derived_by_uuid) == {child_uuid, leaf_uuid}
assert [db0.uuid(item) for item in leaf_result] == [leaf_uuid]
assert isinstance(base_result[0], MemoImmutableDefaultTagDerived)
assert base_result[0].name == "base type embedded"
assert base_result[0].count == 127
assert isinstance(base_result[1], MemoImmutableDefaultTagDerivedLeaf)
assert base_result[1].name == "base type embedded-leaf"
assert base_result[1].count == 128
assert base_result[1].marker == "deep-derived"
assert isinstance(base_by_uuid[child_uuid], MemoImmutableDefaultTagDerived)
assert base_by_uuid[child_uuid].name == "base type embedded"
assert base_by_uuid[child_uuid].count == 127
assert isinstance(base_by_uuid[leaf_uuid], MemoImmutableDefaultTagDerivedLeaf)
assert base_by_uuid[leaf_uuid].name == "base type embedded-leaf"
assert base_by_uuid[leaf_uuid].count == 128
assert base_by_uuid[leaf_uuid].marker == "deep-derived"


def test_find_mixed_regular_immutable_and_embedded_tagged_instances(db0_fixture):
Expand Down Expand Up @@ -668,6 +676,7 @@ def test_embedded_immutable_root_drops_after_last_tag_removed(db0_fixture):
del nested
gc.collect()
db0.commit()
_reopen_rw()

with pytest.raises(Exception):
db0.fetch(root_uuid)
Expand Down Expand Up @@ -824,6 +833,7 @@ def test_immutable_instance_drops_when_holding_memo_object_is_deleted(db0_fixtur
del holder
gc.collect()
db0.commit()
_reopen_rw()

with pytest.raises(Exception):
db0.fetch(obj_id)
Expand All @@ -847,6 +857,7 @@ def test_immutable_instance_supported_by_embedded_ref_drops_when_holding_memo_ob
del holder
gc.collect()
db0.commit()
_reopen_rw()

with pytest.raises(Exception):
db0.fetch(outer_id)
Expand Down Expand Up @@ -986,6 +997,8 @@ def test_index_remove_unrefs_embedded_immutable_nested_object_reference(db0_fixt
del stored
gc.collect()
db0.commit()
del index
_reopen_rw()

with pytest.raises(Exception):
db0.fetch(outer_id)
Expand All @@ -1007,6 +1020,8 @@ def test_index_clear_unrefs_embedded_immutable_nested_object_reference(db0_fixtu

index.clear()
db0.commit()
del index
_reopen_rw()

with pytest.raises(Exception):
db0.fetch(outer_id)
Expand Down
4 changes: 2 additions & 2 deletions src/dbzero/bindings/python/embedded/EmbeddedDict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ namespace db0::python
}

PyTypeObject EmbeddedDictType = {
PyVarObject_HEAD_INIT(nullptr, 0)
PYVAROBJECT_HEAD_INIT_DESIGNATED,
.tp_name = "dbzero.EmbeddedDict",
.tp_basicsize = static_cast<Py_ssize_t>(EmbeddedDict::sizeOf()),
.tp_itemsize = 0,
Expand All @@ -444,7 +444,7 @@ namespace db0::python
};

PyTypeObject EmbeddedDictIteratorType = {
PyVarObject_HEAD_INIT(nullptr, 0)
PYVAROBJECT_HEAD_INIT_DESIGNATED,
.tp_name = "dbzero.EmbeddedDictIterator",
.tp_basicsize = static_cast<Py_ssize_t>(EmbeddedDictIterator::sizeOf()),
.tp_itemsize = 0,
Expand Down
2 changes: 1 addition & 1 deletion src/dbzero/bindings/python/embedded/EmbeddedObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ namespace db0::python
}

PyTypeObject EmbeddedObjectType = {
PyVarObject_HEAD_INIT(nullptr, 0)
PYVAROBJECT_HEAD_INIT_DESIGNATED,
.tp_name = "dbzero.EmbeddedObject",
.tp_basicsize = static_cast<Py_ssize_t>(EmbeddedObject::sizeOf()),
.tp_itemsize = 0,
Expand Down
4 changes: 2 additions & 2 deletions src/dbzero/bindings/python/embedded/EmbeddedSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ namespace db0::python
}

PyTypeObject EmbeddedSetType = {
PyVarObject_HEAD_INIT(nullptr, 0)
PYVAROBJECT_HEAD_INIT_DESIGNATED,
.tp_name = "dbzero.EmbeddedSet",
.tp_basicsize = static_cast<Py_ssize_t>(EmbeddedSet::sizeOf()),
.tp_itemsize = 0,
Expand All @@ -242,7 +242,7 @@ namespace db0::python
};

PyTypeObject EmbeddedSetIteratorType = {
PyVarObject_HEAD_INIT(nullptr, 0)
PYVAROBJECT_HEAD_INIT_DESIGNATED,
.tp_name = "dbzero.EmbeddedSetIterator",
.tp_basicsize = static_cast<Py_ssize_t>(EmbeddedSetIterator::sizeOf()),
.tp_itemsize = 0,
Expand Down
2 changes: 1 addition & 1 deletion src/dbzero/bindings/python/embedded/EmbeddedTuple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ namespace db0::python
}

PyTypeObject EmbeddedTupleType = {
PyVarObject_HEAD_INIT(nullptr, 0)
PYVAROBJECT_HEAD_INIT_DESIGNATED,
.tp_name = "dbzero.EmbeddedTuple",
.tp_basicsize = static_cast<Py_ssize_t>(EmbeddedTuple::sizeOf()),
.tp_itemsize = 0,
Expand Down
6 changes: 4 additions & 2 deletions src/dbzero/object_model/object/ObjectImplBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ namespace db0::object_model

template <typename T, typename ImplT>
ObjectImplBase<T, ImplT>::ObjectImplBase(
typename super_t::tag_no_gc, db0::swine_ptr<Fixture> &fixture, ObjectStem &&stem, std::shared_ptr<Class> type
typename ObjectImplBase<T, ImplT>::tag_no_gc, db0::swine_ptr<Fixture> &fixture, ObjectStem &&stem,
std::shared_ptr<Class> type
)
: super_t(typename super_t::tag_no_gc(), typename super_t::tag_from_stem(), fixture, std::move(stem))
: super_t(typename ObjectImplBase<T, ImplT>::tag_no_gc(), typename super_t::tag_from_stem(), fixture,
std::move(stem))
{
this->m_type = type;
assert(hasValidClassRef());
Expand Down
3 changes: 2 additions & 1 deletion src/dbzero/object_model/object/ObjectImplBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ namespace db0::object_model
using ObjectStem = ObjectVType<T>;
using TypeInitializer = ObjectInitializer::TypeInitializer;
using tag_as_dropped = typename super_t::tag_as_dropped;
using tag_no_gc = typename super_t::tag_no_gc;

// Construct as null / dropped object
ObjectImplBase(tag_as_dropped, UniqueAddress, unsigned int ext_refs);
ObjectImplBase(typename super_t::tag_no_gc, db0::swine_ptr<Fixture> &, ObjectStem &&, std::shared_ptr<Class>);
ObjectImplBase(tag_no_gc, db0::swine_ptr<Fixture> &, ObjectStem &&, std::shared_ptr<Class>);
ObjectImplBase(const ObjectImplBase<T, ImplT> &) = delete;
ObjectImplBase(ObjectImplBase<T, ImplT> &&) = delete;

Expand Down
Loading