summaryrefslogtreecommitdiff
path: root/numpy/f2py/cfuncs.py
Commit message (Collapse)AuthorAgeFilesLines
* BUG: Fixup f2py's handling a very little bitSebastian Berg2023-01-251-1/+8
| | | | | | | | | | | This clears the error holding only to the type. Since in the other path the errmessage seemed completely uninitialized, I opted to just ignore it entirely and keep the old error. I could fathom to use error chaining here, but overall, I am not even sure that chaining makes even sense for these errors. This fix is meant to be minimal (the second one, I just noticed randomly), it does not make this code clean.
* DOC: Add reference links and switch to PyCapsuleRohit Goswami2022-10-101-1/+1
|
* DOC: Replace CObject with Capsule consistentlyRohit Goswami2022-10-101-1/+1
|
* MAINT, Haiku defines neither __STDC_NO_THREADS__ nor __GLIBC__begasus2022-09-161-1/+1
|
* MAINT: fix an incorrect pointer type usage in f2pyRalf Gommers2022-08-311-3/+3
| | | | | | | | | | | | | | | | | | | | | This was giving many warnings like this one in the SciPy build: ``` scipy/special/_specfunmodule.c: In function 'complex_double_from_pyobj': scipy/special/_specfunmodule.c:198:47: warning: passing argument 1 of 'PyArray_DATA' from incompatible pointer type [-Wincompatible-pointer-types] 198 | (*v).r = ((npy_cdouble *)PyArray_DATA(arr))->real; | ^~~ | | | PyObject * {aka struct _object *} In file included from /home/rgommers/code/numpy/numpy/core/include/numpy/ndarrayobject.h:12, from /home/rgommers/code/numpy/numpy/core/include/numpy/arrayobject.h:5, from /home/rgommers/code/numpy/numpy/f2py/src/fortranobject.h:16, from scipy/special/_specfunmodule.c:22: /home/rgommers/code/numpy/numpy/core/include/numpy/ndarraytypes.h:1524:29: note: expected 'PyArrayObject *' {aka 'struct tagPyArrayObject *'} but argument is of type 'PyObject *' {aka 'struct _object *'} 1524 | PyArray_DATA(PyArrayObject *arr) | ~~~~~~~~~~~~~~~^~~ ``` Fixing pointer mismatches is important for Pyodide/Emscripten.
* ENH: Support character string arraysPearu Peterson2022-06-051-39/+94
| | | | | | | | | | | | | | | | TST: added test for issue #18684 ENH: f2py opens files with correct encoding, fixes #635 TST: added test for issue #6308 TST: added test for issue #4519 TST: added test for issue #3425 ENH: Implement user-defined hooks support for post-processing f2py data structure. Implement character BC hook. ENH: Add support for detecting utf-16 and utf-32 encodings.
* MAINT: Use more NPY_OSRohit Goswami2022-03-071-2/+2
|
* MAINT: Use npy_os in f2pyRohit Goswami2022-03-061-2/+2
|
* MAINT: Restructure includes slightlyRohit Goswami2022-03-061-2/+0
|
* BUG: fix f2py's define for threading when building with MingwRalf Gommers2022-01-231-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes https://github.com/rgommers/scipy/issues/125 This is a follow-up of gh-18910 (included in 1.20.3 and 1.21.0), which looks incorrect. This fixes warnings like these when building SciPy with Mingw-w64: ``` [94/1557] Compiling C object scipy/linalg/_flapack.cp39-win_amd64.pyd.p/meson-generated_..__flapackmodule.c.obj In file included from C:\hostedtoolcache\windows\Python\3.9.9\x64\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:4, from C:\hostedtoolcache\windows\Python\3.9.9\x64\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:12, from C:\hostedtoolcache\windows\Python\3.9.9\x64\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4, from C:\hostedtoolcache\windows\Python\3.9.9\x64\lib\site-packages\numpy\f2py\src/fortranobject.h:13, from scipy/linalg/_flapackmodule.c:16: scipy/linalg/_flapackmodule.c:1248:1: warning: 'thread' attribute directive ignored [-Wattributes] 1248 | static F2PY_THREAD_LOCAL_DECL cb_cselect_in_gees__user__routines_t *_active_cb_cselect_in_gees__user__routines = NULL; | ^~~~~~ scipy/linalg/_flapackmodule.c:1410:1: warning: 'thread' attribute directive ignored [-Wattributes] 1410 | static F2PY_THREAD_LOCAL_DECL cb_zselect_in_gees__user__routines_t *_active_cb_zselect_in_gees__user__routines = NULL; | ^~~~~~ scipy/linalg/_flapackmodule.c:1572:1: warning: 'thread' attribute directive ignored [-Wattributes] 1572 | static F2PY_THREAD_LOCAL_DECL cb_sselect_in_gees__user__routines_t *_active_cb_sselect_in_gees__user__routines = NULL; | ^~~~~~ scipy/linalg/_flapackmodule.c:1738:1: warning: 'thread' attribute directive ignored [-Wattributes] 1738 | static F2PY_THREAD_LOCAL_DECL cb_dselect_in_gees__user__routines_t *_active_cb_dselect_in_gees__user__routines = NULL; | ^~~~~~ ... ``` Also fixes gh-19437, where `__STDC_NO_THREADS__` should be defined but isn't (this seems to be more common, e.g. one can reports for ICC about this).
* BUG: Clear errors correctly in F2PY conversionsRohit Goswami2021-11-181-19/+40
| | | | Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* MAINT: Reduce DepreciationWarnings, use more data API types for f2py (#19978)Rohit Goswami2021-09-291-19/+25
| | | | | | | * MAINT: More data type API for f2py * MAINT: Less DeprecationWarnings for f2py * MAINT: Fix casts for complex arrays in f2py
* DOC: Typos found by codespellDimitri Papadopoulos2021-09-211-1/+1
|
* MAIN: Minor include rationalization.Charles Harris2021-09-031-1/+1
| | | | | | | - Replace "Python.h" by <Python.h> - Replace "structmember.h" by <structmember.h> - Replace <npy_config> by "npy_config" - Define PY_SSIZE_T_CLEAN before all Python.h includes in .c files.
* BUG: revise string_from_pyobj/try_pyarr_from_string with respect to malloc ↵Pearu Peterson2021-06-151-52/+128
| | | | and copy (the second round)
* Revert "BUG: revise string_from_pyobj/try_pyarr_from_string with respect to ↵Ralf Gommers2021-06-131-101/+52
| | | | malloc and copy." (#19235)
* Minor fixesPearu Peterson2021-05-261-1/+1
|
* Add internal check for array contiguity.Pearu Peterson2021-05-261-0/+1
|
* MAINT: apply sizeof(char)==1Pearu Peterson2021-05-261-2/+2
|
* Apply reviewer nitPearu Peterson2021-05-231-2/+1
|
* Fix lintPearu Peterson2021-05-231-1/+2
|
* Apply reviewers comments. Thanks to @eric-wieser!Pearu Peterson2021-05-231-31/+9
|
* BUG: revise string_from_pyobj/try_pyarr_from_string usages, fixes #18431.Pearu Peterson2021-05-101-46/+116
|
* BUG FIX for MINGW : threads.h existence test requires GLIBC > 2.12Dong Keun Oh2021-05-051-1/+3
|
* BUG: Fix refcount leak in f2py `complex_double_from_pyobj`Sebastian Berg2021-02-171-0/+1
|
* BUG: threads.h existence test requires GLIBC > 2.12. (#18180)Pearu Peterson2021-01-191-1/+6
| | | | | * defined(__STDC_NO_THREADS__) can be trusted only when using glibc > 2.12 * Add __GLIBC__ defined check.
* MAINT: Cleanup f2py/cfuncs.pyCharles Harris2020-09-211-86/+164
| | | | | | | | | | - Replace npy_3kcompat macro PyInt_AsLong by appropriate definition - Replace npy_3kcompat macro PyInt_AS_LONG by appropriate definition. - Reformat code for readability. The code in extensively reformated in this PR which may hide the most important parts of the diff, but I needed to do it to make the code readable.
* Merge pull request #17292 from charris/cleanup-remaining-pystring-macrosSebastian Berg2020-09-121-3/+3
|\ | | | | MAINT: Replace remaining PyString macros.
| * MAINT: Replace remaining PyString macros.Charles Harris2020-09-111-3/+3
| | | | | | | | | | | | | | Replace remaining npy_3kcompat PyString macros with their definition. - PyString_AS_STRING -> PyBytes_AS_STRING - PyString_GET_SIZE -> PyBytes_GET_SIZE
* | MAINT: Replace PyNumber_Int by PyNumber_LongCharles Harris2020-09-121-2/+2
| | | | | | | | Replace the npy_3kcompat macro PyNumber_Int by its definition.
* | MAINT: Replace PyInt_FromLong by PyLong_FromLong.Charles Harris2020-09-111-3/+3
|/ | | | Replace the npy_3kcompat macro PyInt_FromLong by its definition.
* MAINT: Replace PyStringObject by PyBytesObject.Charles Harris2020-09-101-1/+1
| | | | This replaces the npy_3kcompat macro PyStringObject with its definition.
* MAINT: Replace PyString_Check with PyBytes_Check.Charles Harris2020-09-101-7/+7
| | | | Replaces the npy_3kcompat PyString_Check macro with its definition.
* MAINT: Remove uses of PyString_FromString.Charles Harris2020-08-191-2/+2
| | | | | | | | We no longer need to use the compatibility function after dropping support for Python 2.7. In some cases unicode was the correct string type rather than the bytes of the compatibility version and bugs in the array `__complex__` and array `__array_interface__` methods have been fixed by changing that.
* MAINT: f2py: move thread-local declaration definition to common macroPauli Virtanen2020-06-081-0/+15
| | | | | Move compiler thread-local declaration detection to a common macro. Also support C11 thread_local declaration, if available.
* BUG, TST: fix f2py for PyPy, skip one test for PyPy (#15750)Matti Picus2020-03-181-0/+6
| | | * BUG, TST: fix f2py for PyPy, skip one test for PyPy, xfail tests for s390x
* MAINT: remove useless `global` statementsEric Wieser2020-03-181-2/+2
| | | | | | | `global` is only needed if a variable appears on the left of an assignment. These variables do not. Most suffer from the misconception that `var[x] = y` requires `var` to be global, but it does not.
* convert shebang from python to python3 (#15687)Changqing Li2020-03-041-1/+1
| | | | Signed-off-by: Changqing Li <changqing.li@windriver.com>
* Merge pull request #15232 from sethtroisi/remove_python3_part3Matti Picus2020-01-041-16/+0
|\ | | | | MAINT: Cleaning up PY_MAJOR_VERSION/PY_VERSION_HEX
| * Cleaning up PY_MAJOR_VERSION/PY_VERSION_HEXSeth Troisi2020-01-031-16/+0
| |
* | MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
|/ | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* DOC: fix outstanding typo in NumPy versionmattip2019-12-031-1/+1
|
* BUG: Further, followup f2py reference count fixesSebastian Berg2019-08-191-5/+18
| | | | | | | | Note that the extension module dict seems to be never dereferenced (there is an additional reference to it kept around somewhere). This reference seems to part of the C python module loading (possibly intentionally), and I could not find how to remove it or where it originates from.
* DOC: update or remove outdated sourceforge linksmattip2019-08-081-1/+1
|
* DOC: fix minor typosUnknown2017-12-121-1/+1
|
* MAINT: Use the PyArray_(GET|SET)_ITEM functions where possibleEric Wieser2017-09-231-4/+4
|
* MAINT: Replace tab escapes with four spacesEric Wieser2017-07-121-500/+500
| | | | | Using \t here is just cryptic. Done using a very basic find and replace.
* MAINT: remove usage of NPY_CHAR from f2pyJulian Taylor2017-05-021-1/+2
|
* STY: Make PEP8 fixes in numpy/f2pyCharles Harris2015-07-251-222/+259
| | | | | Decided to bite the bullet on this one. The code is certainly more readable, so should be easier to fix if we need to.
* DEP: Replace NPY_CONTIGUOUS with NPY_ARRAY_C_CONTIGUOUSChris Kerr2014-11-101-1/+1
|