- 02 Apr, 2020 5 commits
-
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
da-woods authored
Optimized inplace operations for str/unicode so that they're genuinely done in place if no-one else needs the object. This is what CPython tries to do (and string concatenation was a point where it significantly beat Cython at times). This only works if the types are known at compile time, so with unknown types CPython will still be faster in some cases. Note: Uses slightly odd-macro trickery - does modify the input argument too (although only in places where it shouldn't matter).
-
William Ayd authored
-
- 01 Apr, 2020 5 commits
-
-
Stefan Behnel authored
-
Stefan Behnel authored
Fix branch prediction hints for plain (unlikely/exceptional) "raise" statements in if/else clauses that are not preceded by other statements.
-
Stefan Behnel authored
-
Stefan Behnel authored
-
will-ca authored
* Rewrote signature matching for fused cpdef function dispatch to use a pre-built tree index in a mutable default argument and be O(n). * Added test to ensure proper differentiation between ambiguously compatible and definitely compatible arguments. * Added test to ensure fused cpdef's can be called by the module itself during import. * Added test to ensure consistent handling of ambiguous fused cpdef signatures. * Test for explicitly defined fused cpdef method. * Add .komodoproject to .gitignore. * Add /cython_debug/ to .gitignore. Closes #1385.
-
- 31 Mar, 2020 14 commits
-
-
Stefan Behnel authored
-
Stefan Behnel authored
Disable a saved compiler option in the test runner that cannot currently be changed in the tests directly (only in external compiler runs).
-
da-woods authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
will-ca authored
Closes https://github.com/cython/cython/issues/3419
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
da-woods authored
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)
-
- 26 Mar, 2020 4 commits
-
-
will-ca authored
Closes https://github.com/cython/cython/issues/3419
-
Zackery Spytz authored
The comments are taken from the C API documentation (https://docs.python.org/3.8/c-api/marshal.html).
-
Diego Elio Pettenò authored
This removes the `setup_requires` reference that AIUI is deprecated, in favour of the `pyproject.toml` file which is what is supposedly needed nowadays.
-
Dmitry Shesterkin authored
-
- 25 Mar, 2020 1 commit
-
-
Dmitry Shesterkin authored
The following code: ``` # cython: infer_types=True import cython @cython.cclass class Foo: a: cython.double b: cython.double c: cython.double def __init__(self, a: cython.double, b: cython.double ,c: cython.double): self.a = a self.b = b self.c = c def bar(): l = [] l.append(Foo(10, 20, 30)) v = cython.declare(Foo, l[0]) r = v.a + v.b print( r ) v2 = cython.cast(Foo, l[0]) #Faster - No __Pyx_TypeTest() call r = v2.b + v2.c print( r ) bar() ``` works fine when compiled and throws an exception when interpreted: `TypeError: __init__() missing 2 required positional arguments: 'b' and 'c'` It could be fixed if we change implementations as shown in the patch. Also, added more tests for the cases I'm trying to fix NB: Removed execution of `test_declare(None)` to make sure that the new `none_declare()` test works instead. `test_declare(None)` doesn't throw exception in pure mode but does it in the native mode Replacing `hasattr(t, '__call__')` to `callable(t)` in the master branch broke the implementation and the tests because the construction was used to detect typedefs. To fix that I got rid of this check completely and replaced it to exact checks which also simplified the code Changed `declare` implementation when initializing arguments are not provided. Now it correctly works with typedefs of the user classes and also directly support arrays: ``` >>> EmptyClassSyn = cython.typedef(EmptyClass) >>> cython.declare(EmptyClassSyn) is None True >>> cython.declare(cython.int[2]) is not None True ``` Added missed return statement to `index_type` which made the following assigment possible: ``` a = cython.declare(cython.int[2]) a[0] = 1 ```
-
- 24 Mar, 2020 11 commits
-
-
Alex Henrie authored
-
da-woods authored
-
da-woods authored
Now they make their own tiny cache of the relevant exceptions at module initialization so they can still access these without the GIL. closes https://github.com/cython/cython/issues/3406
-
Yuan authored
-
Diego Elio Pettenò authored
While the directives in the source files are still called `distutils`, the [Python upstream documentation](https://docs.python.org/3/library/distutils.html) does not recommend using distutils anymore, and rather points at setuptools, so avoid confusing new users by providing confusing legacy usage examples. Also, this corrects one example in which Extension is imported too late, and would cause annoying errors when running `setup.py`.
-
da-woods authored
The idea being that struct-types like memoryviews can generate their own reference counting code using a common interface with Python objects.
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-
Stefan Behnel authored
-