construct-classes 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,15 @@ Unreleased
11
11
 
12
12
  Please see all `Unreleased Changes`_ for more information.
13
13
 
14
- .. _Unreleased Changes: https://github.com/matejcik/construct-classes/compare/v0.2.0...HEAD
14
+ .. _Unreleased Changes: https://github.com/matejcik/construct-classes/compare/v0.2.1...HEAD
15
+
16
+ 0.2.1 - 2025-08-25
17
+ --------------------
18
+
19
+ Fixed
20
+ ~~~~~
21
+
22
+ - Fix exception when creating a subclass of a subclass of :code:`Struct`.
15
23
 
16
24
 
17
25
  0.2.0 - 2025-08-25
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: construct-classes
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Parse your binary structs into dataclasses
5
5
  Home-page: https://github.com/matejcik/construct-classes
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "construct-classes"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  authors = ["matejcik <ja@matejcik.cz>"]
5
5
  classifiers = [
6
6
  "Development Status :: 2 - Pre-Alpha",
@@ -42,8 +42,9 @@ class _StructMeta(type):
42
42
  **kwargs: t.Any,
43
43
  ) -> type:
44
44
  new_cls = super().__new__(cls, name, bases, namespace)
45
- if bases:
46
- assert bases[0].__name__ == "Struct"
45
+ if any(isinstance(b, _StructMeta) for b in bases):
46
+ # skip over `Struct` itself, which does not have a StructMeta class in its
47
+ # bases.
47
48
  return dataclasses.dataclass(kw_only=kw_only, **kwargs)(new_cls)
48
49
  else:
49
50
  return new_cls
@@ -90,3 +91,7 @@ class Struct(metaclass=_StructMeta):
90
91
  def parse(cls: t.Type[Self], data: bytes) -> Self:
91
92
  result = cls.SUBCON.parse(data)
92
93
  return cls.from_parsed(result)
94
+
95
+
96
+ # check that `Struct` itself is not transformed
97
+ assert not dataclasses.is_dataclass(Struct)