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.

classification
Title: Format string for ASCII unicode or bytes-like object as readonly buffer
Type: enhancement Stage: needs patch
Components: Interpreter Core Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, christian.heimes, gregory.p.smith, pitrou, vstinner
Priority: normal Keywords:

Created on 2013-11-20 18:14 by christian.heimes, last changed 2022-04-11 14:57 by admin.

Messages (5)
msg203516 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-11-20 18:14
I could use a format string for either ASCII unicode or bytes buffer in a few places, e.g. 

a* (bytes, bytearray, bytes-like object or ASCII unicode) [Py_buffer]

Like y* it should handle PyBUF_SIMPLE with 'C' contiguous but it should only accept one dimensional buffers. In case the object is an ASCII PyUnicode_Object it should return its ASCII data as Py_buffer.
msg203518 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-11-20 18:20
It seems this would add a dependency to the unicode implementation (other unicode representations may not allow you to take a Py_buffer to the ASCII data).
msg203617 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-11-21 11:55
Where do you plan to use this new format? Can you please give examples?

> (other unicode representations may not allow you to take a Py_buffer to the ASCII data).

Py_buffer and PyArg_ParseTuple() are very specific to CPython.
msg345078 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2019-06-09 09:38
Don't we need to discuss it more before triage it as "patch required"?
msg345180 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2019-06-11 04:57
"needs patch" doesn't mean it has been accepted, it's just a common state for issues where nobody has written any code even as a proof of concept.

Christian - is this still desired?
History
Date User Action Args
2022-04-11 14:57:53adminsetgithub: 63865
2019-06-11 04:57:58gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg345180
2019-06-09 09:38:40BTaskayasetnosy: + BTaskaya
messages: + msg345078
2014-10-14 16:51:50skrahsetnosy: - skrah
2013-11-21 11:55:25vstinnersetmessages: + msg203617
2013-11-21 02:22:03vstinnersetnosy: + vstinner, skrah
2013-11-20 18:20:40pitrousetnosy: + pitrou
messages: + msg203518
2013-11-20 18:14:16christian.heimescreate