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.
Created on 2010年04月03日 15:24 by vstinner, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| memoryview_crash.py | vstinner, 2010年04月03日 15:25 | |||
| Messages (8) | |||
|---|---|---|---|
| msg102270 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2010年04月03日 15:24 | |
memory_item() function creates a new memoryview object if ndim is different than 1. Example with numpy: from numpy import array y=array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) y.shape = 3,4 view=memoryview(y) view2 = view[0] print type(view2) Result: <type 'memoryview'>. (Without the shape, ndim equals 1, and view2 is a standard str object.) The problem is that view attribute of the view2 (PyMemoryViewObject) is not initialized. Extract of memory_item(): /* Return a new memory-view object */ Py_buffer newview; memset(&newview, 0, sizeof(newview)); /* XXX: This needs to be fixed so it actually returns a sub-view */ return PyMemoryView_FromBuffer(&newview); "This needs to be fixed" :-/ -- view2 is not initialized and so view2.tolist() does crash. |
|||
| msg102271 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2010年04月03日 15:25 | |
Full example (using numpy) crashing Python: memoryview_crash.py |
|||
| msg102278 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2010年04月03日 15:44 | |
According to #2394, the implementation of the new buffer API is not complete. |
|||
| msg103956 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年04月22日 11:39 | |
I'll leave this to our numpy experts. I don't even know how to unit test this without installing numpy. |
|||
| msg141860 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2011年08月10日 12:39 | |
The crash is fixed in the features/pep-3118 repo: >>> from numpy import array >>> y=array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) >>> y.shape = 3,4 >>> view=memoryview(y) >>> view2 = view[0] Traceback (most recent call last): File "<stdin>", line 1, in <module> NotImplementedError: multi-dimensional sub-views are not implemented [182251 refs] |
|||
| msg152993 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2012年02月09日 22:33 | |
Fixed in #10181. |
|||
| msg154242 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年02月25日 11:25 | |
New changeset 3f9b3b6f7ff0 by Stefan Krah in branch 'default': - Issue #10181: New memoryview implementation fixes multiple ownership http://hg.python.org/cpython/rev/3f9b3b6f7ff0 |
|||
| msg154747 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2012年03月02日 07:49 | |
Since this issue targeted 2.7 and 3.2: In a brief discussion on python-dev it was decided that the 3.3 fixes from #10181 won't be backported for a number of reasons, see: http://mail.python.org/pipermail/python-dev/2012-February/116872.html |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:59 | admin | set | github: 52552 |
| 2012年03月02日 07:49:15 | skrah | set | messages: + msg154747 |
| 2012年02月25日 11:25:31 | python-dev | set | nosy:
+ python-dev messages: + msg154242 |
| 2012年02月09日 22:33:54 | skrah | set | status: open -> closed superseder: Problems with Py_buffer management in memoryobject.c (and elsewhere?) messages: + msg152993 dependencies: - Problems with Py_buffer management in memoryobject.c (and elsewhere?) resolution: duplicate stage: needs patch -> resolved |
| 2011年08月10日 12:39:21 | skrah | set | nosy:
+ skrah dependencies: + Problems with Py_buffer management in memoryobject.c (and elsewhere?) messages: + msg141860 |
| 2011年05月09日 15:29:40 | pitrou | set | nosy:
+ mark.dickinson versions: + Python 3.3 |
| 2010年04月22日 11:39:08 | pitrou | set | priority: normal assignee: teoliphant messages: + msg103956 stage: needs patch |
| 2010年04月22日 11:31:59 | vstinner | set | nosy:
+ gvanrossum, georg.brandl, pitrou, scoder, benjamin.peterson |
| 2010年04月03日 15:44:56 | vstinner | set | nosy:
+ teoliphant messages: + msg102278 |
| 2010年04月03日 15:26:35 | vstinner | set | type: crash components: + Interpreter Core |
| 2010年04月03日 15:25:56 | vstinner | set | files:
+ memoryview_crash.py messages: + msg102271 |
| 2010年04月03日 15:24:41 | vstinner | create | |