summaryrefslogtreecommitdiff
path: root/numpy/f2py/cb_rules.py
Commit message (Collapse)AuthorAgeFilesLines
* ENH: Support character string arraysPearu Peterson2022-06-051-8/+17
| | | | | | | | | | | | | | | | 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: f2py: don't generate code that triggers `-Wsometimes-uninitialized` ↵Ralf Gommers2022-02-011-22/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#20940) * MAINT: f2py: don't generate code that triggers `-Wsometimes-uninitialized` Warnings look like: ``` scipy/linalg/_flapackmodule.c:2200:9: warning: variable 'return_value' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (capi_j>capi_i) ^~~~~~~~~~~~~ scipy/linalg/_flapackmodule.c:2217:12: note: uninitialized use occurs here return return_value; ^~~~~~~~~~~~ scipy/linalg/_flapackmodule.c:2200:5: note: remove the 'if' if its condition is always true if (capi_j>capi_i) ^~~~~~~~~~~~~~~~~~ scipy/linalg/_flapackmodule.c:2099:21: note: initialize the variable 'return_value' to silence this warning int return_value; ^ = 0 ``` Also: - Initialize complex return value. - Warn on non-void callback returning None. - Use brackets in if-else block. This makes the code more readable. Co-authored-by: Pearu Peterson <pearu.peterson@gmail.com>
* STY: Kill all \t with fire in f2pyRohit Goswami2021-09-291-11/+11
|
* BUG: address 19575 ref leak of capi_tmp in f2py/cb_rules.pyDerek Huang2021-08-221-0/+1
|
* BUG: fix regression in a hidden callback use casePearu Peterson2021-02-091-14/+4
|
* MAINT: Debug issue (2)Pearu Peterson2021-02-091-2/+4
|
* MAINT: Debug issue #18341Pearu Peterson2021-02-091-1/+15
|
* BUG: Fix missing signed_char dependency. Closes #18335.Pearu Peterson2021-02-071-0/+1
|
* MAINT: f2py: move thread-local declaration definition to common macroPauli Virtanen2020-06-081-19/+3
| | | | | Move compiler thread-local declaration detection to a common macro. Also support C11 thread_local declaration, if available.
* BUG: numpy/f2py: put callback globals to thread-local storagePauli Virtanen2020-06-071-21/+72
|
* STY: f2py/cb_rules: replace \t by whitespace for readabilityPauli Virtanen2020-06-071-147/+147
|
* MAINT: remove useless `global` statementsEric Wieser2020-03-181-2/+0
| | | | | | | `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>
* 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.
* BUG: f2py: fix f2py generated code to work on PypyPauli Virtanen2018-02-241-5/+25
| | | | | | | | F2py generates code that uses PyTuple_SetItem on a tuple that has been "used", which is invalid on Pypy. Add #ifdefs that make the generated code convert the object to a list, use PyList_SetItem, and then convert it back to a tuple.
* BUG: Fix f2py string variables in callbacks.Charles Harris2017-11-151-2/+6
| | | | | | | | | | | When NPY_CHAR was deprecated and replaced by NPY_STRING in f2py, calls to PyArray_New that previously relied on the type to get the itemsize needed the size explicitly specified, but that modification was missed in some of the code. Because the strings that replacee the 'c' type are always 'S1', we use an itemsize of 1 for the string types and pass it explicitly. Closes #10027.
* STY: Break some long lines in numpy/f2py/*.py.Charles Harris2015-07-291-1/+0
| | | | | | | The fixes are generated by autopep8, which uses line continuation. There are 441 cases that it is unable to handle, involving strings, and that is more, and more delicate, work than I want to do at this time. The line continuation characters at least mark some of the long lines.
* STY: Make PEP8 fixes in numpy/f2pyCharles Harris2015-07-251-240/+255
| | | | | Decided to bite the bullet on this one. The code is certainly more readable, so should be easier to fix if we need to.
* STY: Make pyflakes fixes in numpy/f2pyCharles Harris2015-07-251-7/+8
|
* DEP: Replaced NPY_[F,C]ARRAY with NPY_ARRAY_[F,C]ARRAYChris Kerr2014-11-101-2/+2
|
* DEP: replaced arr->data with PyArray_DATAChris Kerr2014-11-101-1/+1
|
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-102/+102
| | | | | | | Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long and will need to be broken at some point. OTOH, some lines were already too long and need to be broken at some point. Now seems as good a time as any to do this with open PRs at a minimum.
* MAINT: Apply 2to3 idioms fixer.Charles Harris2013-05-021-5/+5
| | | | | | | | | | | | | | | | | | | The idioms fixer makes the following replacements. 1) int <- bool 2) comparison or identity of types <- isinstance 3) a.sort() <- sorted(a) There were two problems that needed to be dealt with after the application of the fixer. First, the replacement of comparison or identity of types by isinstance was not always correct. The isinstance function returns true for subtypes whereas many of the places where the fixer made a substitution needed to check for exact type equality. Second, the sorted function was applied to arrays, but because it treats them as iterators and constructs a sorted list from the result, that is the wrong thing to do. Closes #3062.
* 2to3: Apply types fixer.Charles Harris2013-04-141-10/+8
| | | | | | | | | | | | | | | | | | | | Python 3 removes the builtin types from the types module. The types fixer replaces such references with the builtin types where possible and also takes care of some special cases: types.TypeNone <- type(None) types.NotImplementedType <- type(NotImplemented) types.EllipsisType <- type(Ellipsis) The only two tricky substitutions are types.StringType <- bytes types.LongType <- int These are fixed up to support both Python 3 and Python 2 code by importing the long and bytes types from numpy.compat. Closes #3240.
* 2to3: Apply `print` fixer.Charles Harris2013-04-061-1/+1
| | | | | | | Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
* 2to3: Use absolute imports.Charles Harris2013-03-281-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new import `absolute_import` is added the `from __future__ import` statement and The 2to3 `import` fixer is run to make the imports compatible. There are several things that need to be dealt with to make this work. 1) Files meant to be run as scripts run in a different environment than files imported as part of a package, and so changes to those files need to be skipped. The affected script files are: * all setup.py files * numpy/core/code_generators/generate_umath.py * numpy/core/code_generators/generate_numpy_api.py * numpy/core/code_generators/generate_ufunc_api.py 2) Some imported modules are not available as they are created during the build process and consequently 2to3 is unable to handle them correctly. Files that import those modules need a bit of extra work. The affected files are: * core/__init__.py, * core/numeric.py, * core/_internal.py, * core/arrayprint.py, * core/fromnumeric.py, * numpy/__init__.py, * lib/npyio.py, * lib/function_base.py, * fft/fftpack.py, * random/__init__.py Closes #3172
* 2to3: Put `from __future__ import division in every python file.Charles Harris2013-03-011-0/+2
| | | | | | | | This should be harmless, as we already are division clean. However, placement of this import takes some care. In the future a script can be used to append new features without worry, at least until such time as it exceeds a single line. Having that ability will make it easier to deal with absolute imports and printing updates.
* BUG: f2py: fix creating string object from callback function using string size.Pearu Peterson2010-10-161-2/+2
|
* 3K: f2py: make f2py run far enough to produce output files (they don't ↵Pauli Virtanen2010-03-061-1/+1
| | | | compile yet, though, as the C code is not Py3 compatible)
* ENH: Add support for PyCapsule.Charles Harris2010-02-251-2/+2
|
* 3K: f2py: break cyclic imports (which are not allowed on Py3) by moving them ↵Pauli Virtanen2010-02-201-1/+2
| | | | to functions
* f2py: fix a code generation bug when callback function is taking arguments ↵Pearu Peterson2009-11-091-31/+31
| | | | with the same symbol name.
* Removed unused/redundant imports.Alan McIntyre2008-09-181-3/+0
| | | | PEP8 conformance (only one import per line).
* use 'in' keyword to test dictionary membershipJarrod Millman2007-11-281-18/+27
|
* ran reindent.py to clean up whitespaceJarrod Millman2007-10-291-1/+1
|
* using faster string methods rather than deprecated string moduleJarrod Millman2007-10-291-3/+6
|
* Applying patch from ticket 437.Pearu Peterson2007-04-021-4/+4
|
* More f2py changesTravis Oliphant2006-07-081-2/+2
|
* Fix f2py to use new namesTravis Oliphant2006-07-081-1/+1
|
* Run reindent.py (script distributed with Python) over the source to remove ↵cookedm2006-03-101-7/+2
| | | | extraneous whitespace
* Change License text to NumPy License (permission granted by Pearu)Travis Oliphant2006-01-201-1/+1
|
* Moved scipy directory to numpyTravis Oliphant2006-01-041-0/+534