dissect.cstruct 5.0.dev20__tar.gz → 5.0.dev21__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.
Files changed (86) hide show
  1. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/CHANGELOG.md +1 -0
  2. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/PKG-INFO +1 -1
  3. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/compiler.py +4 -4
  4. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/cstruct.py +4 -4
  5. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/int.py +16 -5
  6. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/leb128.py +17 -5
  7. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/packed.py +1 -0
  8. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect.cstruct.egg-info/PKG-INFO +1 -1
  9. dissect_cstruct-5.0.dev21/dissect.cstruct.egg-info/scm_version.json +8 -0
  10. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_basic.py +6 -0
  11. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_compiler.py +2 -0
  12. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_packed.py +15 -0
  13. dissect_cstruct-5.0.dev20/dissect.cstruct.egg-info/scm_version.json +0 -8
  14. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/.git-blame-ignore-revs +0 -0
  15. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/.gitattributes +0 -0
  16. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/COPYRIGHT +0 -0
  17. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/LICENSE +0 -0
  18. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/MANIFEST.in +0 -0
  19. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/README.md +0 -0
  20. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/__init__.py +0 -0
  21. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/bitbuffer.py +0 -0
  22. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/declarative.py +0 -0
  23. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/dump.py +0 -0
  24. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/exception.py +0 -0
  25. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/expression.py +0 -0
  26. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/lexer.py +0 -0
  27. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/parser.py +0 -0
  28. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/tools/__init__.py +0 -0
  29. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/tools/stubgen.py +0 -0
  30. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/__init__.py +0 -0
  31. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/base.py +0 -0
  32. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/char.py +0 -0
  33. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/enum.py +0 -0
  34. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/flag.py +0 -0
  35. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/pointer.py +0 -0
  36. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/structure.py +0 -0
  37. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/void.py +0 -0
  38. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/types/wchar.py +0 -0
  39. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect/cstruct/util.py +0 -0
  40. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect.cstruct.egg-info/SOURCES.txt +0 -0
  41. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect.cstruct.egg-info/dependency_links.txt +0 -0
  42. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect.cstruct.egg-info/entry_points.txt +0 -0
  43. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect.cstruct.egg-info/requires.txt +0 -0
  44. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect.cstruct.egg-info/scm_file_list.json +0 -0
  45. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/dissect.cstruct.egg-info/top_level.txt +0 -0
  46. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/examples/disk.py +0 -0
  47. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/examples/mirai.py +0 -0
  48. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/examples/pe.py +0 -0
  49. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/examples/protobuf.py +0 -0
  50. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/examples/secdesc.py +0 -0
  51. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/pyproject.toml +0 -0
  52. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/setup.cfg +0 -0
  53. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/__init__.py +0 -0
  54. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/_data/testdef.txt +0 -0
  55. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/_docs/Makefile +0 -0
  56. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/_docs/__init__.py +0 -0
  57. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/_docs/conf.py +0 -0
  58. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/_docs/index.rst +0 -0
  59. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/conftest.py +0 -0
  60. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_align.py +0 -0
  61. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_annotations.py +0 -0
  62. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_benchmark.py +0 -0
  63. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_bitbuffer.py +0 -0
  64. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_bitfield.py +0 -0
  65. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_ctypes.py +0 -0
  66. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_declarative.py +0 -0
  67. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_dump.py +0 -0
  68. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_expression.py +0 -0
  69. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_lexer.py +0 -0
  70. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_parser.py +0 -0
  71. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_tools_stubgen.py +0 -0
  72. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_base.py +0 -0
  73. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_char.py +0 -0
  74. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_custom.py +0 -0
  75. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_enum.py +0 -0
  76. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_flag.py +0 -0
  77. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_int.py +0 -0
  78. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_leb128.py +0 -0
  79. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_pointer.py +0 -0
  80. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_structure.py +0 -0
  81. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_union.py +0 -0
  82. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_void.py +0 -0
  83. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_types_wchar.py +0 -0
  84. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/test_util.py +0 -0
  85. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tests/util.py +0 -0
  86. {dissect_cstruct-5.0.dev20 → dissect_cstruct-5.0.dev21}/tox.ini +0 -0
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
16
16
  - Optimize storage of field sizes.
17
17
  - Rename `_sizes` property of `Structure` to `__sizes__`.
18
18
  - Rename `_values` property of `Structure` to `__values__`.
