summaryrefslogtreecommitdiff
path: root/numpy/f2py/src
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Fix typos found by codespellDimitri Papadopoulos2022-10-071-1/+1
|
* MAINT: fix up use of `NPY_NO_DEPRECATED_API` usage in f2pyRalf Gommers2022-06-171-1/+3
| | | | | | | | | | | | | | | This was giving a lot of warnings like: numpy/f2py/src/fortranobject.h:9: warning: "NPY_NO_DEPRECATED_API" redefined when building SciPy. In general, this is generated code which is included in the build of other projects which may have already set this macro - so only set it if it is not yet set. The other change is to set it to the current numpy version, like is done everywhere else in numpy, rather than to a fixed 1.7 version. This will ensure that if new deprecations happen, f2py gets updated for them.
* ENH: Support character string arraysPearu Peterson2022-06-052-118/+371
| | | | | | | | | | | | | | | | 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.
* BUG: f2py: Simplify creation of an exception message. Closes gh-19000.Warren Weckesser2021-12-201-16/+12
|
* MAINT: Reduce DepreciationWarnings, use more data API types for f2py (#19978)Rohit Goswami2021-09-291-2/+3
| | | | | | | * MAINT: More data type API for f2py * MAINT: Less DeprecationWarnings for f2py * MAINT: Fix casts for complex arrays in f2py
* MAINT: Don't allow short blocks on single line.Charles Harris2021-09-281-2/+6
|
* MAINT: Use updated clang-formatRohit Goswami2021-09-282-24/+13
|
* MAINT: clang-format for f2pyRohit Goswami2021-09-282-379/+490
|
* MAINT,DOC: f2py cleanupRohit Goswami2021-09-206-351/+0
|
* MAIN: Minor include rationalization.Charles Harris2021-09-032-2/+4
| | | | | | | - 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.
* ENH: Share memory of read-only intent(in) arrays. Closes #16347Pearu Peterson2021-02-071-2/+2
|
* Removing extra comment.MelissaWM2020-09-261-1/+1
|
* Adding PR review comment.MelissaWM2020-09-241-0/+1
|
* BUG: Fixes module data docstrings.MelissaWM2020-09-241-2/+4
| | | | Fixes gh-15325
* MAINT: Remove uses of PyString_FromString.Charles Harris2020-08-191-1/+1
| | | | | | | | 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.
* BUG: numpy/f2py: put callback globals to thread-local storagePauli Virtanen2020-06-072-0/+65
|
* MAINT: Use `.identifier = val` to fill type structsSebastian Berg2020-02-011-15/+7
| | | | | | | | | | This was not used previously due to it requiring C99. Python itself acknowledges that it can be used (they do almost not use it as of now), except inside header files due to C++ compatibility. See also (Found by Eric Wieser in PR): https://mail.python.org/pipermail/python-dev/2017-January/147154.html and PEP 7: https://www.python.org/dev/peps/pep-0007/#c-dialect
* BUG: Use PyDict_GetItemWithError() instead of PyDict_GetItem()Eric Wieser2020-01-141-2/+5
| | | | | | | | This means we no longer interpret `MemoryError` or `KeyboardInterrupt` as `keyword arg not provided`, for instance. This function is python 3 only, hence this was difficult to do in older versions of numpy. Inspired by https://bugs.python.org/issue35459
* MAINT: C code simplificationSeth Troisi2020-01-081-7/+5
|
* MAINT: Cleaning up more PY_VERSION_HEXSeth Troisi2020-01-061-25/+0
|
* MAINT: Improve const-correctness of shapes and stridesEric Wieser2020-01-061-1/+1
| | | | | | Marking these arguments as const makes it easier to reason about these functions, and prevent accidental mutation. The C99 standard (6.2.5/26 "Types") guarantees that ABI compatibility is preserved here.
* Cleaning up PY_MAJOR_VERSION/PY_VERSION_HEXSeth Troisi2020-01-032-46/+0
|
* ENH: Chain exceptions when converting python objects to fortranEric Wieser2019-12-021-24/+1
| | | | | | Note that since we now need `npy_3kcompat.h`, we can delete all duplicated lines in this file We preserve the original exception type for compatibility with old code here.
* ENH: Show the incorrect type in the fortran error messageEric Wieser2019-12-011-3/+4
| | | | | | I just got this error while hacking some scipy internals, and had nowhere near enough information to debug it. This is a little closer to useful.
* BUG: General fixes to f2py reference counts (dereferencing)Sebastian Berg2019-08-192-16/+39
|
* BUG: Fix leak in the f2py-generated module init and `PyMem_Del` usageSergei Lebedev2019-08-191-2/+5
| | | | | | Using `PyMem_Del` is incorrect, it should be `PyObject_Del` here, while this worked most of the time, it would lead to crashes at least on python 2.5 (after the reference counts were fixed)
* MAINT: f2py: Add a cast to avoid a compiler warning.Warren Weckesser2019-04-051-1/+1
| | | | | | | | | | | | | The warning [...]/fortranobject.c:138:18: warning: comparison of integers of different signs: 'Py_ssize_t' (aka 'long') and 'unsigned long' [-Wsign-compare] if (size < sizeof(notalloc)) { ~~~~ ^ ~~~~~~~~~~~~~~~~ occurs 17 times when scipy is built. The change in this pull request casts `size` to `size_t` before comparing it to `sizeof(...)`. A previous check has already eliminated the possibility that `size` is negative, so this cast is safe.
* MAINT: removed unused vars in f2py test codeTyler Reddy2018-10-291-2/+0
|
* MAINT: Misc. typos (#11005)luzpaz2018-04-301-1/+1
| | | | | | | | | User- and non-user-facing typos. Some source typos fixes as well. Found via `codespell`.
* MAINT: Fixed C++ guard in f2py test.siavashserver2018-03-091-2/+2
|
* MAINT: Hard tab and whitespace cleanup.Charles Harris2018-03-082-55/+56
|
* DOC: fix minor typosUnknown2017-12-121-3/+3
|
* f2py: rename internal functionNico Schlömer2017-08-281-3/+3
|
* f2py: allow Fortran arrays of dimension 0Nico Schlömer2017-08-281-1/+1
| | | | | | | | | | | | Up until now, f2py throw an error when arrays were declared which had dimension of length 0. This, however, is a perfectly legal case, and in fact occurs frequently in the context of linear algrebra. This bug was discovered, for example, in an interface that does matrix tridiagonalization. If the matrix is 1x1, the super- and subdiagonal are of length 0. Note that negative dimensions continue to produce errors although Fortran also allows this (it always allocates to size max(0, n)).
* BUG: f2py: Convert some error messages printed to stderr to exceptions.Warren Weckesser2017-08-261-38/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In f2py/src/fortranobject.c, the function `check_and_fix_dimensions` does pretty much what it says on the tin: /* This function fills in blanks (that are -1\'s) in dims list using the dimensions from arr. It also checks that non-blank dims will match with the corresponding values in arr dimensions. */ There are several error conditions detected by the function. In the code before this change, when the function detected such an error, it would print a message to stderr and return 1. In this change, when an error is detected in `check_and_fix_dimensions`, an exception is set. This new feature of `check_and_fix_dimensions` is used in three places in the function `array_from_pyobj()`. In each case, there was an old comment of the form: /* XXX: set exception */ In this change, the exception is now set in `check_and_fix_dimensions()`, so those comments have been removed. For some error conditions, the new code changes the exception that is raised. For example, here's a scipy test before this change: ``` In [5]: from scipy.linalg import _fblas as fblas In [6]: a = np.array([[1., 0.], [0., -2.], [2., 3.]]) In [7]: b = np.array([[0., 1.], [1., 0.], [0, 1.]]) In [8]: fblas.dsyr2k(a=a, b=b, alpha=1.0, c=np.zeros((15, 8))) 0-th dimension must be fixed to 3 but got 15 --------------------------------------------------------------------------- error Traceback (most recent call last) <ipython-input-8-bc4d51f8d016> in <module>() ----> 1 f(a=a, b=b, alpha=1.0, c=np.zeros((15, 8))) error: failed in converting 2nd keyword `c' of _fblas.dsyr2k to C/Fortran array ``` After this change, we get: ``` In [2]: from scipy.linalg import _fblas as fblas In [3]: a = np.array([[1., 0.], [0., -2.], [2., 3.]]) In [4]: b = np.array([[0., 1.], [1., 0.], [0, 1.]]) In [5]: fblas.dsyr2k(a=a, b=b, alpha=1.0, c=np.zeros((15, 8))) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-6-bc4d51f8d016> in <module>() ----> 1 f(a=a, b=b, alpha=1.0, c=np.zeros((15, 8))) ValueError: 0-th dimension must be fixed to 3 but got 15 ``` The spurious print has been changed to the exception message, but some potentially useful information in the old exception message has been lost.
* BUG: ')' is printed at the end pointer of the buffer in numpy.f2py.Bob Eldering2017-07-051-2/+1
| | | | | | | When building the __doc__ string for Fortran objects, the ')' character, closing the dimensions list, is written 1 position beyond the allowed buffer size, instead of the current pointer in the buffer.
* ENH: Spelling fixesVille Skyttä2017-05-091-1/+1
|
* MAINT: remove usage of NPY_CHAR from f2pyJulian Taylor2017-05-021-4/+24
|
* MANT: Use Py_RETURN_NONE whenever Py_None is returnedJaime Fernandez2015-04-241-2/+1
|
* Merge pull request #5309 from rgommers/remove-f2py-deprecationCharles Harris2015-01-061-3/+0
|\ | | | | MAINT: remove NPY_NO_DEPRECATED_API define from f2py.
| * MAINT: remove NPY_NO_DEPRECATED_API define from f2py.Ralf Gommers2014-11-231-3/+0
| | | | | | | | | | See gh-5281 for discussion. With the defines in, compiling scipy 0.14.0 and below isn't possible.
* | Merge pull request #5287 from chatcannon/reconcile-c-api-with-docsJulian Taylor2014-12-101-7/+10
|\ \ | |/ |/| | | Reconcile C API with docs
| * MAINT: cast PyArray_ITEMSIZE result to avoid warningsJulian Taylor2014-12-101-3/+3
| | | | | | | | return type depends on API version used
| * MAINT: Update printf statements in fortranobject.cChris Kerr2014-12-101-5/+8
| | | | | | | | Using NPY_INTP_FMT to format PyArray_ITEMSIZE
* | MAINT: change place where NPY_NO_DEPRECATED_API is defined in f2py.Ralf Gommers2014-11-162-2/+3
|/ | | | | This makes sure to undef at the end, and by putting the define in the C code it ensures that the error message is understandable.
* DEP: #declaring NPY_NO_DEPRECATED_API in fortranobject.hChris Kerr2014-11-101-0/+2
|
* DEP: Replace NPY_CONTIGUOUS with NPY_ARRAY_C_CONTIGUOUSChris Kerr2014-11-101-1/+1
|
* DEP: Corrected some type errors that appear when enabling NPY_NO_DEPRECATED_APIChris Kerr2014-11-101-7/+7
|
* DEP: Replaced NPY_[F,C]ARRAY with NPY_ARRAY_[F,C]ARRAYChris Kerr2014-11-101-4/+4
|
* DEP: Using the internal PyArrayObject_fields API for the swap_arrays and ↵Chris Kerr2014-11-101-2/+5
| | | | dump_attrs functions