Commit Graph

76 Commits

Author SHA1 Message Date
David Hewitt 76d1b34cd5 Revert "Merge pull request #3578 from davidhewitt/typed-helpers"
This reverts commit 7b07d6d21b, reversing
changes made to 99858236bd.
2024-02-03 20:56:23 +00:00
David Hewitt 4c94be51a7 add `PyBytes::new_bound` 2024-02-01 08:52:28 +00:00
Mate Kovacs 3ed5ddb0ec feat: support pyclass on complex enums 2024-01-18 22:04:42 +09:00
David Hewitt 53d25f7ff2 add new `PyTuple` constructors 2023-12-30 21:37:46 +00:00
Alex Gaynor 91fdfaab45 Use a version of gevent that supports py37
The current version of gevent we require is 3.8+ only
2023-12-24 16:24:47 -05:00
David Hewitt f5b18468bc partially revert changes to `PyTzInfoAccess` trait 2023-12-24 15:07:42 +00:00
David Hewitt 49d7718823 demonstrate switching to `Bound` API resolves `gevent` crash 2023-12-23 22:10:01 +00:00
David Hewitt 46fa1b2b80 add test which is broken with gevent 2023-12-23 22:07:48 +00:00
David Hewitt 6832bf88f2 implement datetime traits for Py2 2023-12-23 15:34:07 +01:00
Adam Reichold ca7d90dcf3 Replace IterNextOutput by autoref-based specialization to allow returning arbitrary values 2023-12-20 09:56:16 +01:00
Adam Reichold 4177dfcc81 Apply __bool__ conversion only to numpy.bool_ to avoid false positives. 2023-12-19 18:55:28 +01:00
Adam Reichold 416d3c488f Rename name to qualname and full_name to name to better match Python 2023-12-19 16:51:24 +01:00
Adam Reichold 2fdd52003e Add PyType::full_name which is tp_name and has an abi3 fallback. 2023-12-19 15:47:21 +01:00
David Hewitt 5326bce57f ci: fixup pytests to compile in debug 2023-12-05 08:01:02 +03:00
David Hewitt 2a5dedcbb5 ci: refactor pytests dev dependencies 2023-12-05 00:54:32 +03:00
David Hewitt 7b07d6d21b
Merge pull request #3578 from davidhewitt/typed-helpers
Change return types of `py.None()`, `py.NotImplemented()` and `py.Ellipsis()` to typed singletons
2023-11-20 07:07:12 +00:00
David Hewitt bd0174aa5d Change return types of `py.None()`, `py.NotImplemented()` and `py.Ellipsis()` to typed singletons 2023-11-17 16:16:19 +00:00
David Hewitt a9305ab389 ci: move lints to new 1.74 cargo.toml tables 2023-11-17 15:41:52 +00:00
David Hewitt 3042ab1621 ci: switch from black to ruff 2023-10-26 21:04:49 +01:00
David Hewitt f12f928bd5
Merge pull request #3514 from messense/memoryview
Add `PyMemoryView` type
2023-10-15 15:08:50 +00:00
messense f4e64aadef
Add test cases for new `TryFrom` impls 2023-10-15 21:53:31 +08:00
David Hewitt 410fef5d79 ci: drop psutil dependency 2023-10-15 14:15:38 +01:00
messense 5b94241bd7
Add `PyMemoryView` type 2023-10-15 17:32:09 +08:00
David Hewitt e1d4173827 Fix bug in default implementation of `__ne__` 2023-10-11 09:48:06 +01:00
David Hewitt 2daddb4734 unify 3.12 and pre-3.12 exception handling pathways 2023-09-30 23:27:27 +01:00
David Hewitt f335f42197
Merge pull request #3446 from davidhewitt/relax-import-check
relax multiple-import check to only prevent subinterpreters
2023-09-29 16:35:31 +00:00
David Hewitt 1a349c2eb7 adjust cfgs for windows 3.9 2023-09-29 14:23:18 +01:00
David Hewitt 1e8833e15e always normalize exceptions before raising 2023-09-24 13:38:23 +01:00
David Hewitt f17e703167 return existing module on Python 3.9 and up 2023-09-23 11:13:39 +01:00
David Hewitt 1338020511 relax multiple-import check to only prevent subinterpreters 2023-09-23 11:13:39 +01:00
Tpt 1e5a49557d Makes PathBuf FromPyObject implementation work on all os.PathLike
PyOS_FSPath is in abi3-py36
2023-08-08 22:15:56 +02:00
David Hewitt d395fe8653 ci: avoid failure to build numpy on 3.12 2023-07-22 21:38:57 +01:00
David Hewitt b65cbb958b ci: updates for rust 1.71 2023-07-14 12:10:37 +01:00
Adam Reichold a0c85bb649
Merge pull request #3240 from davidhewitt/maturin-versions
bump maturin version in example files
2023-06-14 08:24:31 +00:00
David Hewitt 5fd5dcba44 bump maturin version in example files 2023-06-14 08:45:32 +01:00
David Hewitt 4f3fcdbf0f remove all functionality deprecated in PyO3 0.18 2023-06-13 22:27:43 +01:00
Adam Reichold 0d30bb7d3d Bump Rust edition to 2021 and make current Clippy happy. 2023-06-07 21:15:38 +02:00
bors[bot] dbf7b233aa
Merge #3203
3203: support ordering magic methods for `#[pyclass]` r=adamreichold a=davidhewitt

