summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '0.29.x'HEADmasterStefan Behnel2023-05-161-1/+1
|\
| * Disable fast Py_SIZE(PyLong) check in Py3.12a7+ since it's no longer valid ↵0.29.xStefan Behnel2023-05-162-2/+2
| | | | | | | | there.
* | Keep the "tp_print" slot for PyPy < 3.10 and CPython < 3.9 (GH-5437)Matti Picus2023-05-165-11/+16
| |
* | Custom int128 conversion as a slow fallback (GH-5419)scoder2023-05-154-18/+142
| | | | | | | | * Use a custom (although slow) PyLong->cint128 conversion if "_PyLong_AsByteArray()" is missing (in PyPy/Limited API). * Avoid large integer conversion for enum types (where shift etc. don't work well).
* | Merge branch 'master' of git+ssh://github.com/cython/cythonStefan Behnel2023-05-151-2/+3
|\ \
| * | Fix a signedness compiler warning in vector.to_py (GH-5438)Philipp Wagner2023-05-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When compiling cythonized code which uses `std::vector` we get the following compiler warning on GCC 8 and Python 3.9 (which is turned into an error in our case): ``` my_file.cpp: In function ‘PyObject* __pyx_convert_vector_to_py_int(const std::vector<int>&)’: my_file.cpp:4716:33: warning: comparison of integer expressions of different signedness: ‘Py_ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { ~~~~~~~~~~^~~~~~~~~~~ ``` The generated code in question is as follows: ``` /* "vector.to_py":75 * cdef object item * * for i in range(v.size()): # <<<<<<<<<<<<<< * item = v[i] * Py_INCREF(item) */ __pyx_t_3 = __pyx_v_v.size(); __pyx_t_4 = __pyx_t_3; for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; ``` `__pyx_t_5` is of type `‘Py_ssize_t’` (signed), and `__pyx_t_4` aka `__pyx_t_3` is `size_t` (unsigned), causing GCC to rightfully complain. Fix the generated code by explicitly using the signed variant of the vector's size in the loop. This bug has been introduced in https://github.com/cython/cython/pull/4081, which also contains some discussion on the use of signed vs unsigned types. This patch chooses to keep the status quo and only fixes the compiler warning.
* | | Merge branch '0.29.x'Stefan Behnel2023-05-150-0/+0
|\ \ \ | |/ / |/| / | |/
| * Prevent calling the dealloc slot of a non-GC base class with GC tracking ↵scoder2023-05-152-6/+41
| | | | | | | | | | | | enabled. (GH-5432) This shows warnings in CPython (3.12) debug builds and can lead to crashes when GC triggers on an object while deallocating it.
| * enable passing datetime tests on PyPy (#5427)Matti Picus2023-05-071-3/+0
| |
* | Prevent calling the dealloc slot of a non-GC base class with GC tracking ↵scoder2023-05-152-8/+45
| | | | | | | | | | enabled. (GH-5432) This shows warnings in CPython (3.12) debug builds and can lead to crashes when GC triggers on an object while deallocating it.
* | Support PyBufferProcs with Limited C-API under Py3.9+ or Py3.11+ (GH-5422)Lisandro Dalcin2023-05-042-5/+8
| |
* | Remove useless parentheses.Stefan Behnel2023-05-041-3/+3
| |
* | Remove the useless check that the struct field visibility is the same as the ↵Stefan Behnel2023-05-042-7/+3
| | | | | | | | | | | | struct's visibility. This is assured by syntax. See https://github.com/cython/cython/pull/5386
* | Keep 'extern' visibility in context of struct/union to properly infer ↵Matus Valo2023-05-035-8/+48
| | | | | | | | 'noexcept' for function pointer fields (GH-5386)
* | Silence GCC -Wsign-conversion (GH-5421)Lisandro Dalcin2023-05-036-8/+9
| | | | | | | | * Silence GCC -Wsign-conversion when using CYTHON_LIMITED_API * Silence GCC -W[sign-]conversion with invocations to PyUnicode_FromOrdinal
* | Merge branch '0.29.x'Stefan Behnel2023-05-021-0/+10
|\ \ | |/
| * Update changelog.Stefan Behnel2023-05-021-0/+10
| |
| * Allow users to override CYTHON_PEP489_MULTI_PHASE_INIT in PyPy 3.9+.Stefan Behnel2023-05-021-3/+4
| | | | | | | | | | See https://github.com/cython/cython/issues/5413 Improves on https://github.com/cython/cython/pull/5414
| * Use CYTHON_PEP489_MULTI_PHASE_INIT on PyPy 3.9 (GH-5414)Matti Picus2023-05-021-2/+5
| |
* | Allow users to override CYTHON_PEP489_MULTI_PHASE_INIT in PyPy 3.9+.Stefan Behnel2023-05-021-4/+4
| | | | | | | | | | See https://github.com/cython/cython/issues/5413 Improves on https://github.com/cython/cython/pull/5414
* | Fix usage of _MSC_VER macro (GH-5417)matttyson2023-05-021-2/+2
| | | | | | Change #if to #ifdef so we don't get undefined macro warnings on non microsoft compilers.
* | Use CYTHON_PEP489_MULTI_PHASE_INIT on PyPy 3.9 (GH-5414)Matti Picus2023-05-021-1/+5
| |
* | Catch ValueError when calling memoryview() to avoid leaking implementation ↵Matus Valo2023-04-302-1/+27
| | | | | | | | details (GH-5406)
* | CmdLine: Fix regression when using the `--working` option (GH-5365)Lisandro Dalcin2023-04-302-1/+15
| | | | | | | | | | Checking for the existence of source files must account for the user-specified working directory. If the source filename is not absolute, prepend the working directory if specified, then perform the check.
* | Fix parsing of bracketed then called context managers (GH-5404)da-woods2023-04-282-0/+24
| | | | | | | | | | | | | | Require the bracketed multiple context managers to be followed by a colon, so that the bracketed called context manager is identified as regular parentheses in old-style syntax. Fixes https://github.com/cython/cython/issues/5403
* | Merge branch '0.29.x'da-woods2023-04-270-0/+0
|\ \ | |/
| * prepare cython for PyPy3.10 (#5408)Matti Picus2023-04-274-11/+41
| |
| * Distinguish 'api' import functions from different Cython versions (GH-5383) ↵da-woods2023-04-203-35/+47
| | | | | | | | | | | | | | (#5390) Fixes issue with changed signature for these functions between Cython releases Issue was reported here: https://github.com/cython/cython/pull/5289#issuecomment-1509371606
* | prepare cython for PyPy3.10 (#5408)Matti Picus2023-04-274-11/+11
| |
* | Use the generally available Py_ssize_t instead of the less widespread ssize_t.Stefan Behnel2023-04-251-1/+1
| | | | | | | | See https://github.com/cython/cython/pull/5394#issuecomment-1521199083
* | Use unsigned C integer type when validating the C value of a compact PyLong.Stefan Behnel2023-04-241-2/+8
| | | | | | | | Closes https://github.com/cython/cython/pull/5394
* | Move C-only test out of Python test file.Stefan Behnel2023-04-242-59/+53
| |
* | Warn about useless directives that do not change the previous setting.Stefan Behnel2023-04-243-0/+65
| | | | | | | | Also, make sure that we correctly allow resetting directives, even if the new value is the same as the value from outside (since we might already have set it differently in the same directives block).
* | Disallow @cfunc being applied to a @ufunc.Stefan Behnel2023-04-245-4/+16
| | | | | | | | Closes https://github.com/cython/cython/issues/5399
* | Treat @total_ordering directive like @cfunc/@ccall directives by excluding ↵Stefan Behnel2023-04-242-4/+4
| | | | | | | | | | | | it from the normal directives dict unless it's being used. Also, remove it from the active directives once it's been used, to prevent it from appearing in nested structures.
* | Treat @ufunc directive like @cfunc/@ccall directives by excluding it from ↵Stefan Behnel2023-04-242-2/+2
| | | | | | | | the normal directives dict unless it's being used.
* | Disallow @cfunc together with @ccall on the same function.Stefan Behnel2023-04-242-0/+22
| |
* | docs: change "(...)" ctuple syntax to "tuple[...]" in Python annotations.Stefan Behnel2023-04-242-3/+3
| |
* | Allow assigning ctuples from arbitrary sequences, not just tuples. The code ↵Stefan Behnel2023-04-242-17/+59
| | | | | | | | was there anyway, just needed moving around a bit.
* | Improve error message when assigning tuples of incorrect size to a ctuple. ↵Stefan Behnel2023-04-242-5/+9
| | | | | | | | Previously, it said "Expected tuple of size 4, got tuple", which is unhelpful and confusing.
* | Ignore (and warn about) simple type-tuples in annotations (like "(int, ↵Stefan Behnel2023-04-243-6/+33
| | | | | | | | | | | | int)") and require "tuple[int, int]" instead. Closes https://github.com/cython/cython/issues/5397
* | Add an example of a custom exception handler. (#5334)Vyas Ramasubramani2023-04-231-2/+88
| | | | | | | | | | * Add an example of a custom exception handler. * Make sure to mention that any custom exception would work just as well
* | Avoid Python int object creation when multiplying sequences with C integers ↵scoder2023-04-215-36/+328
| | | | | | | | | | | | | | | | | | (GH-5213) * Avoid redundant subtree analysis in MulNode when multiplying sequences with unknown types. * Avoid Python int creation when multiplying sequences with integers. * Also allow a cint mult_factor for sequences, avoiding Python coercion if possible. * Also optimise (int * ctuple), which will eventually end up as a Python tuple as well. * Make sure we only apply a "mult_factor" to a Python sequence (not ctuples), and make the re-analysis of TupleNode a little safer.
* | Fix regression in code generation order for cdef classes (GH-5395)Lisandro Dalcin2023-04-212-2/+24
| |
* | [docs] Table for annotation typing rules (#4887)da-woods2023-04-202-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [docs] Table for annotation typing rules * Add back "tips and tricks" * Move table into an external csv It's much easier to maintain there, while editing rst tables is a real pain * Update docs/src/tutorial/annotation_typing_table.csv * Update docs/src/tutorial/pure.rst Co-authored-by: scoder <stefan_ml@behnel.de> --------- Co-authored-by: scoder <stefan_ml@behnel.de>
* | Make memoryviews with aliased item types comformable (GH-5375)Yue Yang2023-04-202-1/+16
| |
* | Distinguish 'api' import functions from different Cython versions (GH-5383)da-woods2023-04-173-47/+49
| | | | | | | | | | Fixes issue with changed signature for these functions between Cython releases Issue was reported here: https://github.com/cython/cython/pull/5289#issuecomment-1509371606
* | Refactor __Pyx_PyCode_New() to avoid "dead code" warnings and special error ↵Stefan Behnel2023-04-141-16/+9
| | | | | | | | cases.
* | Work around the new Py3.12 error message suggestions in doctests by not ↵Stefan Behnel2023-04-143-43/+43
| | | | | | | | | | | | printing the exceptions. In Py3.12, printing the AttributeError calls __getattr__(obj, '__dict__') to suggest typos, which changes the call counts to "__getattr__" in some of the tests.
* | Try to silence clang warning about dead code.Stefan Behnel2023-04-141-1/+1
| |