summaryrefslogtreecommitdiff
path: root/numpy/f2py/cfuncs.py
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* DEP: Using PyArray_SIZE and PyArray_TYPE instead of PyArray_DESCR()->elsize etcChris Kerr2014-11-101-5/+5
|
* DEP: Replaced arr->descr, arr->flags and arr->base with the PyArray_* functionsChris Kerr2014-11-101-16/+16
|
* DEP: replaced arr->dimensions with PyArray_DIMS(arr) or PyArray_DIM(arr,i)Chris Kerr2014-11-101-3/+3
|
* DEP: replaced arr->data with PyArray_DATAChris Kerr2014-11-101-49/+49
|
* DEP: replaced arr->nd with PyArray_NDIM in C code generation scriptsChris Kerr2014-11-101-5/+5
|
* Merge pull request #4305 from charris/fix-gh-4256Charles Harris2014-02-201-1/+1
|\ | | | | BUG: #4256: f2py, PyString_FromStringAndSize is undefined in Python3.
| * BUG: #4256: f2py, PyString_FromStringAndSize is undefined in Python3.Charles Harris2014-02-161-1/+1
| | | | | | | | | | | | | | | | | | Use PyUString_FromStringAndSize defined in npy_3kcompat instead. Not using bytes may cause some problems, but strings seem like a better choice. As modules generated with current f2py error out, this particular use is not common and we are free to choose. Closes #4256.
* | BUG: Fix typo in f2py/cfuncs.py.Charles Harris2014-02-161-1/+1
|/ | | | | | | Replace "insinged_long_long" by "unsigned_long_long". Patch due to trac user pepijndevos. Closes #636.
* BUG: f2py, fix decref on wrong objectJulian Taylor2013-09-121-2/+3
| | | | | | missing brackets causes decref on an wrong object. shows itself as abort with negative refcount in test_callback using python-dbg.
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-32/+32
| | | | | | | 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-4/+4
| | | | | | | | | | | | | | | | | | | 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-9/+7
| | | | | | | | | | | | | | | | | | | | 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 `map` fixer.Charles Harris2013-04-101-1/+1
| | | | | | | | | | | | | | | | | | | In Python 3 `map` is an iterator while in Python 2 it returns a list. The simple fix applied by the fixer is to inclose all instances of map with `list(...)`. This is not needed in all cases, and even where appropriate list comprehensions may be preferred for their clarity. Consequently, this patch attempts to use list comprehensions where it makes sense. When the mapped function has two arguments there is another problem that can arise. In Python 3 map stops execution when the shortest argument list is exhausted, while in Python 2 it stops when the longest argument list is exhausted. Consequently the two argument case might need special care. However, we have been running Python3 converted versions of numpy since 1.5 without problems, so it is probably not something that affects us. Closes #3068
* 2to3: Apply `repr` fixer.Charles Harris2013-04-081-2/+2
| | | | | | | | | | | | This replaces python backtics with repr(...). The backtics were mostly used to generate strings for printing with a string format and it is tempting to replace `'%s' % repr(x)` with `'%r' % x`. That would work except where `x` happened to be a tuple or a dictionary but, because it would be significant work to guarantee that and because there are not many places where backtics are used, the safe path is to let the repr replacements stand. Closes #3083.
* 2to3: Apply `print` fixer.Charles Harris2013-04-061-2/+2
| | | | | | | 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-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Exported f2py_size symbol prevents linking multiple f2py modules.Bradley M. Froehle2012-07-301-1/+1
|
* STY: f2py - replace macros in old_defines.h with new.Charles Harris2012-02-041-47/+47
|
* BUG: fix f2py size variadic macro for Visual C++ 2008 compiler. Also be ↵Pearu Peterson2011-05-181-1/+1
| | | | verbose on unspecified use modules.
* BUG: Fix two argument size support for Fortran module routines. Reverted ↵Pearu Peterson2011-05-061-1/+30
| | | | size-to-shape mapping patch and implemented two argument size function in C.
* BUG: f2py: fix creating string object from callback function using string size.Pearu Peterson2010-10-161-0/+2
|
* f2py: fixed typos in TRYCOMPLEXPYARRAYTEMPLATE.Pearu Peterson2010-07-111-4/+1
|
* 3K: f2py: make create_cb_arglist work with Py3 functionsPauli Virtanen2010-03-061-0/+10
|
* BUG: f2py: fix infinite loops in *_from_pyobj with unicode inputPauli Virtanen2010-03-061-5/+5
|
* 3K: f2py: port much of f2py C code to Py3Pauli Virtanen2010-03-061-11/+20
|