This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: bytes buffer API needs to support read locking and/or PyBUF_LOCKDATA
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 3.0
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: brett.cannon, christian.heimes, gregory.p.smith
Priority: normal Keywords: patch

Created on 2007-08-27 07:42 by gregory.p.smith, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
bytes-readlock-via-lockdata-gps02.patch.txt gregory.p.smith, 2007-09-12 06:57
Messages (7)
msg55333 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2007-08-27 07:42
I've converted _bsddb.c to use the py3k buffer API for all data and keys
it takes as input.  All tests now fail with this error:

BufferError: Cannot make this object read-only.

This presumably results from this call:

  PyObject_GetBuffer(obj, view, PyBUF_LOCKDATA)

I need to lock the data so that the GIL can be released during database
operations (I/O).

Allowing bytes objects to have an immutability or readonly bit (internal
or otherwise) has been a recent topic on the python-3000 mailing list;
that would allow bytes' buffer API to satisfy this GetBuffer LOCKDATA
msg55456 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2007-08-30 03:11
I sent an initial patch to the mailing list.  Its too late to be ready
for 3.0a1; I'll fix it up next week.
msg55838 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2007-09-12 06:57
Attaching the most recent patch (minor update from the second one i sent
to the python-3000 mailing list to initialize ob_readonly_exports = 0 in
the appropriate places).

Current mailing list discussion is pointing out that the name LOCKDATA
means something other than what the existing pep3118 description implies
and that we may want to modify the pep to support more obviously named
things such as READ_LOCK, and EXCLUSIVE or similar...  here's a link to
the current thread:
msg56260 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2007-10-07 23:23
All the tests pass for me, Gregory.  Were the failures with some patch
you  had only locally?
msg56263 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2007-10-08 02:56
This bug will be taken care of by PEP 3137 being implemented.

Anyways, no the _bsddb.c changes that I checked in do not cause a
problem because I checked them in using PyBUF_SIMPLE.

Until PEP 3137 is implemented the possibility of hidden data corruption
due to mutable bytes objects being modified while an IO library that
releases the GIL is using them remains.

Feel free to close this bug in favor of something that just tracks the
PEP being implemented.
msg56264 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2007-10-08 03:46
On 10/7/07, Gregory P. Smith <> wrote:
> Feel free to close this bug in favor of something that just tracks the
> PEP being implemented.

Eh, it can stay open as a reminder to double-check everything is fine
once PEP 3137 goes in.  It's really up to you since the bugs is
assigned to you.  =)
msg60168 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-19 14:21
*ping* Can this issue be closed?
Date User Action Args
2022-04-11 14:56:26adminsetgithub: 45376
2008-01-19 18:43:03gregory.p.smithsetstatus: pending -> closed
2008-01-19 14:21:52christian.heimessetstatus: open -> pending
nosy: + christian.heimes
resolution: fixed
messages: + msg60168
2008-01-06 22:29:45adminsetkeywords: - py3k
versions: Python 3.0
2007-10-08 03:46:41brett.cannonsetmessages: + msg56264
2007-10-08 02:56:38gregory.p.smithsetmessages: + msg56263
2007-10-07 23:23:02brett.cannonsetpriority: normal
nosy: + brett.cannon
messages: + msg56260
2007-09-12 06:57:35gregory.p.smithsetkeywords: + patch
files: + bytes-readlock-via-lockdata-gps02.patch.txt
messages: + msg55838
title: bytes buffer API needs to support PyBUF_LOCKDATA -> bytes buffer API needs to support read locking and/or PyBUF_LOCKDATA
2007-08-30 03:11:22gregory.p.smithsetassignee: gregory.p.smith
messages: + msg55456
2007-08-27 07:48:19gregory.p.smithsetpriority: normal -> (no value)
2007-08-27 07:42:48gregory.p.smithcreate