Uh oh!
There was an error while loading. Please reload this page.
gh-61103: use PEP 3118 codes in the ctypes - #149344
Conversation
This change only buffer protocol support for complex types, `_type_` properties aren't affected.
skirpichev
commented
May 4, 2026
@encukou, I think this should fix compatibility with NumPy (buffer protocol). We can decide later what to do with |
encukou
commented
May 4, 2026
I'm worried that this is a breaking change relative to Python 3.14. But, with #148676 this would be redundant. |
Documentation build overview
|
skirpichev
commented
May 4, 2026
Done.
(I think merging that pr is a bad idea.) Though, you are right, my 3 PRs - only an alternative. |
vstinner
commented
May 4, 2026
I merged my PR instead which changes ctypes |
skirpichev
commented
May 5, 2026
@vstinner, you already closed this door by #149368. Anyway, that's a kind of direction I would like to support, instead of #148676. No multiple type codes. I only worry, that in this way you also introduce incompatibility with the NumPy. That's why reversion of my changes in 3.15 and struct (deprecation) looks better for me. Lets wait decision on a PEP. Then extend the struct module in The Right Way. Then adapt other stuff. This PR does make sense only on this kind of road. |
vstinner
commented
May 5, 2026
Converting an $ python3.15 >>> import array, numpy as np
>>> a=array.array('Zd', [0])
>>> a.typecode
'Zd'
>>> n=np.array(a)
>>> n.dtype
dtype('complex128')Converting a I suggest continuing this discussion at https://discuss.python.org/t/choice-of-complex-buffer-protocol-format-intentional-break-with-pep/106949. |
This change only buffer protocol support for complex types,
_type_properties aren't affected.