| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| | |
there.
|
| | |
|
| |
| |
| |
| | |
* 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).
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|\ \ \
| |/ /
|/| /
| |/ |
|
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| |
| |
| |
| |
| | |
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.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
struct's visibility. This is assured by syntax.
See https://github.com/cython/cython/pull/5386
|
| |
| |
| |
| | |
'noexcept' for function pointer fields (GH-5386)
|
| |
| |
| |
| | |
* Silence GCC -Wsign-conversion when using CYTHON_LIMITED_API
* Silence GCC -W[sign-]conversion with invocations to PyUnicode_FromOrdinal
|
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| |
| | |
See https://github.com/cython/cython/issues/5413
Improves on https://github.com/cython/cython/pull/5414
|
| | |
|
| |
| |
| |
| |
| | |
See https://github.com/cython/cython/issues/5413
Improves on https://github.com/cython/cython/pull/5414
|
| |
| |
| | |
Change #if to #ifdef so we don't get undefined macro warnings on non microsoft compilers.
|
| | |
|
| |
| |
| |
| | |
details (GH-5406)
|
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| | |
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
|
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
(#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
|
| | |
|
| |
| |
| |
| | |
See https://github.com/cython/cython/pull/5394#issuecomment-1521199083
|
| |
| |
| |
| | |
Closes https://github.com/cython/cython/pull/5394
|
| | |
|
| |
| |
| |
| | |
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).
|
| |
| |
| |
| | |
Closes https://github.com/cython/cython/issues/5399
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
the normal directives dict unless it's being used.
|
| | |
|
| | |
|
| |
| |
| |
| | |
was there anyway, just needed moving around a bit.
|
| |
| |
| |
| | |
Previously, it said "Expected tuple of size 4, got tuple", which is unhelpful and confusing.
|
| |
| |
| |
| |
| |
| | |
int)") and require "tuple[int, int]" instead.
Closes https://github.com/cython/cython/issues/5397
|
| |
| |
| |
| |
| | |
* Add an example of a custom exception handler.
* Make sure to mention that any custom exception would work just as well
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
(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.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* [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>
|
| | |
|
| |
| |
| |
| |
| | |
Fixes issue with changed signature for these functions between Cython releases
Issue was reported here: https://github.com/cython/cython/pull/5289#issuecomment-1509371606
|
| |
| |
| |
| | |
cases.
|
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|