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年09月30日 17:46 by kermode, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| bufobj.c.gz | kermode, 2010年09月30日 17:46 | Embedded Python C program; crashes with Python 3.2a2 | ||
| Messages (4) | |||
|---|---|---|---|
| msg117754 - (view) | Author: Lenard Lindstrom (kermode) | Date: 2010年09月30日 17:46 | |
Python 3.2a2+ (py3k:85072M, Sep 29 2010, 12:11:17) (from SVN) [GCC 4.4.5 20100728 (prerelease)] on linux2 (Debian squeeze) The ~Py_buffer.obj field is undocumented. Yet memoryview, that acts as a wrapper, includes the field in gc traversal. Also, if the field is not initialized by bf_getbuffer its value can be indeterminate. For memoryview the gc can crash (see attached C demo program). |
|||
| msg117770 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年10月01日 01:10 | |
The recommended way is to use PyBuffer_FillInfo() (and then fill in any additional data if necessary), which will set the pointer and incref it itself. I agree all this is a bit poorly documented. |
|||
| msg117780 - (view) | Author: Lenard Lindstrom (kermode) | Date: 2010年10月01日 07:26 | |
This will work for bf_getbuffer, though having PyObject_GetBuffer set the obj field before passing it to the callback might be safer. Also, this does not address the case with wrapper types like memoryview. What happens if ~Py_buffer.obj is not visited in tp_traverse? Should this be documented? |
|||
| msg125330 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2011年01月04日 14:56 | |
Closing as a dupe of 10181, but transferring Lenard's comments over there. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:07 | admin | set | github: 54210 |
| 2011年01月04日 14:56:10 | ncoghlan | set | status: open -> closed superseder: Problems with Py_buffer management in memoryobject.c (and elsewhere?) messages: + msg125330 nosy: mark.dickinson, ncoghlan, kermode, pitrou, docs@python resolution: duplicate |
| 2011年01月04日 01:03:42 | pitrou | set | nosy:
+ mark.dickinson, ncoghlan |
| 2010年10月01日 07:26:12 | kermode | set | messages: + msg117780 |
| 2010年10月01日 01:10:22 | pitrou | set | assignee: docs@python components: + Documentation, - Interpreter Core versions: + Python 3.1, Python 2.7 nosy: + docs@python, pitrou messages: + msg117770 stage: needs patch |
| 2010年09月30日 17:46:45 | kermode | create | |