19
+ - Rename the `signed` attribute of integer and LEB128 types to `__signed__`, like the other attributes of types. The `signed` property is deprecated.
19
20
  - Added `load` argument to `cstruct` class, allowing direct initialization with a definition (i.e. `cstruct(cdef)` instead of `cstruct().load(cdef)`. Other arguments to `cstruct` are now keyword only.
20
21
  - Replace `compiler.compile` and the `Compiler` class with `compiler.compile_structure`.
21
22
  - Improve parsing performance:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.cstruct
3
- Version: 5.0.dev20
3
+ Version: 5.0.dev21
4
4
  Summary: A Dissect module implementing a parser for C-like structures: structure parsing in Python made easy
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License-Expression: Apache-2.0
@@ -722,7 +722,7 @@ class _ReadSourceGenerator(_SourceGenerator):
722
722
  if issubclass(read_type, Int):
723
723
  # Everything that's read as an integer type is sliced directly out of the buffer
724
724
  elem_size = read_type.__size__
725
- signed = bool(read_type.signed)
725
+ signed = bool(read_type.__signed__)
726
726
  lines.append(f"_array_buf = {getter}")
727
727
  raw = f"_int_from_bytes(_array_buf[i:i + {elem_size}], _byteorder[endian], signed={signed})"
728
728
  getter = f"[{raw} for i in range(0, {count}, {elem_size})]"
@@ -753,7 +753,7 @@ class _ReadSourceGenerator(_SourceGenerator):
753
753
  elif issubclass(field_type, (Enum, Flag)):
754
754
  # Fast path the member lookup, the slow path takes care of unknown values
755
755
  if issubclass(read_type, Int):
756
- raw = f"_int_from_bytes({getter}, _byteorder[endian], signed={bool(read_type.signed)})"
756
+ raw = f"_int_from_bytes({getter}, _byteorder[endian], signed={bool(read_type.__signed__)})"
757
757
  else:
758
758
  raw = getter
759
759
 
@@ -762,7 +762,7 @@ class _ReadSourceGenerator(_SourceGenerator):
762
762
  lines.extend(target(field, "_member"))
763
763
 
764
764
  elif issubclass(read_type, Int):
765
- signed = bool(read_type.signed)
765
+ signed = bool(read_type.__signed__)
766
766
  value = f"_int_from_bytes({getter}, _byteorder[endian], signed={signed})"
767
767
  lines.extend(target(field, f"_type_call({self._type_symbol(field.type)}, {value})"))
768
768
 
@@ -1208,7 +1208,7 @@ def _has_default_write(type_: type[BaseType], base: type[BaseType]) -> bool:
1208
1208
 
1209
1209
  def _int_to_bytes(type_: type[Int], value: str) -> str:
1210
1210
  """Return the code to convert a value of an integer type to bytes."""
1211
- return f"{value}.to_bytes({type_.__size__}, _byteorder[endian], signed={bool(type_.signed)})"
1211
+ return f"{value}.to_bytes({type_.__size__}, _byteorder[endian], signed={bool(type_.__signed__)})"
1212
1212
 
1213
1213
 
1214
1214
  def _get_attribute(var: str, name: str) -> str:
@@ -90,8 +90,8 @@ class cstruct:
90
90
  "int128": self._make_int_type("int128", 16, True, alignment=16),
91
91
  "uint128": self._make_int_type("uint128", 16, False, alignment=16),
92
92
 
93
- "uleb128": self._make_type("uleb128", (LEB128,), None, attrs={"signed": False}),
94
- "ileb128": self._make_type("ileb128", (LEB128,), None, attrs={"signed": True}),
93
+ "uleb128": self._make_type("uleb128", (LEB128,), None, attrs={"__signed__": False}),
94
+ "ileb128": self._make_type("ileb128", (LEB128,), None, attrs={"__signed__": True}),
95
95
 
96
96
  "void": self._make_type("void", (Void,), 0),
97
97
 
@@ -552,7 +552,7 @@ class cstruct:
552
552
  return cast("type[Array]", self._make_type(name, bases, size, alignment=type_.__alignment__, attrs=attrs))
553
553
 
554
554
  def _make_int_type(self, name: str, size: int, signed: bool, *, alignment: int | None = None) -> type[Int]:
555
- return cast("type[Int]", self._make_type(name, (Int,), size, alignment=alignment, attrs={"signed": signed}))
555
+ return cast("type[Int]", self._make_type(name, (Int,), size, alignment=alignment, attrs={"__signed__": signed}))
556
556
 
557
557
  def _make_packed_type(self, name: str, fmt: str, base: type, *, alignment: int | None = None) -> type[Packed]:
558
558
  return cast(
@@ -562,7 +562,7 @@ class cstruct:
562
562
  (base, Packed),
563
563
  struct.calcsize(fmt),
564
564
  alignment=alignment,
565
- attrs={"__fmt__": fmt},
565
+ attrs={"__fmt__": fmt, "__signed__": fmt.islower()},
566
566
  ),
567
567
  )
