[Python-3000-checkins] r63994 - in python/branches/py3k: Include/object.h Modules/_bsddb.c Modules/_ctypes/_ctypes.c Modules/arraymodule.c Objects/abstract.c Objects/memoryobject.c
travis.oliphant
python-3000-checkins at python.org
Fri Jun 6 22:52:39 CEST 2008
Author: travis.oliphant
Date: Fri Jun 6 22:52:38 2008
New Revision: 63994
Log:
Remove locking from buffer protocol as-per discussion.
Modified:
python/branches/py3k/Include/object.h
python/branches/py3k/Modules/_bsddb.c
python/branches/py3k/Modules/_ctypes/_ctypes.c
python/branches/py3k/Modules/arraymodule.c
python/branches/py3k/Objects/abstract.c
python/branches/py3k/Objects/memoryobject.c
Modified: python/branches/py3k/Include/object.h
==============================================================================
--- python/branches/py3k/Include/object.h (original)
+++ python/branches/py3k/Include/object.h Fri Jun 6 22:52:38 2008
@@ -163,7 +163,6 @@
#define PyBUF_WRITABLE 0x0001
/* we used to include an E, backwards compatible alias */
#define PyBUF_WRITEABLE PyBUF_WRITABLE
-#define PyBUF_LOCK 0x0002
#define PyBUF_FORMAT 0x0004
#define PyBUF_ND 0x0008
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
@@ -174,25 +173,15 @@
#define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE)
#define PyBUF_CONTIG_RO (PyBUF_ND)
-#define PyBUF_CONTIG_LCK (PyBUF_ND | PyBUF_LOCK)
-#define PyBUF_CONTIG_XLCK (PyBUF_ND | PyBUF_LOCK | PyBUF_WRITABLE)
#define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE)
#define PyBUF_STRIDED_RO (PyBUF_STRIDES)
-#define PyBUF_STRIDED_LCK (PyBUF_STRIDES | PyBUF_LOCK)
-#define PyBUF_STRIDED_XLCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_WRITABLE)
#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT)
#define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT)
-#define PyBUF_RECORDS_LCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_FORMAT)
-#define PyBUF_RECORDS_XLCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_WRITABLE \
- | PyBUF_FORMAT)
#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT)
#define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT)
-#define PyBUF_FULL_LCK (PyBUF_INDIRECT | PyBUF_LOCK | PyBUF_FORMAT)
-#define PyBUF_FULL_XLCK (PyBUF_INDIRECT | PyBUF_LOCK | PyBUF_WRITABLE \
- | PyBUF_FORMAT)
#define PyBUF_READ 0x100
Modified: python/branches/py3k/Modules/_bsddb.c
==============================================================================
--- python/branches/py3k/Modules/_bsddb.c (original)
+++ python/branches/py3k/Modules/_bsddb.c Fri Jun 6 22:52:38 2008
@@ -312,12 +312,6 @@
"Py_buffer malloc failed");
return NULL;
}
- /* We use PyBUF_LOCK to prevent other threads from trashing the data
- buffer while we release the GIL. http://bugs.python.org/issue1035 */
- if (PyObject_GetBuffer(obj, view, PyBUF_LOCK) == -1) {
- PyMem_Free(view);
- return NULL;
- }
if (view->ndim > 1) {
PyErr_SetString(PyExc_BufferError,
"buffers must be single dimension");
Modified: python/branches/py3k/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/_ctypes.c (original)
+++ python/branches/py3k/Modules/_ctypes/_ctypes.c Fri Jun 6 22:52:38 2008
@@ -2449,11 +2449,6 @@
Py_ssize_t i;
if (view == NULL) return 0;
- if (((flags & PyBUF_LOCK) == PyBUF_LOCK)) {
- PyErr_SetString(PyExc_BufferError,
- "Cannot lock this object.");
- return -1;
- }
view->buf = self->b_ptr;
view->len = self->b_size;
Modified: python/branches/py3k/Modules/arraymodule.c
==============================================================================
--- python/branches/py3k/Modules/arraymodule.c (original)
+++ python/branches/py3k/Modules/arraymodule.c Fri Jun 6 22:52:38 2008
@@ -1779,11 +1779,6 @@
static int
array_buffer_getbuf(arrayobject *self, Py_buffer *view, int flags)
{
- if ((flags & PyBUF_LOCK)) {
- PyErr_SetString(PyExc_BufferError,
- "Cannot lock data");
- return -1;
- }
if (view==NULL) goto finish;
view->buf = (void *)self->ob_item;
Modified: python/branches/py3k/Objects/abstract.c
==============================================================================
--- python/branches/py3k/Objects/abstract.c (original)
+++ python/branches/py3k/Objects/abstract.c Fri Jun 6 22:52:38 2008
@@ -672,12 +672,6 @@
int readonly, int flags)
{
if (view == NULL) return 0;
- if (((flags & PyBUF_LOCK) == PyBUF_LOCK) &&
- readonly != 0) {
- PyErr_SetString(PyExc_BufferError,
- "Cannot lock this object.");
- return -1;
- }
if (((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) &&
(readonly == 1)) {
PyErr_SetString(PyExc_BufferError,
Modified: python/branches/py3k/Objects/memoryobject.c
==============================================================================
--- python/branches/py3k/Objects/memoryobject.c (original)
+++ python/branches/py3k/Objects/memoryobject.c Fri Jun 6 22:52:38 2008
@@ -230,9 +230,6 @@
case PyBUF_WRITE:
flags = PyBUF_FULL;
break;
- case PyBUF_SHADOW:
- flags = PyBUF_FULL_XLCK;
- break;
}
if (PyObject_GetBuffer(obj, view, flags) != 0) {
More information about the Python-3000-checkins
mailing list