Closes #2089 

This adds `__lt__`, `__le__`, `__eq__`, `__ne__`, `__gt__`, and `__ge__` as per the Python implementations of what we call `__richcmp__`.

There's a UI test confirming that the user cannot implement split forms and `__richcmp__` simultaneously.

There's also a benchmark comparing implementing these split methods against using `__richcmp__`. I couldn't see a meaningful performance difference, so I'm tempted to deprecate `__richcmp__`, given that's not a magic method which exists in Python. Potentially we can provide options such as the opt-in `#[pyclass(eq, ord)]` to avoid boilerplate for people who don't want to implement six different methods.



Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-06-05 07:13:23 +00:00
David Hewitt 5bc3e6f15e fix clippy warnings uncovered by msrv bump 2023-06-05 07:08:27 +01:00
David Hewitt 8850d5d384 support ordering magic methods for `#[pyclass]` 2023-06-04 13:58:18 +01:00
Stu Hood 20c5618160
Add support for combining the `#[new]` and `#[classmethod]` method types. 2023-05-16 15:51:14 -07:00
David Hewitt dd24c9ea71 remove `Python::acquire_gil` 2023-05-09 09:39:23 +02:00
David Hewitt 0362855773 make rust benchmarks more similar to the Python ones 2023-01-20 07:24:05 +00:00
David Hewitt 16d347d96a remove benchmarks from deprecated_pyfunctions 2023-01-20 07:19:13 +00:00
David Hewitt 8f48d157d6 deprecate required arguments after option arguments without signature 2023-01-15 10:17:20 +00:00
messense 272df32277
Add `publish = false` to pyo3-ffi-check and pytests crate 2022-12-03 21:12:54 +08:00
Alex Gaynor f7a487b809
Use a TypeError, rather than a ValueError, when refusing to treat a str as a Vec
This is far more consistent with how these exceptions are usually used
2022-11-07 07:48:13 -05:00
David Hewitt 8e8b484169
add `#[pyo3(signature = (...))]` attribute (#2702) 2022-10-25 07:23:21 +01:00
Adam Reichold f456ed7586 Also relax the PySequence check when extracting fixed-sized arrays. 2022-10-13 09:43:45 +02:00
Adam Reichold b2da5b20b1 Add a Python test exploring from which types a Vec can be extracted. 2022-09-21 09:47:05 +02:00