568
568
 
@@ -1,9 +1,10 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import warnings
3
4
  from typing import TYPE_CHECKING, Any, BinaryIO
4
5
 
5
6
  from dissect.cstruct.types.base import EOF, BaseType, MetaType
6
- from dissect.cstruct.util import ENDIANNESS_TO_BYTEORDER_MAP
7
+ from dissect.cstruct.util import ENDIANNESS_TO_BYTEORDER_MAP, classproperty
7
8
 
8
9
  if TYPE_CHECKING:
9
10
  from typing_extensions import Self
@@ -14,7 +15,7 @@ if TYPE_CHECKING:
14
15
  class Int(int, BaseType):
15
16
  """Integer type that can span an arbitrary amount of bytes."""
16
17
 
17
- signed: bool
18
+ __signed__: bool
18
19
 
19
20
  @classmethod
20
21
  def _read(cls, stream: BinaryIO, *, context: dict[str, Any] | None = None, endian: Endianness) -> Self:
@@ -23,7 +24,7 @@ class Int(int, BaseType):
23
24
  if len(data) != cls.__size__:
24
25
  raise EOFError(f"Read {len(data)} bytes, but expected {cls.__size__}")
25
26
 
26
- return type.__call__(cls, int.from_bytes(data, ENDIANNESS_TO_BYTEORDER_MAP[endian], signed=cls.signed))
27
+ return type.__call__(cls, int.from_bytes(data, ENDIANNESS_TO_BYTEORDER_MAP[endian], signed=cls.__signed__))
27
28
 
28
29
  @classmethod
