homepage

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.

Author vstinner
Recipients pitrou, vstinner
Date 2011年10月01日.01:50:49
SpamBayes Score 0.00019041261
Marked as misclassified No
Message-id <1317433851.47.0.137164360321.issue13083@psf.upfronthosting.co.za>
In-reply-to
Content
getstring() of the _sre module contains the following code:
-------------
 ...
 buffer = Py_TYPE(string)->tp_as_buffer;
 if (!buffer || !buffer->bf_getbuffer ||
 (*buffer->bf_getbuffer)(string, &view, PyBUF_SIMPLE) < 0) {
 PyErr_SetString(PyExc_TypeError, "expected string or buffer");
 return NULL;
 }
 /* determine buffer size */
 bytes = view.len;
 ptr = view.buf;
 /* Release the buffer immediately --- possibly dangerous
 but doing something else would require some re-factoring
 */
 PyBuffer_Release(&view);
 ...
-------------
getstring() is used to initialize a state or a pattern. State and pattern have destructors (pattern_dealloc() and state_fini()), so it should be possible to keep the view active and call PyBuffer_Release() in the destructor.
History
Date User Action Args
2011年10月01日 01:50:51vstinnersetrecipients: + vstinner, pitrou
2011年10月01日 01:50:51vstinnersetmessageid: <1317433851.47.0.137164360321.issue13083@psf.upfronthosting.co.za>
2011年10月01日 01:50:50vstinnerlinkissue13083 messages
2011年10月01日 01:50:49vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /