You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MNT: new deprecations from CPython struct module in ctypes tests #28926
Running the tests with CPython 3.14.0b1, I see these failures:
FAILED numpy/_core/tests/test_dtype.py::TestFromCTypes::test_union_with_struct_packed - DeprecationWarning: Due to '_pack_', the 'Struct' Structure will use memory lay...
FAILED numpy/_core/tests/test_dtype.py::TestFromCTypes::test_union_packed - DeprecationWarning: Due to '_pack_', the 'Struct' Structure will use memory lay...
FAILED numpy/_core/tests/test_dtype.py::TestFromCTypes::test_packed_structure - DeprecationWarning: Due to '_pack_', the 'PackedStructure' Structure will use m...
FAILED numpy/_core/tests/test_dtype.py::TestFromCTypes::test_large_packed_structure - DeprecationWarning: Due to '_pack_', the 'PackedStructure' Structure will use m...
FAILED numpy/_core/tests/test_dtype.py::TestFromCTypes::test_big_endian_structure_packed - DeprecationWarning: Due to '_pack_', the 'BigEndStruct' Structure will use memo...
FAILED numpy/_core/tests/test_dtype.py::TestFromCTypes::test_little_endian_structure_packed - DeprecationWarning: Due to '_pack_', the 'LittleEndStruct' Structure will use m...
FAILED numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure - DeprecationWarning: Due to '_pack_', the 'struct' Structure will use memory lay...
FAILED numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_structure_aligned - DeprecationWarning: Due to '_pack_', the 'struct' Structure will use memory lay...
FAILED numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_union - DeprecationWarning: Due to '_pack_', the 'union' Union will use memory layout c...
FAILED numpy/tests/test_ctypeslib.py::TestAsCtypesType::test_padded_union - DeprecationWarning: Due to '_pack_', the 'union' Union will use memory layout c...
For now I'm just going to filter these warnings in the tests with a link back to this issue. Someone should investigate this and figure out why we're triggering deprecation warnings and whether we want to adjust things or give upstream some feedback.
Checking this it sounds like this is related to bit-fields only.
I am wondering if we should pester CPython to only deprecate it when the struct actually contains bit-types (which it never will for us)? On first sight, it feels a bit unnecessary to force us to specify something irrelevant.
EDIT: Opened an issue, let's see what CPython thinks.
I suspect Python shipped this as is, but I would be tempted to keep the warning filter around until they go through with the deprecation (if they do).
The confusing thing is that setting _layout_ = "ms" is correct because it only makes a difference for bitfields and we don't use bit fields.
For me, that means that Python shouldn't give a DeprecationWarning at all, but since I don't want to implement an "undefined" layout option myself let's see where things go :).
(There may be an argument that it might matter for other things in the future, I don't really buy it, because if it did I wouldn't be able to chose the right layout today.)
Anyway, I'll close it, I just hope we don't get too confused about the _layout_ = "ms" need when it happens. If you prefer, we can also just add it with a comment that it does nothing for _pack_ = 1 when packing bytes.
Activity
seberg commentedon May 9, 2025
Checking this it sounds like this is related to bit-fields only.
I am wondering if we should pester CPython to only deprecate it when the struct actually contains bit-types (which it never will for us)? On first sight, it feels a bit unnecessary to force us to specify something irrelevant.
EDIT: Opened an issue, let's see what CPython thinks.
seberg commentedon Jun 20, 2025
I suspect Python shipped this as is, but I would be tempted to keep the warning filter around until they go through with the deprecation (if they do).
The confusing thing is that setting
_layout_ = "ms"is correct because it only makes a difference for bitfields and we don't use bit fields.For me, that means that Python shouldn't give a
DeprecationWarningat all, but since I don't want to implement an "undefined" layout option myself let's see where things go :).(There may be an argument that it might matter for other things in the future, I don't really buy it, because if it did I wouldn't be able to chose the right layout today.)
Anyway, I'll close it, I just hope we don't get too confused about the
_layout_ = "ms"need when it happens. If you prefer, we can also just add it with a comment that it does nothing for_pack_ = 1when packing bytes.