29
30
  def _read_array(
@@ -40,7 +41,7 @@ class Int(int, BaseType):
40
41
 
41
42
  byteorder = ENDIANNESS_TO_BYTEORDER_MAP[endian]
42
43
  return [
43
- type.__call__(cls, int.from_bytes(data[i : i + size], byteorder, signed=cls.signed))
44
+ type.__call__(cls, int.from_bytes(data[i : i + size], byteorder, signed=cls.__signed__))
44
45
  for i in range(0, length, size)
45
46
  ]
46
47
 
@@ -58,4 +59,14 @@ class Int(int, BaseType):
58
59
 
59
60
  @classmethod
60
61
  def _write(cls, stream: BinaryIO, data: int, *, endian: Endianness) -> int:
61
- return stream.write(data.to_bytes(cls.__size__, ENDIANNESS_TO_BYTEORDER_MAP[endian], signed=cls.signed))
62
+ return stream.write(data.to_bytes(cls.__size__, ENDIANNESS_TO_BYTEORDER_MAP[endian], signed=cls.__signed__))
63
+
64
+ @classproperty
65
+ def signed(cls) -> bool:
66
+ """Access whether this integer type is signed."""
67
+ warnings.warn(
68
+ "The 'signed' property is deprecated, use '__signed__' instead.",
69
+ DeprecationWarning,
70
+ stacklevel=2,
71
+ )
72
+ return cls.__signed__
@@ -1,8 +1,10 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import warnings
3
4
  from typing import TYPE_CHECKING, Any, BinaryIO
4
5
 
5
6
  from dissect.cstruct.types.base import BaseType
7
+ from dissect.cstruct.util import classproperty
6
8
 
7
9
  if TYPE_CHECKING:
8
10
  from typing_extensions import Self
@@ -16,7 +18,7 @@ class LEB128(int, BaseType):
16
18
  See https://en.wikipedia.org/wiki/LEB128 for more information and an explanation of the algorithm.
17
19
  """
18
20
 
19
- signed: bool
21
+ __signed__: bool
20
22
 
21
23
  @classmethod
22
24
  def _read(cls, stream: BinaryIO, *, context: dict[str, Any] | None = None, endian: Endianness) -> Self:
@@ -33,7 +35,7 @@ class LEB128(int, BaseType):
33
35
  if (b & 0x80) == 0:
34
36
  break
35
37
 
36
- if cls.signed and b & 0x40 != 0:
38
+ if cls.__signed__ and b & 0x40 != 0:
37
39
  result |= ~0 << shift
38
40
 
39
41
  return cls.__new__(cls, result)
@@ -53,7 +55,7 @@ class LEB128(int, BaseType):
53
55
  @classmethod
54
56
  def _write(cls, stream: BinaryIO, data: int, *, endian: Endianness) -> int:
55
57
  # only write negative numbers when in signed mode
56
- if data < 0 and not cls.signed:
58
+ if data < 0 and not cls.__signed__:
57
59
  raise ValueError("Attempt to encode a negative integer using unsigned LEB128 encoding")
58
60
 
59
61
  result = bytearray()
@@ -64,8 +66,8 @@ class LEB128(int, BaseType):
64
66
 
65
67
  # function works similar for signed- and unsigned integers, except for the check when to stop
66
68
  # the encoding process.
67
- if ((cls.signed and (data == 0 and byte & 0x40 == 0)) or (data == -1 and byte & 0x40 != 0)) or (
68
- not cls.signed and data == 0
69
+ if ((cls.__signed__ and (data == 0 and byte & 0x40 == 0)) or (data == -1 and byte & 0x40 != 0)) or (
70
+ not cls.__signed__ and data == 0
69
71
  ):
70
72
  result.append(byte)
71
73
  break
@@ -75,3 +77,13 @@ class LEB128(int, BaseType):
75
77
 
76
78
  stream.write(result)
77
79
  return len(result)
80
+
81
+ @classproperty
82
+ def signed(cls) -> bool:
83
+ """Access whether this integer type is signed."""
84
+ warnings.warn(
85
+ "The 'signed' property is deprecated, use '__signed__' instead.",
86
+ DeprecationWarning,
87
+ stacklevel=2,
88
+ )
89
+ return cls.__signed__
@@ -48,6 +48,7 @@ class Packed(BaseType, Generic[T], metaclass=PackedMetaType):
48
48
  """Packed type for Python struct (un)packing."""
49
49
 
50
50
  __fmt__: str
51
+ __signed__: bool
51
52
 
52
53
  @classmethod
53
54
  def _read(cls, stream: BinaryIO, *, context: dict[str, Any] | None = None, endian: Endianness) -> Self:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissect.cstruct
3
- Version: 5.0.dev20
3
+ Version: 5.0.dev21
4
4
  Summary: A Dissect module implementing a parser for C-like structures: structure parsing in Python made easy
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License-Expression: Apache-2.0
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "5.0.dev0",
3
+ "distance": 21,
4
+ "node": "g57299c48c9dace441a08fb72ab1183eae9c5c9cb",
5
+ "dirty": true,
6
+ "branch": "main",
7
+ "node_date": "2026-11-18"
8
+ }
@@ -771,5 +771,11 @@ def test_deprecation_warnings(cs: cstruct) -> None:
771
771
  ):
772
772
  _ = cs.uint8.packchar
773
773
 
774
+ for type_ in (cs.int24, cs.uleb128):
775
+ with pytest.warns(
776
+ DeprecationWarning, match=re.escape("The 'signed' property is deprecated, use '__signed__' instead.")
777
+ ):
778
+ _ = type_.signed
779
+
774
780
  # No test for the pointer type since it also conflicts with a bug fix
775
781
  # (accessing a field named 'type' on a pointer type)
@@ -1158,6 +1158,7 @@ def test_write_custom_types(cs: cstruct) -> None:
1158
1158
 
1159
1159
  class CustomWrite(int, Packed):
1160
1160
  __fmt__ = "B"
1161
+ __signed__ = False
1161
1162
 
1162
1163
  @classmethod
1163
1164
  def _write(cls, stream: BinaryIO, data: int, *, endian: Endianness) -> int:
@@ -1165,6 +1166,7 @@ def test_write_custom_types(cs: cstruct) -> None:
1165
1166
 
1166
1167
  class CustomWriteArray(int, Packed):
1167
1168
  __fmt__ = "B"
1169
+ __signed__ = False
1168
1170
 
1169
1171
  @classmethod
1170
1172
  def _write_array(cls, stream: BinaryIO, data: list, *, endian: Endianness) -> int:
@@ -254,3 +254,18 @@ def test_packed_struct_write_range(cs: cstruct, compiled: bool) -> None:
254
254
 
255
255
  with pytest.raises(struct.error):
256
256
  cs.test(a=256, b=2, c=3, d=4.0).dumps()
257
+
258
+
259
+ def test_packed_signed(cs: cstruct) -> None:
260
+ """Test that the signed attribute is set correctly for packed types."""
261
+ assert cs.int8.__signed__ is True
262
+ assert cs.uint8.__signed__ is False
263
+ assert cs.int16.__signed__ is True
264
+ assert cs.uint16.__signed__ is False
265
+ assert cs.int32.__signed__ is True
266
+ assert cs.uint32.__signed__ is False
267
+ assert cs.int64.__signed__ is True
268
+ assert cs.uint64.__signed__ is False
269
+ assert cs.float16.__signed__ is True
270
+ assert cs.float.__signed__ is True
271
+ assert cs.double.__signed__ is True
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "5.0.dev0",
3
- "distance": 20,
4
- "node": "g3e19cdfe0c0489ef470a41791188d4939a3a87f0",
5
- "dirty": true,
6
- "branch": "main",
7
- "node_date": "2026-11-16"
8
- }