Commit Graph

159 Commits

Author SHA1 Message Date
David Hewitt 18e0aa17e0 pymodule: accept `#[pyo3(name = "...")]` option 2021-06-06 08:41:20 +01:00
David Hewitt 9b8b133905 pyfunction: document `#[pyo3(pass_module)]` 2021-06-05 17:36:50 +01:00
David Hewitt cec4c2d2e9 text_signature: move to `#[pyo3(text_signature = "...")]` 2021-06-05 16:33:03 +01:00
David Hewitt d011467e63 pyclass: allow `#[pyo3(get, set, name = "foo")]` 2021-06-04 11:30:40 +01:00
David Hewitt 9f74336bc9 pyfunction: better error message with `async fn` 2021-05-25 11:32:52 +01:00
David Hewitt a109640850 pyfn: deprecate name argument 2021-05-20 08:54:29 +01:00
David Hewitt 4d46abde73 macros: support `#[pyo3(name = "...")]` 2021-05-07 22:35:52 +01:00
David Hewitt 4613b3dd7e
Merge pull request #1596 from davidhewitt/remove-pytypeinfo-layout
type_object: remove layout and base type from PyTypeInfo
2021-05-07 22:32:24 +01:00
David Hewitt defd09c166 rust: updates for rust 1.52 2021-05-06 23:18:34 +01:00
David Hewitt 7536554ceb type_object: remove layout and base type from PyTypeInfo 2021-05-04 21:39:42 +01:00
Yuji Kanagawa f0763f069e
Merge pull request #1507 from scalexm/getter-name
Allow `#[name]` with `#[getter]` and `#[setter]`
2021-03-20 16:23:07 +09:00
messense 2cec240b0e Ban pyo3(get, set) on tuple struct field 2021-03-19 10:17:06 +08:00
scalexm b27ee3fd64 Allow `#[name]` with `#[getter]` and `#[setter]` 2021-03-18 19:35:17 +01:00
David Hewitt 9613228a0c pyfunction: reject generic functions 2021-03-09 23:47:47 +00:00
konstin f97c3a9479 Convert callback_body_without_convert function to handle_panic function 2021-03-01 12:42:19 +01:00
Daniil Konovalenko 554cffd60d
add #[pyo3(from_py_with="...")] attribute (#1411)
* allow from_py_with inside #[derive(FromPyObject)]
* split up FnSpec::parse
2021-02-21 00:15:20 +09:00
David Hewitt 7b99e391fa pyclass-impl: merge implementation traits 2021-02-18 08:19:07 +00:00
David Hewitt 88872eba4f macros-backend: improve error handling ergonomics 2021-01-10 10:25:43 +00:00
David Hewitt 22de3b4f44 pyclass: add !Send compile_error test 2021-01-05 23:25:28 +00:00
David Hewitt b1012ebb68 build: update for Rust 1.49 2020-12-31 18:16:02 +00:00
David Hewitt 5133f81e6d deprecate pyclass name without quotes 2020-12-12 11:11:11 +00:00
scalexm 649b439463 Allow `#[pyclass(name = "string literal")]`
This is also more in line with the `#[name = "..."]` attribute on
methods.
2020-11-27 18:45:07 +01:00
David Hewitt 8a8c098a2e rust-1.48: fix tests and warnings 2020-11-19 12:49:29 +00:00
David Hewitt 9617edfca9 msrv: bump to 1.45 2020-11-12 11:33:08 +00:00
Alex Gaynor aabad7cf7f Assorted updates to the abi3 branch from review 2020-10-11 19:51:27 -04:00
Alex Gaynor 140790b15f Merge branch 'master' into abi3-merge-master 2020-10-10 10:11:49 -04:00
dvermd df984ec8df
Keyword only arguments (#1209)
* allow keyword arguments without default value

* allow keyword-only arguments
2020-10-01 13:34:54 +09:00
kngwyu 869a5e2f20 Fix an abi3 ui test for the latest Rustc 2020-09-20 15:33:55 +09:00
kngwyu 7644d67ad8 Inhibit subclassing native types with ABI3 set 2020-09-20 00:42:55 +09:00
Sebastian Pütz e65b849ab6 Doc fixes, changelog and rename. 2020-09-05 10:20:22 +02:00
Sebastian Pütz 795c054511 Possible to pass PyModule as first arg.
This commit makes it possible to access the module of a function
by passing the `need_module` argument to the pyfn and pyfunction
macros.
2020-09-04 09:01:21 +02:00
Sebastian Pütz 0f32f886b8 More FromPyObject derive suggestions by @davidhewitt 2020-08-30 19:16:59 +02:00
Sebastian Pütz 7a9f4a1633 FromPyObject derive suggestions by @kngwyu 2020-08-30 15:33:50 +02:00
Sebastian Pütz a8c5379eff Add compile fail tests for FromPyObject derives + some fixes.
Fix some error messages and accidental passes.
2020-08-30 12:54:13 +02:00
David Hewitt 42296ea5c2 Update UI tests for Rust 1.46 2020-08-29 09:22:00 +01:00
Mario 608aea726c
Allow other Result types in `#[pyfunction]` (#1118)
* Added a couple basic tests

* Implemented suggested change

* Fixed type inference

* cargo fmt

* Finished tests and removed warnings

* Include in CHANGELOG.md

* Moved test into separate file

* &'static str and function rename

* Mention in the book
2020-08-29 08:25:20 +01:00
David Hewitt 77ed6d6d69 Remove AsPyRef for just Py::as_ref 2020-08-09 22:47:54 +01:00
kngwyu d76fe7835a Introduce #[pyclass(unsendable)] 2020-06-30 12:30:17 +09:00
David Hewitt e140b729fc Allow #[getter] and #[setter] functions to take PyRef 2020-06-27 14:55:22 +01:00
konstin 6798fe9da7 Fix tests on stable 2020-06-18 17:23:49 +09:00
David 33617bfffc Require Send for #[pyclass] 2020-06-08 02:06:15 +01:00
David Hewitt 9a2d908342 Simplify callback code using callback_body! macro 2020-05-05 00:27:50 +01:00
Mara Bos dcab478d66
Fix lifetime safety bug of AsPyRef::as_ref(). (#876)
* Fix lifetime safety bug of AsPyRef::as_ref().

Fixes #875.

* Add test for AsPyRef's lifetimes.
2020-04-20 18:44:31 +01:00
kngwyu 2cd466dc46 Bound 'py lifetime by GILPool when it's possible 2020-04-12 23:55:23 +09:00
Yuji Kanagawa 3b17ab0529 Apply suggestions from code review
Co-Authored-By: Georg Brandl <georg@python.org>
2020-03-23 13:18:38 +09:00
kngwyu 9b5ea3f46b More ergonomic error messages for invalid #[pyclass] args 2020-03-22 17:13:02 +09:00
kngwyu cea707dd1c Inhibit positional args after * 2020-03-06 14:01:27 +09:00
kngwyu 2fd2185052 Merge branch 'master' into pycell 2020-02-17 00:07:15 +09:00
kngwyu 8f8b42591a Fix PySelf and AsPyRef 2020-02-16 23:54:55 +09:00
David Hewitt cea8a9a2b0 Refactor to clean up property descriptor macros 2020-02-08 18:57:30 +00:00
David Hewitt fdf407e045 FromPyObject for #[pyclass] with T: Clone 2020-01-24 08:57:28 +00:00
David Hewitt b245e71c14 Address comments from PR#692 2019-12-18 14:26:25 +00:00
David Hewitt 4b18830f1e Add `#[name]` attribute support for `#[pyfunction]` 2019-12-17 22:14:28 +00:00
David Hewitt 7702395b3d Add #[name = "foo"] attribute to #[pymethods] 2019-12-17 17:45:53 +00:00
kngwyu 1c0ffdd443 Update UI test 2019-09-23 19:26:34 +09:00
kngwyu 41f31e85fd Replace mashup with paste 2019-08-04 23:50:10 +09:00
kngwyu a6438ebb10 Handle a corner case in which a getter takes multiple Python 2019-07-14 14:35:50 +09:00
kngwyu 721e746585 Allow py: Python as an argument of getter 2019-07-12 23:41:13 +09:00
kngwyu 35f5301675 Reject generics explicitly for #[pyclass] 2019-06-05 18:46:17 +09:00