@@ -82,7 +82,6 @@ PyMemoryView_FromBuffer(Py_buffer *info)
8282 PyObject_GC_New (PyMemoryViewObject , & PyMemoryView_Type );
8383 if (mview == NULL )
8484 return NULL ;
85- mview -> base = NULL ;
8685 dup_buffer (& mview -> view , info );
8786 /* NOTE: mview->view.obj should already have been incref'ed as
8887 part of PyBuffer_FillInfo(). */
@@ -112,8 +111,6 @@ PyMemoryView_FromObject(PyObject *base)
112111 return NULL ;
113112 }
114113
115- mview -> base = base ;
116- Py_INCREF (base );
117114 return (PyObject * )mview ;
118115}
119116
@@ -291,8 +288,6 @@ PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char fort)
291288
292289 if (PyBuffer_IsContiguous (view , fort )) {
293290 /* no copy needed */
294- Py_INCREF (obj );
295- mem -> base = obj ;
296291 _PyObject_GC_TRACK (mem );
297292 return (PyObject * )mem ;
298293 }
@@ -324,21 +319,7 @@ PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char fort)
324319 Py_DECREF (mem );
325320 return NULL ;
326321 }
327- }
328- if (buffertype == PyBUF_SHADOW ) {
329- /* return a shadowed memory-view object */
330- view -> buf = dest ;
331- mem -> base = PyTuple_Pack (2 , obj , bytes );
332- Py_DECREF (bytes );
333- if (mem -> base == NULL ) {
334- Py_DECREF (mem );
335- return NULL ;
336- }
337- }
338- else {
339322 PyBuffer_Release (view ); /* XXX ? */
340- /* steal the reference */
341- mem -> base = bytes ;
342323 }
343324 _PyObject_GC_TRACK (mem );
344325 return (PyObject * )mem ;
@@ -481,28 +462,7 @@ static void
481462do_release (PyMemoryViewObject * self )
482463{
483464 if (self -> view .obj != NULL ) {
484- if (self -> base && PyTuple_Check (self -> base )) {
485- /* Special case when first element is generic object
486- with buffer interface and the second element is a
487- contiguous "shadow" that must be copied back into
488- the data areay of the first tuple element before
489- releasing the buffer on the first element.
490- */
491-
492- PyObject_CopyData (PyTuple_GET_ITEM (self -> base ,0 ),
493- PyTuple_GET_ITEM (self -> base ,1 ));
494-
495- /* The view member should have readonly == -1 in
496- this instance indicating that the memory can
497- be "locked" and was locked and will be unlocked
498- again after this call.
499- */
500- PyBuffer_Release (& (self -> view ));
501- }
502- else {
503- PyBuffer_Release (& (self -> view ));
504- }
505- Py_CLEAR (self -> base );
465+ PyBuffer_Release (& (self -> view ));
506466 }
507467 self -> view .obj = NULL ;
508468 self -> view .buf = NULL ;
@@ -819,8 +779,6 @@ memory_richcompare(PyObject *v, PyObject *w, int op)
819779static int
820780memory_traverse (PyMemoryViewObject * self , visitproc visit , void * arg )
821781{
822- if (self -> base != NULL )
823- Py_VISIT (self -> base );
824782 if (self -> view .obj != NULL )
825783 Py_VISIT (self -> view .obj );
826784 return 0 ;
@@ -829,7 +787,6 @@ memory_traverse(PyMemoryViewObject *self, visitproc visit, void *arg)
829787static int
830788memory_clear (PyMemoryViewObject * self )
831789{
832- Py_CLEAR (self -> base );
833790 PyBuffer_Release (& self -> view );
834791 return 0 ;
835792}
0 commit comments