GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing github.com — gh-117031: Add support for arbitrary C integer types for PyMemberDef.type by serhiy-storchaka · Pull Request #132550 · python/cpython Conversation
|
|
Hum, I prefer #117032 approach with one member type per C type. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Stan Ulbrych <[email protected]>
|
Thanks @StanFromIreland. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
What do you think about using the lower byte for all |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Perhaps Py_ASNATIVEBYTES_UNSIGNED_BUFFER can be used without Py_ASNATIVEBYTES_REJECT_NEGATIVE (but not opposite). All other flags do not make sense here. Endianess is always native, there is no reason to not support Question: how to combine this with |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…' into structmember-types2
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM, though off_t seems a bit of a weird one in all cases...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
If you use UNSIGNED_BUFFER without REJECT_NEGATIVE, then you can get data in the most significant bit for a large positive int rather than being guaranteed a sign bit. It's like a normal C cast. Without UNSIGNED_BUFFER but with REJECT_NEGATIVE, you're guaranteed that the top bit is going to be 0, because it must be the sign bit and you'll never have a negative value, so you have 1 fewer bits of data. If a normal C cast is not appropriate here (and I don't think it is), then for unsigned types you'll want both flags and for signed types you'll want neither. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| {"T_CHAR", Py_T_CHAR, offsetof(test_structmembers, structmembers.char_member), 0, NULL}, | ||
| {"T_INT8", Py_T_INTEGER(int8_t), offsetof(test_structmembers, structmembers.int8_member), 0, NULL}, | ||
| {"T_UINT8", Py_T_INTEGER(uint8_t), offsetof(test_structmembers, structmembers.uint8_member), 0, NULL}, | ||
| {"T_XINT8", Py_T_INTEGER(int8_t)|Py_T_INTEGER(uint8_t), offsetof(test_structmembers, structmembers.xint8_member), 0, NULL}, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't get the use case of this weird type. If you consider that it's important to support it, can you at least document it?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.