summaryrefslogtreecommitdiff
path: root/numpy/f2py
Commit message (Collapse)AuthorAgeFilesLines
* BUG: f2py script shebang may refer to wrong pythonCarwyn Pelley2013-05-231-2/+2
| | | | | | | | | The f2py executable has a shebang which uses the default python, rather than the python it was compiled for. This causes issues for deployment of numpy (+f2py) across systems which have different environments. This fix uses sys.executable to determine the resulting hardcoded python to use.
* MAINT: Apply 2to3 idioms fixer.Charles Harris2013-05-028-53/+54
| | | | | | | | | | | | | | | | | | | 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-146-67/+59
| | | | | | | | | | | | | | | | | | | | 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 the `numliterals` fixer and skip the `long` fixer.Charles Harris2013-04-134-8/+12
| | | | | | | | | | | | | | | | | | | The numliterals fixer replaces the old style octal number like '01' by '0o1' removes the 'L' suffix. Octal values were previously mistakenly specified in some dates, those uses have been corrected by removing the leading zeros. Simply Removing the 'L' suffix should not be a problem, but in some testing code it looks neccesary, so in those places the Python long constructor is used instead. The 'long' type is no longer defined in Python 3. Because we need to have it defined for Python 2 it is added to numpy/compat/np3k.py where it is defined as 'int' for Python 3 and 'long' for Python 2. The `long` fixer then needs to be skipped so that it doesn't undo the good work. Closes #3074, #3067.
* replace exec by eval to ensure the c variable is defined for all relevant ↵Jos de Kloe2013-04-121-1/+1
| | | | python versions
* 2to3: Apply `map` fixer.Charles Harris2013-04-107-12/+15
| | | | | | | | | | | | | | | | | | | 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-0816-122/+122
| | | | | | | | | | | | 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.
* Merge pull request #3205 from charris/2to3-apply-dict-fixerCharles Harris2013-04-074-52/+52
|\ | | | | 2to3: apply `dict` fixer.
| * 2to3: apply `dict` fixer.Charles Harris2013-04-064-52/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Python3 `dict.items()`, `dict.keys()`, and `dict.values()` are iterators. This causes problems when a list is needed so the 2to3 fixer explicitly constructs a list when is finds on of those functions. However, that is usually not necessary, so a lot of the work here has been cleaning up those places where the fix is not needed. The big exception to that is the `numpy/f2py/crackfortran.py` file. The code there makes extensive use of loops that modify the contents of the dictionary being looped through, which raises an error. That together with the obscurity of the code in that file made it safest to let the `dict` fixer do its worst. Closes #3050.
* | Merge pull request #3202 from charris/2to3-reduce-fixupsnjsmith2013-04-071-2/+1
|\ \ | |/ |/| MAINT: Cleanup some imports involving reduce.
| * MAINT: Cleanup some imports involving reduce.Charles Harris2013-04-061-2/+1
| | | | | | | | | | | | | | | | | | | | Because reduce has been available in functools since Python 2.6 we can get rid of the version checks we currently have before we import it. Also removes some reduce related skips in tools/py3tool.py. We were already skipping the reduce fixer so this has no effect other than cleaning up the code.
* | 2to3: Apply `print` fixer.Charles Harris2013-04-0632-122/+122
|/ | | | | | | Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
* 2to3: Apply `imports` fixer.Charles Harris2013-04-022-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The `imports` fixer deals with the standard packages that have been renamed, removed, or methods that have moved. cPickle -- removed, use pickle commands -- removed, getoutput, getstatusoutput moved to subprocess urlparse -- removed, urlparse moved to urllib.parse cStringIO -- removed, use StringIO or io.StringIO copy_reg -- renamed copyreg _winreg -- renamed winreg ConfigParser -- renamed configparser __builtin__ -- renamed builtins In the case of `cPickle`, it is imported as `pickle` when python < 3 and performance may be a consideration, but otherwise plain old `pickle` is used. Dealing with `StringIO` is a bit tricky. There is an `io.StringIO` function in the `io` module, available since Python 2.6, but it expects unicode whereas `StringIO.StringIO` expects ascii. The Python 3 equivalent is then `io.BytesIO`. What I have done here is used BytesIO for anything that is emulating a file for testing purposes. That is more explicit than using a redefined StringIO as was done before we dropped support for Python 2.4 and 2.5. Closes #3180.
* 2to3: Use absolute imports.Charles Harris2013-03-2831-78/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Replace xrange by range and use list(range(...)) where neededCharles Harris2013-03-272-2/+2
| | | | | | | | | | | | | | | In python3 range is an iterator and `xrange` has been removed. This has two consequence for code: 1) Where a list is needed `list(range(...))` must be used. 2) `xrange` must be replaced by `range` Both of these changes also work in python2 and this patch makes both. There are three places fixed that do not need it, but I left them in so that the result would be `xrange` clean. Closes #3092
* Merge pull request #3014 from bfroehle/f2py_unque_symbolCharles Harris2013-03-011-1/+1
|\ | | | | BUG: Choose a more unique PY_ARRAY_UNIQUE_SYMBOL in f2py.
| * BUG: Choose a more unique PY_ARRAY_UNIQUE_SYMBOL in f2py.Bradley M. Froehle2013-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | In a few exceptional cases where symbols are shared between different Python modules the use of `PyArray_API` in f2py (fortranobject.h) conflicts with the regular use of the same symbol in the multiarray module. Generally the symptom of this conflicting use is a segfault when importing a f2py'ed module. This occurs because the module init code somehow overwrites the first element of `PyArray_API` with the location of `PyArray_API`, causing a crash when `PyArray_GetNDArrayCVersion` is called. Closes gh-2521.
* | MAINT: Make numpy/f2py/crackfortran docstring read better.Charles Harris2013-03-011-13/+12
| | | | | | | | | | The copyright and short summary were moved to the top of the docstring with the usage description below.
* | 2to3: Put `from __future__ import division in every python file.Charles Harris2013-03-0132-128/+189
| | | | | | | | | | | | | | | | 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.
* | Merge pull request #3056 from charris/2to3-filterCharles Harris2013-03-011-12/+18
|\ \ | | | | | | 2to3: Apply `filter` fixes. Closes #3053.
| * | BUG: Fix `not a in ...` to `a not in ...`.Charles Harris2013-02-281-14/+15
| | | | | | | | | | | | Also break regular expression compiles out of the loop.
| * | REF: Replace filters with list comprehensions.Charles Harris2013-02-281-12/+17
| | | | | | | | | | | | | | | | | | 2to3 does a lot of list(filter(...)) sort of thing which can be avoided by using list comprehensions instead of filters. This also seems to clarify the code to a considerable degree.
| * | 2to3: Apply `filter` fixes. Closes #3053.Charles Harris2013-02-281-11/+11
| | | | | | | | | | | | | | | Generally, this involves using list comprehension, or explicit list construction as `filter` is an iterator in Python 3.
* | | 2to3: Apply `raise` fixes. Closes #3077.Charles Harris2013-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces the raise Exception, msg: form with raise Exception(msg):
* | | Merge pull request #3097 from charris/2to3-sys_excnjsmith2013-03-011-3/+3
|\ \ \ | | | | | | | | 2to3: Apply `sys_exc` fixes. Closes #3086.
| * | | 2to3: Apply `sys_exc` fixes. Closes #3086.Charles Harris2013-02-281-3/+3
| |/ / | | | | | | | | | | | | This uses sys.exc_info in place of sys.exc_value. The new function goes back to at least 2002, so should be safe.
* | | 2to3: apply exec fixer results.Charles Harris2013-02-281-2/+2
|/ / | | | | | | This changes the `exec` command to the `exec` function.
* | 2to3: Use modern exception syntax.Charles Harris2013-02-266-22/+22
|/ | | | Example: except ValueError,msg: -> except ValueError as msg:
* DEP: Remove scons related files and code.Charles Harris2013-01-131-124/+0
| | | | | | | | | This removes files and code supporting scons builds. After this change numpy will only support builds using distutils or bento. The removal of scons has been discussed on the list several times and a decision has been made that scons support is no longer needed. This was originally discussed for numpy 1.7 and because the distutils and bento methods are still available we are skipping the usual deprecation period.
* TST: f2py: rewrite strings to be easier to readPauli Virtanen2012-11-172-26/+39
|
* ENH: f2py: add 'Wrapper for ...' text to the docstringPauli Virtanen2012-11-173-2/+4
|
* ENH: f2py: generate docstrings in Numpy docstring formatPauli Virtanen2012-11-175-22/+53
|
* Merge pull request #365 from bfroehle/static_f2py_sizenjsmith2012-09-211-1/+1
|\ | | | | BUG: Exported f2py_size symbol prevents linking multiple f2py modules.
| * BUG: Exported f2py_size symbol prevents linking multiple f2py modules.Bradley M. Froehle2012-07-301-1/+1
| |
* | Use PyMODINIT_FUNC and update docs accordingly.cgohlke2012-09-022-2/+2
|/ | | | See https://github.com/scipy/scipy/pull/279
* BUG: Fix f2py test_kind.py test.Charles Harris2012-03-171-5/+8
| | | | | Newer Fortran compilers for Intel may support quad precision, so _selected_real_kind_func needs to report that for precisions >= 19.
* UPD: Use prefixed macros in *.c files except numarray and linalg.Charles Harris2012-02-041-6/+6
|
* STY: f2py - replace macros in old_defines.h with new.Charles Harris2012-02-048-123/+123
|
* STY: Remove trailing whitespaceMark Wiebe2011-07-261-13/+13
|
* BUG[f2py]: fix --include_paths bug. Deprecated --include_paths in favor of ↵Pearu Peterson2011-06-212-10/+26
| | | | --include-paths. Updated docs.
* BUG: fix f2py size variadic macro for Visual C++ 2008 compiler. Also be ↵Pearu Peterson2011-05-182-2/+3
| | | | verbose on unspecified use modules.
* BUG: Fix the order of declaring variables in f2py generated code. The bug ↵Pearu Peterson2011-05-071-2/+6
| | | | was noticable with ifort but not with gfortran.
* BUG: Fix two argument size support for Fortran module routines. Reverted ↵Pearu Peterson2011-05-064-10/+76
| | | | size-to-shape mapping patch and implemented two argument size function in C.
* BUG: Fix assumed shape support for module routines.Pearu Peterson2011-05-064-12/+70
|
* BUG: Fix memory leak in f2py_rout_wrap_call test.Michael Droettboom2011-05-021-1/+3
|
* STY: Update exception styles, trickier ones.Charles Harris2011-04-052-2/+2
|
* STY: Update exception style, easy ones.Charles Harris2011-04-051-6/+6
|
* STY: Replace old style classes in tests with classes subclassing object.Charles Harris2011-04-052-3/+3
|
* BUG: fix f2py bug in generating interfaces for assumed shape support as an ↵Pearu Peterson2011-03-311-1/+2
| | | | addition to 4d43ec5.
* BUG: fix f2py bug in generating interfaces for assumed shape support.Pearu Peterson2011-03-291-1/+1
|