New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ml_flag of nditer.close mismatches its implementation and documentation #18665
Comments
PRs welcome. A very short test would be nice, but I think we can just change it since passing an argument can be a clear bug (or typo) if anyone actually does it. Interestingly, if we would ever be using any non-standard calling convention, it would seem that we should also add the second argument |
numpy/numpy/core/src/multiarray/methods.c Lines 1707 to 1708 in c1ce397
numpy/numpy/core/src/multiarray/methods.c Lines 2730 to 2732 in c1ce397
Code like I think we should rely on ml_flag to indicate a certain calling convention. When a foreign function is not declared with
|
Yes of course. The point is Now if there were compilers/systems where that mattered, I am bet we would have noticed long ago (since it seems incorrect everywhere)... So its probably just OK and we can assume |
Closed by the PR listed above. Please reopen if I misunderstood or if there is more to do here. |
nditer.close (documentation) takes no arguments, the foreign function implements it also takes only the
self
parameter:numpy/numpy/core/src/multiarray/nditer_pywrap.c
Lines 2317 to 2318 in 8ada030
However, this foreign function is declared with the ml_flag
METH_VARARGS
, which should beMETH_NOARGS
(Python/C API documentation):numpy/numpy/core/src/multiarray/nditer_pywrap.c
Lines 2371 to 2372 in 8ada030
Otherwise, you can write
it.close(1)
orit.close('str')
without getting any error reports.The text was updated successfully, but these errors were encountered: