summaryrefslogtreecommitdiff
path: root/numpy/f2py/crackfortran.py
Commit message (Collapse)AuthorAgeFilesLines
...
| * MAINT: Update END statement parsing for recent Fortran standards. Closes #2763Pearu Peterson2021-02-151-2/+1
| |
* | BUG: Fix parsing continued lines that follow comment lines. Closes #2848Pearu Peterson2021-02-151-3/+17
|/
* Apply reviewers comments.Pearu Peterson2021-01-191-5/+5
|
* Add test for gh17797.Pearu Peterson2021-01-181-3/+8
|
* ENH: [f2py] Add external attribute support. Closes #17859Pearu Peterson2021-01-171-0/+4
|
* MAINT: multiline regex class simplifyTyler Reddy2020-12-291-6/+6
| | | | | | * follow up to gh-18083 covering multi-line uses of `re.compile(..` and some cases for `re.match(..` with single (meta)character classes
* MAINT: regex char class improveTyler Reddy2020-12-281-5/+5
| | | | | | | | | | | | | * replace superfluous single-character regex character classes with their literal string equivalents; this avoids the overhead associated with a character class when there's only a single character enclosed (so there's no benefit to the class overhead) * for more information see: Chapter 6 of: Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O’Reilly Media, 2009.
* Merge pull request #18074 from tylerjereddy/treddy_exprtype_regex_simplifyCharles Harris2020-12-261-3/+3
|\ | | | | MAINT: exprtype regex simplify
| * MAINT: exprtype regex simplifyTyler Reddy2020-12-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | * `determineexprtype_re_1` was modified to remove extraneous character class markers around a single `,` * a similar change was applied for the word metacharacter in `determineexprtype_re_2` and `determineexprtype_re_3` * the third character class in `determineexprtype_re_3` was simplified to remove an escape sequence--by placing the `-` at the start of the character class its metacharacter status can be avoided
* | MAINT: PR 18072 revisionsTyler Reddy2020-12-261-1/+1
| | | | | | | | | | | | * `name_match` regular expression now starts by matching a letter only, based on reviewer feedback
* | MAINT: crackfortran regex simplifyTyler Reddy2020-12-251-2/+2
|/ | | | | | | | | | | * remove extraneous character class markers used in `crackline_re_1`: `\w` and `=` on their own have no benefit to character class `[]` inclusion * `name_match` has a character class that can be simplified because `\w` metacharacter already encompasses the digit metacharacter and the underscore
* Revert PR gh-17654 which failed to fix issue gh-8062.Ian Thomas2020-11-051-9/+0
| | | | See also PR gh-17687.
* Merge pull request #17670 from eric-wieser/test-getarrlenRalf Gommers2020-11-011-0/+31
|\ | | | | DOC: f2py: Add a docstring for getarrlen
| * DOC: f2py: Add a docstring for getarrlenEric Wieser2020-10-291-0/+31
| | | | | | | | | | The API of this function is awful, and I still have no idea what it does. Maybe someone reading the docstring will be able to work it out.
* | Merge pull request #17662 from eric-wieser/test-getlincoefMatti Picus2020-10-291-1/+22
|\ \ | |/ | | TST: f2py: Add a doctest for `getlincoef`
| * TST: f2py: Add a doctest for `getlincoef`Eric Wieser2020-10-281-1/+22
| |
* | BUG: f2py incorrectly translates dimension declarations.Ian Thomas2020-10-271-0/+9
|/ | | | | | | | | | | | | | In fortran functions passed to f2py, calculations that occur in the dimensions of array declarations are interpreted as floats. Valid fortran requires integers. Problem only occurs with fortran functions not subroutines as only for the former does f2py generate fortran wrapper code that fails to compile. Relevant code is in numpy.f2py.crackfortran.getlincoef(), which calculates and returns the coefficients to getarrlen() for writing to the fortran wrapper code. Fixes gh-8062.
* BUG: don't add 'public' or 'private' if the other one existsDamien Caliste2020-03-261-4/+6
| | | | | | Currently, setting 'public' or 'private' attribute is adding one even if the other one already exists because of the else: part that is always appending.
* Merge pull request #15706 from melissawm/f2py-typos-fixCharles Harris2020-03-081-6/+6
|\ | | | | MAINT: Fixing typos in f2py comments and code.
| * Fixing typos in f2py comments and code.Melissa Weber Mendonca2020-03-041-6/+6
| |
* | convert shebang from python to python3 (#15687)Changqing Li2020-03-041-1/+1
|/ | | | Signed-off-by: Changqing Li <changqing.li@windriver.com>
* Update numpy/f2py/crackfortran.pyEric Wieser2020-01-121-1/+1
|
* MAINT: Eliminate some calls to `eval`Eric Wieser2020-01-111-5/+6
| | | | | | | | * The instance in `_internal` is parsing tuples and integers, so `ast.literal_eval` is just fine * The instance in `crack_fortran` is just trying to lookup a function name dynamically * The instance in `f90mod_rules` is looking at the result of `capi_maps.getarrdims(...)['rank']`, which is always a string representation of an integer The f2py code is still littered with `eval`, but the remaining cases were harder to reason about.
* 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: add endfunction, endsubroutine to valid fortran end wordsmattip2019-12-031-1/+2
|
* BUG: blindly add TypeError to accepted exceptionsmattip2019-04-301-1/+1
|
* BUG: ppc and riscv don't use REAL(10)Andreas Schwab2019-03-051-1/+1
| | | | This fixes numpy.f2py.tests.test_kind.TestKind
* BUG: Add 'sparc' to platforms implementing 16 byte reals.Charles Harris2019-01-051-1/+1
| | | | | This is for the _selected_real_kind_func function in f2py/crackfortran.py
* MAINT: Use list and dict comprehension when possible (#12445)Roman Yurchak2018-12-011-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use list comprehension * More list comprehension migration * Revert key copying in dict * A few more fixes * More reverts * Use dict comprehension * Fix dict comprehension * Address review comments * More review comments * Fix for empty unpacking of zip(* * Revert zip(* unpacking altogether * Fix dict copying * More simplifications
* MAINT: don't call function with too many argumentsEmil Hessman2018-09-301-2/+2
|
* Fix Fortran kind detection for aarch64 & s390x.Elliott Sales de Andrade2018-08-121-1/+1
|
* DOC: Fix minor typosluz.paz2018-03-301-1/+1
| | | Found via `codespell -q 3 -I ../numpy-whitelist.txt`
* BUG: fix for splitting a multiline or enhancement by ';' in numpy.f2py.Bob Eldering2018-03-081-2/+3
| | | | | | The variable line was assigned to before checking whether it contains a multiline or f2py enhancement pattern. In these cases the line should not be split by ';'. See pull request #10676.
* BUG: F2py mishandles quoted control characters (#10676)bobeldering2018-03-041-37/+47
| | | | | | | | | | | | | | | | | * BUG: improve parsing of quoted control characters in numpy.f2py. See #10634. Fixes a couple of cases where quoted control characters are parsed as if they are unquoted. The control characters considered are "()!;". * TST: quoted characters parsing by numpy.f2py. Basic test of parsing quoted Fortran control characters. See #10634. * BUG: add missing space character when reconstructing fortran line. The missing space caused a line starting with "!f2py" to be considered a continuation line.
* DOC: fix minor typosUnknown2017-12-121-2/+2
|
* MAINT: Fix alerts from http://lgtm.com (#9292)Jean Helie2017-06-261-18/+16
| | | | | | | * make exception raising 2/3 compatible * remove unnecesary else statement after while loop without break clause * ensure file is always enclosed even in the event of an exception * ensure list comprehension variable does not override enclosing loop variable
* BUG: fix missing keyword rename for common block to numpy.f2pyBob Eldering2017-06-121-1/+1
| | | | | | | A missing call to rmbadname1 in analyzecommon caused a look up of common block variables with a name in the badnames list to fail and the fall back of defaultimplicitrules to be used. See ticket 9228.
* BUG: KeyboardInterrupt is swallowed all over the placeEric Wieser2017-06-031-15/+15
| | | | Bare except is very rarely the right thing
* BUG: fix regex of determineexprtype_re_3 in numpy/f2py/crackfortran.pyZZhaoTireless2017-03-191-2/+2
|
* BUG: PPC64el machines are POWER for FortranMatthew Brett2017-02-211-1/+2
| | | | | | Fix Fortran kind detection for PPC64el. See: gh-3424.
* STY: space around operatorjutke2017-01-231-1/+1
| | | | per request from @charris
* BUG: guard against replacing constants without '_' specjutke2017-01-201-1/+2
| | | | | | | | | | | | | | | | | | fixes #8493 In the reported problem snippet the attempt to infer the type of parameter (wasize=maxiterates*2) leads to a lookup of maxiterates in the logic of get_parameters which finds and correctly assigns to 'v' the value string '50000' However, then in the logic proceds to attempt to split off any underscore-appended precision spec from v_ which yields ['50000'] because there is no underscore. Finally line v = ''.join(v_[:-1]).lower().replace(v_[-1].lower(), '') if not quarded by the newly introduced lengthtest sets v to empty because [:-1] of a list with one element yields an empty list. Subsequently the type inference by running eval on an empty string fails with the error message quoted. The introduced length check appears to correct this problem.
* DEP: Fix escaped string characters deprecated in Python 3.6.Charles Harris2016-12-141-8/+8
| | | | | | | In Python 3.6 a number of escape sequences that were previously accepted -- for instance "\(" that was translated to "\\(" -- are deprecated. To retain the previous behavior either raw strings must be used or the backslash must be properly escaped itself.
* BUG: fixed kind specifications for parametersNick Papior2016-11-271-3/+32
| | | | | | | | | | | | | Fortran sources with parameters having kind-specifiers where not correctly intercepted in the crackfortran.py source. The reason was a restrictive check for only integer specifiers which did not split real's into the correct number. Furthermore, several tests has been added which tests the different kind specifiers and their use in codes, also all of them together. Signed-off-by: Nick Papior <nickpapior@gmail.com>
* MAINT: Fix some typos in a code string and commentsDongjoon Hyun2016-01-271-1/+1
|
* BUG: Revert some import * fixes in f2py.Charles Harris2015-10-261-6/+5
| | | | | | | | | | | | | | | | The files * capi_maps.py * crackfortran.py * f90mod_rules.py previously used `from .auxfuncs import *` and also called `eval` without an explicit enviroment. An attempt to use explicit imports led to errors, and because static code analysis in not sufficient to determine what functions need to be imported, it is safest to continue using `import *` pending a major refactoring of f2py. Closes #6563.
* Merge pull request #6488 from charris/cleanup-6306Charles Harris2015-10-161-5/+2
|\ | | | | Cleanup 6306: BUG: allow extension of common blocks in numpy.f2py
| * BUG: allow extension of common blocks in numpy.f2pyAlexander Heger2015-10-161-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lack of this feature resulted in the generation of incorrect *.pyf files. For example, the pyf file created by: subroutine sub3 (some arguments) real a, b, c, d common /coeff/ a, b common /coeff/ c, d <do stuff> return end Should contain both common statements the declaration of all four variables a, b, c, and d. Closes #5876.
* | BUG: Allow nested use of parameters for array dimensions in f2py.Alexander Heger2015-10-161-3/+4
|/ | | | | | | | | | | | | Nested use of parameters in specifying dimensions caused problems. For example parameter (i=7) common buf(nvar*(nvar+1) * (n + 1)) This fix was suggested by Pearu on github. Closes #5877.
* STY: Break some long lines in numpy/f2py/*.py.Charles Harris2015-07-291-27/+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.