classification
Title: Refactor ossaudiodev: use _Py_read and _Py_write with the Py_buffer
Type: Stage:
Components: Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: 23708 Superseder:
Assigned To: Nosy List: neologix, pitrou, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2015-03-19 13:36 by vstinner, last changed 2015-03-20 09:40 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
ossaudiodev.patch vstinner, 2015-03-19 13:36 review
ossaudiodev-py_buffer.patch vstinner, 2015-03-19 23:31
Messages (5)
msg238516 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-03-19 13:36
Attached patch enhances ossaudiodev to support buffer larger than 2 GB (replace the C int type with C Py_ssize_t). It uses the new _Py_read() and _Py_write() functions added in the issue #23708 with the Py_buffer API.

By the way, I don't understand the purpose of the input and output counters (icount and ocount fields of the oss_audio_t structure), they don't look to be used?!
msg238520 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-03-19 13:40
Oh, I forgot to mention the advantage of using _Py_read() and _Py_write(): they retry read/write when interrupted by a signal, to support the PEP 475.
msg238584 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-03-19 23:30
New changeset d564695b67bb by Victor Stinner in branch 'default':
Issue #23709: The ossaudiodev module now retries read/write when interrupted by
https://hg.python.org/cpython/rev/d564695b67bb
msg238585 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-03-19 23:31
I commited changes to use _Py_read() and _Py_write().

I attach an updated patch to use Py_ssize_t instead of int, and to use Py_buffer instead of char*.
msg238629 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-03-20 09:39
New changeset d478a2a5738a by Victor Stinner in branch 'default':
Issue #23709, #23001: ossaudiodev now uses Py_ssize_t for sizes instead of int
https://hg.python.org/cpython/rev/d478a2a5738a
History
Date User Action Args
2015-03-20 09:40:21vstinnersetstatus: open -> closed
resolution: fixed
2015-03-20 09:39:49python-devsetmessages: + msg238629
2015-03-19 23:31:22vstinnersetfiles: + ossaudiodev-py_buffer.patch

messages: + msg238585
2015-03-19 23:30:17python-devsetnosy: + python-dev
messages: + msg238584
2015-03-19 22:44:53vstinnersetnosy: + pitrou, neologix
2015-03-19 13:41:20vstinnerlinkissue23648 dependencies
2015-03-19 13:40:51vstinnersetmessages: + msg238520
2015-03-19 13:36:53vstinnersetdependencies: + PEP 475: Add _Py_read() and _Py_write() functions
2015-03-19 13:36:49vstinnercreate