| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Closes https://github.com/cython/cython/issues/5399
|
| |
|
| |
|
|
|
| |
Closes https://github.com/cython/cython/issues/5070
|
|
|
|
|
| |
declaration (#5248)
Co-authored-by: GalaxySnail <me@glxys.nl>
|
| |
|
|
|
|
| |
documentation in language basics userguide (#5082)
|
| |
|
|
|
| |
To make sure it works right with Python 3 semantics.
|
| |
|
| |
|
|
|
|
|
|
|
| |
* Replace unnecessary __cinit__ with __init__ in documentation examples
* Use __cinit__ when necessary in the wrapping C++ examples
* Modify existing Rectangle instead of creating a new Rectangle in the pointer to Rectangle example
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Check for "Optional[ctype]" earlier because we need to make sure that "Optional[int]" etc. interprets "int" as (valid) Python int type and not (invalid) C int type.
See https://github.com/cython/cython/issues/3883
* Fix typing assumptions in PEP 526 variable annotations test: in a Python type annotation, "int" means Python int and "float" means Python float, not the C types.
* Use a context manager to make it explicit in annotation type analysis when C types are allowed, and when Python types are required or expected.
* Generalise the concept of equivalent Python and C types for more efficient type inference: PyFloat/double, PyBool/bint, PyComplex/double complex.
* Refactor analyse_type_annotation() to prepare the extraction of type modifiers (as opposed to special types).
See discussion in https://github.com/cython/cython/pull/4606#issuecomment-1026658869
* Refactor handling of "typing.Optional", "dataclasses.InitVar" etc. annotations to move them into the declared Entry during type analysis and keep only the bare type in the type system.
* Force ClassVar[...] types to be object types.
* Add a warning when users define a ClassVar[] with a non-Python type.
See https://github.com/cython/cython/pull/4606#discussion_r805170982
* Provide a helpful warning when users write plain C types in a non-C annotation context.
* Only consider Python object item types from list/tuple as self.type in IndexNode since that will be the result of the index access. Coercion needs to happen externally, then based on the type inference.
* Ignore Python annotation type "long" since it almost certainly does not refer to PyLong but to C long. Issue a warning to make users aware of it.
* Fix PEP-526 test by working around incomplete type inference, but leave FIXME comments.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial migration of examples
* Migrate text in sharing_declarations.rst
* Some fixes of examples and clarification
* Fix capitalization
* Apply suggestions from code review
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
|
|
|
|
|
| |
* Migrate special_methods.rst to pure python
* Fix missing import in examples
|
|
|
|
| |
Signatures with unnamed (type-only) arguments are generally more difficult to read.
|
|
|
|
|
|
| |
specific struct fields.
See https://github.com/cython/cython/issues/4310
|
|
|
|
|
|
|
|
|
|
|
|
| |
New decorator/function "@cython.dataclasses.dataclass" and "cython.dataclasses.field()" to mark dataclasses and their fields.
Tries to match the interface provided by a regular dataclass as much as possible.
This means taking the types from the dataclasses module if available (so they match exactly) or a fallback Python version that just implements the core parts (executed with "PyRun_String()" in the C source).
Use of placeholders in generated "__init__" code means the code in the C file isn't hugely readable. Probably not a huge issue, but don't really see a way round that.
As part of this I've also also implemented a Cython version of "typing.ClassVar". Although really designed for use with dataclasses it behaves sensibly when used in types in a normal cdef class. This is worth documenting more thoroughly.
Closes https://github.com/cython/cython/issues/2903
|
|
|
| |
Closes https://github.com/cython/cython/issues/2760
|
|
|
| |
See https://github.com/cython/cython/issues/4187
|
| |
|
|
|
|
|
|
| |
exceptions.
Also make a couple of improvements regarding clarity and text formatting.
|
|
|
| |
For reasons I don't full understand, including "windows.h" seems to break everything. There's an alternative sleep function in stdlib.h so I've used that instead since it makes the point just as well.
|
| |
|
|
|
|
|
| |
"synchapi.h" is not supposed to be included directly, and "windows.h" can break ... other stuff.
Let's see what we can do.
|
| |
|
| |
|
|
|
|
| |
documentation.
|
| |
|
| |
|
|
|
|
|
|
| |
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`.
|
| |
|
| |
|
| |
|
|
|
|
| |
Fix early binding example.
Closes GH-2848.
|
|
|
|
| |
memoryview tutorial.
|
| |
|
| |
|
|
|
|
| |
ignored the build of the docs in git.
|
|\
| |
| | |
Changed the numpy tutorial to make is faster to understand.
|
| | |
|
| |\ |
|
| | |
| | |
| | |
| | | |
the docs.
|
| | |
| | |
| | |
| | | |
example.
|
| |/
|/|
| |
| | |
Closes #2489.
|
|\ \
| | |
| | | |
Simplified the first example of fused types.
|
| |/ |
|
| |
| |
| |
| | |
equivalent
|
|\ \
| | |
| | | |
Added tests for "language basics" part 5
|