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-105059: Remove anonymous union from PyObject by eduardo-elizondo · Pull Request #105275 · python/cpython Conversation
|
| return; | ||
| } | ||
| op->ob_refcnt_split[PY_BIG_ENDIAN] = new_refcnt; | ||
| memcpy(&op->ob_refcnt, &new_refcnt, sizeof(new_refcnt)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Isn't this require the little-endian?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe move the union here, use memcpy() and only use the bits that you need in the union?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The problem of the current implementation (without this change) is the usage of anonymous union in PyObject: it is not compatible with (strict) C99. A named union is fine with C89 and C99. It's more about finding the right syntax to get the most efficient code.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| #include <assert.h> // assert() | ||
| #include <wchar.h> // wchar_t | ||
| #include <string.h> // memcpy() |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It makes me sad to use memcpy() in the limited C API which should attempt to hide as many implementation details as possible. I don't get how the immortal object change interacts with the stable ABI. I would prefer to convert Py_INCREF/Py_DECREF to opaque function calls. It would avoid any C and C++ compatibility issue. At least, it would make the ABI a little bit more "forward compatible".
But that can be done later, since the priority is to unblock the next Python 3.12 beta release.
By the way, the nogil fork has also a completely different implementation which is also ABI incompatible unless these functions are implemented as opaque function calls.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🤖 New build scheduled with the buildbot fleet by @gpshead for commit 79851a5 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'll be closing since there's better discussions on this in other places |
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.