]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-137696: Rename 'fort' parameter to 'order' in PyBuffer_* functions (#137866)
authorCarlos Sousa <40635471+CarlosEduR@users.noreply.github.com>
Thu, 19 Mar 2026 11:24:27 +0000 (08:24 -0300)
committerGitHub <noreply@github.com>
Thu, 19 Mar 2026 11:24:27 +0000 (16:54 +0530)
Doc/c-api/buffer.rst
Include/pybuffer.h
Objects/abstract.c

index e00b28ca4d7a7e76b67429f363d17f0ab27894a9..fe950196297a24b02c6fcfc7a81f36ddda4d4467 100644 (file)
@@ -500,10 +500,11 @@ Buffer-related functions
    *indices* must point to an array of ``view->ndim`` indices.
 
 
-.. c:function:: int PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, Py_ssize_t len, char fort)
+.. c:function:: int PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, Py_ssize_t len, char order)
 
    Copy contiguous *len* bytes from *buf* to *view*.
-   *fort* can be ``'C'`` or ``'F'`` (for C-style or Fortran-style ordering).
+   *order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style
+   ordering or either one).
    ``0`` is returned on success, ``-1`` on error.
 
 
index ca1c6058d9052c53588dafddc229a1ef13445ca4..6371b9b483777ba0f459927cd1a950d62521c42c 100644 (file)
@@ -67,27 +67,27 @@ PyAPI_FUNC(int) PyBuffer_FromContiguous(const Py_buffer *view, const void *buf,
    error (i.e. the object does not have a buffer interface or
    it is not working).
 
-   If fort is 'F', then if the object is multi-dimensional,
+   If order 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
-   fort is 'C', then the data will be copied into the array
-   in C-style (last dimension varies the fastest).  If fort
+   order is 'C', then the data will be copied into the array
+   in C-style (last dimension varies the fastest).  If order
    is 'A', then it does not matter and the copy will be made
    in whatever way is more efficient. */
 PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src);
 
 /* Copy the data from the src buffer to the buffer of destination. */
-PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort);
+PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char order);
 
 /*Fill the strides array with byte-strides of a contiguous
-  (Fortran-style if fort is 'F' or C-style otherwise)
+  (Fortran-style if order is 'F' or C-style otherwise)
   array of the given shape with the given number of bytes
   per element. */
 PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
                                                Py_ssize_t *shape,
                                                Py_ssize_t *strides,
                                                int itemsize,
-                                               char fort);
+                                               char order);
 
 /* Fills in a buffer-info structure correctly for an exporter
    that can only share a contiguous chunk of memory of
index f2c7de3d1ef1adce934ac8f5e4853be48f63bb31..0bbf60840a3346bee53f47340248bc498503b3d1 100644 (file)
@@ -624,7 +624,7 @@ done:
 }
 
 int
-PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, Py_ssize_t len, char fort)
+PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, Py_ssize_t len, char order)
 {
     int k;
     void (*addone)(int, Py_ssize_t *, const Py_ssize_t *);
@@ -636,7 +636,7 @@ PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, Py_ssize_t len,
         len = view->len;
     }
 
-    if (PyBuffer_IsContiguous(view, fort)) {
+    if (PyBuffer_IsContiguous(view, order)) {
         /* simplest copy is all that is needed */
         memcpy(view->buf, buf, len);
         return 0;
@@ -654,7 +654,7 @@ PyBuffer_FromContiguous(const Py_buffer *view, const void *buf, Py_ssize_t len,
         indices[k] = 0;
     }
 
-    if (fort == 'F') {
+    if (order == 'F') {
         addone = _Py_add_one_to_index_F;
     }
     else {
@@ -749,13 +749,13 @@ int PyObject_CopyData(PyObject *dest, PyObject *src)
 void
 PyBuffer_FillContiguousStrides(int nd, Py_ssize_t *shape,
                                Py_ssize_t *strides, int itemsize,
-                               char fort)
+                               char order)
 {
     int k;
     Py_ssize_t sd;
 
     sd = itemsize;
-    if (fort == 'F') {
+    if (order == 'F') {
         for (k=0; k<nd; k++) {
             strides[k] = sd;
             sd *= shape[k];