8000 Merge pull request #13692 from oribro/capi-scanfunc-fromstr-update-doc · numpy/numpy@2d4975e · GitHub
[go: up one dir, main page]

Skip to content

Commit 2d4975e

Browse files
authored
Merge pull request #13692 from oribro/capi-scanfunc-fromstr-update-doc
DOC: Update C-API documentation of scanfunc, fromstr
2 parents 7dc91de + fa5469b commit 2d4975e

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

doc/source/reference/c-api.types-and-structures.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -530,20 +530,19 @@ PyArrayDescr_Type
530530
and ``is2`` *bytes*, respectively. This function requires
531531
behaved (though not necessarily contiguous) memory.
532532
533-
.. c:member:: int scanfunc(FILE* fd, void* ip , void* sep , void* arr)
533+
.. c:member:: int scanfunc(FILE* fd, void* ip, void* arr)
534534
535535
A pointer to a function that scans (scanf style) one element
536536
of the corresponding type from the file descriptor ``fd`` into
537537
the array memory pointed to by ``ip``. The array is assumed
538-
to be behaved. If ``sep`` is not NULL, then a separator string
539-
is also scanned from the file before returning. The last
540-
argument ``arr`` is the array to be scanned into. A 0 is
541-
returned if the scan is successful. A negative number
542-
indicates something went wrong: -1 means the end of file was
543-
reached before the separator string could be scanned, -4 means
544-
that the end of file was reached before the element could be
545-
scanned, and -3 means that the element could not be
546-
interpreted from the format string. Requires a behaved array.
538+
to be behaved.
539+
The last argument ``arr`` is the array to be scanned into.
540+
Returns number of receiving arguments successfully assigned (which
541+
may be zero in case a matching failure occurred before the first
542+
receiving argument was assigned), or EOF if input failure occurs
543+
before the first receiving argument was assigned.
544+
This function should be called without holding the Python GIL, and
545+
has to grab it for error reporting.
547546
548547
.. c:member:: int fromstr(char* str, void* ip, char** endptr, void* arr)
549548
@@ -554,6 +553,8 @@ PyArrayDescr_Type
554553
string. The last argument ``arr`` is the array into which ip
555554
points (needed for variable-size data- types). Returns 0 on
556555
success or -1 on failure. Requires a behaved array.
556+
This function should be called without holding the Python GIL, and
557+
has to grab it for error reporting.
557558
558559
.. c:member:: Bool nonzero(void* data, void* arr)
559560

0 commit comments

Comments
 (0)
0