summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ParseTreeTransforms.py
Commit message (Collapse)AuthorAgeFilesLines
...
* | Changed warning to errorda-woods2021-01-121-1/+1
| | | | | | | | | | | | In 0.11.1 is was marked as an warning that would become an error. 3.0 is probably either the time to make it an error (or to remove the note that it'll be an error in future)
* | Fix cygdb (GH-3542)Volker-Weissmann2020-08-241-15/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Cython debugger documentation: Added link to an installation script. * Got a new libpython.py from the cpython source distribution. * Default language level in tests is now 3 instead of 2 * Migrated codefile from python 2 to python 3. * Added testcase for the cy list command in cygdb. * Temporarily removing test case that freezes gdb. * Fixed a bug that broke several Cygdb tests. The cython_debug/cython_debug_info_* files map the names of the C-functions generated by the Cython compiler to the names of the functions in the *.pyx source. If the function was defined using "def" (and not "cpdef" or "cdef") in the *.pyx source file, the C-function named in cython_debug/cython_debug_info_* used to be __pyx_pw_*, which is the name of the wrapper function and now it is __pyx_f_*, which is the name of the actual function. This makes some Cygdb tests pass that did not pass before. * Better error messages: If a cygdb command raises, a traceback will be printed. * Fixed a bug in cygdb. The following now works: 1. Start cygdb 2. Type "cy exec" and hit enter 3. Type some other lines 4. Type "end" and hit enter. -> These "other lines" will get executed * Fixed a bug in cygdb: cy list now works outside of functions. * Added print_hr_allmarkers function for easier debugging. * Fixed a bug that broke cygdb: cy break did not work if you put the breakpoint outside of a function if there was e.g. the following somewhere in your *.pyx file: cdef class SomeClass(): pass * Added a Cygdb test for printing global variables. * Fixing cygdb: Replaced cy print with a simple, working solution. * If an exception in Cygdb occurs, a stacktrace will be printed. * Fixed a bug that broke cy break -p * Bugfix: The compiler now writes out correctly which cython linenumber and path corresponds to which c linenumber. * Set language_level=2 in runtests.py
* | Implement generic optimized loop iterator with indexing and type inference ↵da-woods2020-06-301-6/+1
| | | | | | | | | | | | for memoryviews (GH-3617) * Adds bytearray iteration since that was not previously optimised (because it allows changing length during iteration). * Always set `entry.init` for memoryviewslice.
* | Fix many indentation and whitespace issues throughout the code base (GH-3673)scoder2020-06-101-24/+23
| | | | | | … and enforce them with pycodestyle.
* | Check for exceptions also when @returns() is used, not only for "->" return ↵scoder2020-06-061-2/+2
| | | | | | | | | | | | | | | | | | type annotations. (GH-3664) When you use Python type annotations, it would be weird if you lost Python exception propagation semantics along the way, just by compiling the code. So the default behaviour is "except? -1" here for C integer types. Arguably, this would also be a better default for the decorator case. See https://github.com/cython/cython/issues/3625#issuecomment-631931675
* | Fix typo in comment.Stefan Behnel2020-06-041-1/+1
| |
* | Small changes to get `--cython-compile-all` working again (GH-3650)da-woods2020-05-291-1/+1
| | | | | | | | | | | | Fixes https://github.com/cython/cython/issues/3647 At least one (in ModuleNode) is a real bug. The others are just getting the code compatible with Cython again`
* | Fixed "test_*_path_exists" + CompilerDirectivesNode (GH-3619)da-woods2020-05-191-0/+4
| | | | | | | | | | | | | | When test_assert_path_exists or test_fail_if_path_exists was used on a function containing a CompilerDirectivesNode it was inherited by that CompilerDirectivesNode. Therefore you got misleading test failures if the path was in the function but not within that CompilerDirectivesNode.
* | Reduce the code overhead of exception raising in generated Cython code and ↵Stefan Behnel2020-05-171-4/+4
| | | | | | | | the memoryview code by avoiding explicit calls to create the exception and prepared constant argument tuples. "raise Exc, message" can do this implicitly.
* | Run ParallelRangeTransform also recursively on function arguments (GH-3608)da-woods2020-05-151-0/+1
| |
* | Rewrite the C property feature (GH-3571)scoder2020-05-041-54/+77
| | | | | | | | | | | | | | | | | | | | | | * Rewrite C property support (GH-2640) based on inline C methods. Supersedes GH-2640 and GH-3095. Closes GH-3521. * Test fix for `numpy_parallel.pyx`: avoid depending on whether "nd.shape" requires the GIL or not. * Turn NumPy's "ndarray.data" into a property to avoid direct struct access. * Make "ndarray.size" accessible without the GIL.
* | Reimplement the "assert" statement by delegating the exception raising to a ↵Stefan Behnel2020-04-291-1/+17
| | | | | | | | | | | | RaiseStatNode. This allows taking advantage of the automatic "with gil" block handling for raising exceptions, allows proper control flow analysis, etc.
* | Allow print statements in nogil sections.Stefan Behnel2020-04-271-6/+7
| | | | | | | | Would be nice to allow this also for the print() function, but that's tricky because we have to insert the "GILStatNode" before analysing the declarations, which is when we learn if it's really the builtin print function or something else.
* | Avoid acquiring the GIL at the end of nogil functions (GH-3556)Stefan Behnel2020-04-271-14/+0
| | | | | | | | | | Acquire the GIL in nogil functions only when strictly needed on function exit, e.g. for cleaning up temp variables from with-gil blocks or adding tracebacks. Closes GH-3554.
* | Revert "Revert "Avoid some unnecessary traversal in "ForwardDeclareTypes".""Stefan Behnel2020-04-271-0/+12
| | | | | | | | This reverts commit f09e61ab721ad51526ec7a6798fc01d8346f539d.
* | Revert "Avoid some unnecessary traversal in "ForwardDeclareTypes"."Stefan Behnel2020-04-261-12/+0
| | | | | | | | | | This reverts commit 5204d86989493855fdd0acd20debd9d0a270bb23. See https://github.com/cython/cython/issues/3548
* | Avoid some unnecessary traversal in "ForwardDeclareTypes".Stefan Behnel2020-04-241-0/+12
| |
* | Mangle __arg argument names in methods (GH-3123)da-woods2020-04-231-2/+1
| | | | | | | | | | Follows Python behaviour, but excludes "__pyx_…" names in utility code. Closes GH-1382.
* | Drop unused code-paths associated with "if cython.compiled" early (GH-3507)da-woods2020-04-131-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | This allows things to work like: # in pxd file from libc.math cimport sin # in py file if not cython.compiled: from math import sin # previously failed with cython compile # error because it was assigning to a cdef name This seems worthwhile because it makes it easier to write code that re-assigns cdef names and so works in both modes.
* | Specialize fused function local variables specified with pure-python (GH-3463)da-woods2020-03-311-0/+2
| | | | | | | | | | | | | | These were previously getting missed. Added code to specialize them and tests to prove it. Fixes https://github.com/cython/cython/issues/3142 Also fixes https://github.com/cython/cython/issues/3460 - (seems related enough to go in the same PR)
* | Merge branch '0.29.x'Stefan Behnel2020-02-121-0/+2
|\ \ | |/
| * fix "undeclared" warning about generated pickle methods (GH-3353)da-woods2020-02-121-0/+2
| | | | | | | | | | The pickle functions __reduce__ and __setstate_cython__ were being visited in the module scope (where they were undeclared) rather than the class scope where they were declared
| * Mangle cname for closures in derived c class (GH-2990)Josh Tobin2019-06-111-1/+4
| |
* | Support METH_FASTCALL for Cython functions (GH-3101)Jeroen Demeyer2019-09-101-3/+0
| |
* | Rename self_result_code -> closure_result_codeJeroen Demeyer2019-08-271-1/+1
| |
* | Use METH_FASTCALL on CPython >= 3.7 (GH-3021)Jeroen Demeyer2019-08-271-0/+5
| |
* | Support wider use of @property decorator on CClassDef AttributeNodes (GH-3095)Matti Picus2019-08-271-1/+3
| | | | | | | | | | | | * TEST: add cgetter test for pointer and pxd use * BUG: handle more AttributeNode-with-property-decorator * BUG: fix numpy/__init__.pxd * ENH: add @property for ndarray.size, formatting cleanup
* | Unicode identifiers (PEP 3131) (GH-3081)da-woods2019-08-241-4/+5
| | | | | | Closes #2601
* | Mangle cname for closures in derived c class (GH-2990)Josh Tobin2019-06-111-1/+4
| |
* | Merge branch '0.29.x'Stefan Behnel2019-03-041-1/+2
|\ \ | |/
| * Add missing return type annotation to generators and coroutines.Stefan Behnel2019-03-041-1/+2
| | | | | | | | Closes GH-2884.
* | Create run tests for conditional GILStatNodeNoam Hershtig2019-02-231-2/+10
| |
* | Allow condition in GILStatNodeNoam Hershtig2019-02-231-0/+5
| |
* | Only inject eval() locals/globals args when it's called as a builtin and not ↵Stefan Behnel2019-02-031-2/+2
| | | | | | | | redefined e.g. in the module (found when updating test_grammar() and overriding it there).
* | Merge pull request #2640 from mattip/ctypedef-class-getter2Stefan Behnel2019-01-161-1/+24
|\ \ | | | | | | ENH: allow @property decorator on external ctypedef classes
| * | MAINT: refactor decorator analysismattip2019-01-071-16/+17
| | |
| * | MAINT: refactor: is_cgetter now lives on the entry, use find_decoratormattip2019-01-071-13/+11
| | |
| * | MAINT: refactor from reviewmattip2019-01-051-11/+16
| | |
| * | whoops, staticmethod is a valid cdef decoratormattip2018-11-131-0/+1
| | |
| * | ENH: handle c-level property decorator to produce a cfunc callmattip2018-11-131-9/+8
| | |
| * | add a new ReplacePropertyNode passmattip2018-11-131-61/+19
| | |
| * | WIP ENH: allow @property decorator on external ctypedef classesmattip2018-11-051-1/+62
| |/
* | Use Py3 syntax in generated Cython code fragment.Stefan Behnel2019-01-121-1/+1
| |
* | Replace MD5 file hashing by SHA-1, both because it's faster (by 25% on 64 ↵Stefan Behnel2019-01-081-1/+1
|/ | | | | | bit Linux) and because MD5 is no longer allowed in US FIPS 140-2 environments. Closes #2790.
* 2685_warn_undeclared: fix undeclared type warnings for unpickle variables.Nicolas Pauss2018-10-301-0/+4
| | | | | | | | | | The types of variables __pyx_PickleError, __pyx_result from generated unpickle function, and variables state, _dict from __reduce_cython__ generated method were not declared. So warnings were raised with warn.undeclared for every single extension type. Now, we define the type of these variables, and no warnings are raised.
* Prevent assigned global variables from being marked and treated as closure ↵Stefan Behnel2018-09-221-1/+1
| | | | | | variables in generators and coroutines. Closes #2613.
* Clean up directives to distinguish between those that belong to a function ↵Stefan Behnel2018-09-221-32/+29
| | | | | | | or class and those that are generally inherited. Everything that is not inherited should also not have a default value and instead exist or not. Then, prevent lambdas and generator expressions from inheriting directives from their outer function/scope, e.g. "@cython.cdef". Closes #459.
* Check some child nodes against the correct nogil context when they are ↵Stefan Behnel2018-09-191-12/+24
| | | | actually being evaluated in the outer scope (e.g default arguments or annotations of a nogil function).
* Support "@cython.nogil" decorator in pure mode.Stefan Behnel2018-09-141-2/+7
| | | | Closes #2557.
* Mark try-finally statements with terminating finally clauses as terminators ↵Stefan Behnel2018-08-251-0/+6
| | | | themselves.