New submission from Joannah Nanjekye <nanjekyejoan...@gmail.com>:

I suggest implementing a C-API for copying data into a buffer exported by an 
obj. i.e 


int PyObject_CopyToObject(PyObject *obj, void *buf, Py_ssize_t len,
                          char fortran)

as was intended in PEP 3118. The documentation there says this functionality 
should:

"Copy len bytes of data pointed to by the contiguous chunk of memory pointed to 
by buf into the buffer exported by obj. Return 0 on success and return -1 and 
raise an error on failure. If the object does not have a writable buffer, then 
an error is raised. If fortran is 'F', then if the object is multi-dimensional, 
then the data will be copied into the array in Fortran-style (first dimension 
varies the fastest). If fortran is 'C', then the data will be copied into the 
array in C-style (last dimension varies the fastest). If fortran is 'A', then 
it does not matter and the copy will be made in whatever way is more efficient."

----------
components: C API
messages: 363264
nosy: nanjekyejoannah
priority: normal
severity: normal
status: open
title: Implement PyObject_CopyToObject
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39835>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to