-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
PEP-3118: remove obsolete write-locks #58411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
bytearray_getbuffer() checks for view==NULL. But this has never been PEP: "The second argument is the address to a bufferinfo structure. DOCS (3.2): "view must point to an existing Py_buffer structure A quick grep through the source tree shows no instances where Patch attached, all tests pass. I wouldn't be comfortable to BTW, the next conditional in bytearray_getbuffer ... if (ret >= 0) {
obj->ob_exports++;
} is also superfluous, since PyBuffer_FillInfo() cannot fail |
array_buffer_getbuf does a similar thing: if (view==NULL) goto finish; finish: Where does this view==NULL thing come from? |
I seems to be a feature to get a "lock" on an exporter Last use that I can see is here: http://hg.python.org/cpython/file/df3b2b5db900/Modules/posixmodule.c#l561 |
I have verified that this feature is unused in the source tree; in fact, there are no internal calls to bytearray_getbuffer() at all. The only thing bytearray_getbuffer() does with its second arg is pass it to PyBuffer_FillInfo(), which immediately checks it and passes 0 up the call stack if it is NULL. (A comment in PyBuffer_FillInfo() asks why -1 is not passed up instead; it's probably to distinguish this feature from the error condition handled in the immediately following conditional block.) There are potentially other issues stemming from this legacy feature in bytearray_getbuffer(), PyBuffer_FillInfo(), and elsewhere. The maintainers may see fit to open tickets on these issues as well. There's more relevant commentary on the feature here: http://comments.gmane.org/gmane.comp.python.devel/130521 |
New patch with tests. |
New changeset e8fe32d43c96 by Stefan Krah in branch 'default': |
bytesiobuf_getbuffer() also still has this obsolete feature, so I'm unsure if this plays well with the new SHARED_BUF(b) thing. Should the exception be raised before or after? |
I think before. It doesn't harm, but it doesn't make much sense to unshare the buffer if its address is not used. |
E.g. the buffer should be unshared before incrementing b->exports, but if an exception is raised instead, there is no need to unshare the buffer before raising. |
Ok, thanks! bpo-14203-3.diff should be correct, then. |
New changeset 0d5095a2422f by Stefan Krah in branch 'default': |
Compiling failed on Windows: http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/5650 |
Argh, the extern _PyBytesIOBuffer_Type hack. I knew it would cause some Any ideas how to test bytesiobuf_getbuffer() with a NULL view in |
New changeset 17a8c5f8ca48 by Stefan Krah in branch 'default': |
I think it's sufficient to test bytesiobuf_getbuffer() on |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: