Commit Graph

29 Commits

Author SHA1 Message Date
Gregory Szorc 410c9f13c9 macros: raise AttributeError on property deletion requests
The setter function will receive a NULL value on deletion requests.
This wasn't properly handled before, leading to a panic.

The new code raises AttributeError in this scenario instead.

A test for the behavior has been added. Documentation has also
been updated to reflect the behavior.
2021-08-13 21:01:00 -07:00
messense 1c57294214 Use Python::with_gil and py_assert
Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2021-03-19 10:17:06 +08:00
messense 773a371ba5 Add tuple and unit struct support for pyclass macro 2021-03-19 10:17:06 +08:00
kngwyu 9b88a452e2 Refactor tests to use shorter macros 2021-03-14 23:43:53 +09:00
David Hewitt b2675b11fe rust 1.50: clippy and lint fixes 2021-02-11 22:03:34 +00:00
David Hewitt e140b729fc Allow #[getter] and #[setter] functions to take PyRef 2020-06-27 14:55:22 +01:00
kngwyu b86de9376d Introduce PyClassInitializer 2019-12-15 21:04:36 +09:00
kngwyu 721e746585 Allow py: Python as an argument of getter 2019-07-12 23:41:13 +09:00
kngwyu 0f9a3b1194 Expose py_run macro 2019-06-13 18:18:06 +09:00
Georg Brandl 117f6eb47d Allow omitting PyResult wrapping in property get/set methods
fixes #443
2019-04-17 22:29:12 +02:00
Martin Larralde 51be6a60fe Run `cargo fmt` on `pyo3-derive-backend` and `tests` 2019-04-14 01:50:00 +02:00
Martin Larralde 3f4f068c7f Ensure `#[getter]` doc is exposed as the `__doc__` of the descriptor 2019-04-14 00:23:59 +02:00
konstin d02f7c3aa5 Big proc macro refactoring
* Removed a lot of clutter, unified some code
 * Started using syn::parse::Parse for pyfunction attributes 
 * No more newlines between imports
 * Renamed `#[prop(get, set)]` to `#[pyo3(get, set)]`
 * `#[pyfunction]` now supports the same arguments as `#[pyfn()]`
 * Some macros now emit proper spanned errors instead of panics.
2019-02-18 20:07:56 +01:00
konstin 6cb098ee12 Replace py.init_[ref|mut] with Py[Ref|Mut]::new 2019-02-13 21:52:21 +01:00
konstin 1a489d2829 Make the init methods use a value instead of a function 2019-02-13 13:59:47 +01:00
konstin 9e53418aad Less feature(specialization) 2019-02-01 18:09:51 +01:00
konstin 936f0153e8 Migrate to rust 2018 2019-02-01 14:23:29 +01:00
konstin 57afb51604 Remove PyToken completely; Fixes #94 2018-11-12 14:42:21 +01:00
konstin fb2349b6ec Remove PyToken usages from tests 2018-11-12 14:41:29 +01:00
konstin 3a95d163ca New rustfmt version
You might need to upgrade to the latest nightly to get the same results
2018-09-28 23:34:57 +02:00
konstin 991a8b94d2 More nightly fixes 2018-08-19 20:42:17 +02:00
konstin fe8a719ee1 Rustfmt all the things ✔️ 2018-07-30 23:05:10 +02:00
konstin d59bebcc38 Upgrade from proc_macro to use_extern_macros 2018-07-18 13:08:05 +02:00
konstin 4013d40897 Add `py` prefix to the proc macros and move them into the root module
This is important because `proc_macro_path_invoc` isn't going to be stabilized soon.
2018-07-08 23:33:48 +02:00
konstin 562d417517 Fix bug which made code generation dependend on argument ordering 2018-07-06 12:56:40 +02:00
konstin 6645708e4f Get rid of #[py*] methods 2018-07-03 20:42:02 +02:00
konstin 80096ae143 rudtfmt the tests
With some careful refactoring alongside
2018-06-15 21:21:12 +02:00
konstin 60d1565a8f Always clone on in getters
Since copy implies clone, this doesn't  code.
2018-06-12 17:47:24 +02:00
konstin 3e8a36b297 Split up test_class into multiple files 2018-05-02 20:56:11 +02:00