[issue26746] struct.pack(): trailing padding bytes on x64

2019-04-21 Thread Stefan Krah
Change by Stefan Krah : -- nosy: +Eric.Wieser ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26746] struct.pack(): trailing padding bytes on x64

2017-12-27 Thread Stefan Krah
Change by Stefan Krah : -- versions: +Python 3.7 -Python 3.6 ___ Python tracker ___ ___

[issue26746] struct.pack(): trailing padding bytes on x64

2017-12-27 Thread Stefan Krah
Stefan Krah added the comment: I have just worked on PEP-3118 ==> Datashape translation and I have encountered many issues similar to the ones in the PR referenced by Allan. It seems to me that we should simplify the PEP-3118 struct syntax as much as possible in order to

[issue26746] struct.pack(): trailing padding bytes on x64

2016-07-06 Thread Allan Haldane
Allan Haldane added the comment: Hello, Over at numpy I have a proposed fix for the bug you discovered, that numpy drops trailing padding in the 3118 format string. My strategy is going to make numpy interpret format strings exactly the same way as the struct module, let me know if you

[issue26746] struct.pack(): trailing padding bytes on x64

2016-05-09 Thread Meador Inge
Meador Inge added the comment: I'm not to crazy about the trailing padding syntax either. The behavior is documented all the way back to Python 2.6. So, I would be hesitant to change it now. If the new 'T{...}' struct syntax from issue3132 ever gets added, then maybe we could address this

[issue26746] struct.pack(): trailing padding bytes on x64

2016-04-13 Thread Stefan Krah
Stefan Krah added the comment: Thank you. So technically, in the above NumPy example the format string generated by NumPy would be considered incomplete if we assume struct syntax: >>> m = memoryview(x) >>> m.format 'T{B:x:xxxL:y:B:z:}' I find this "0L" thing a very odd notation. Taking

[issue26746] struct.pack(): trailing padding bytes on x64

2016-04-13 Thread Martin Panter
Martin Panter added the comment: This behaviour seems to be documented, although it is not very explicit, and a bit surprising to me. See the third note at the end of : “align the end . . . with a repeat count of

[issue26746] struct.pack(): trailing padding bytes on x64

2016-04-13 Thread Stefan Krah
New submission from Stefan Krah: On the x64 architecture gcc adds trailing padding bytes after the last struct member. NumPy does the same: >>> import numpy as np >>> >>> t = np.dtype([('x', 'u1'), ('y', 'u8'), ('z', 'u1')], align=True) >>> x = np.array([(1, 2, 3)], dtype=t) >>> x.tostring()