JRRudy1
934c663612
Added `From<Bound<'py, T>>` impl for `PyClassInitializer<T>`. ( #4214 )
...
* Added `From<Bound<'py, T>>` impl for PyClassInitializer<T>.
* Added newsfragment entry.
* Added tests for pyclass constructors returning `Py<Self>` and `Bound<Self>`.
* Fixed tests.
* Updated tests to properly cover the new impl.
---------
Co-authored-by: jrudolph <jrudolph@anl.gov>
2024-05-28 01:49:52 +00:00
Icxolu
70a7aa808d
deprecate the use of `PyCell` in favor of `Bound` and `Py` ( #3916 )
...
* deprecate the use of `PyCell` in favor of `Bound` and `Py`
* update `FromPyObject` for `T: PyClass + Clone` impl
* move `PyCell` deprecation to the `gil-refs` feature gate and add a migration note
2024-03-03 14:47:25 +00:00
David Hewitt
9e74c858c2
add `PyModule::new_bound` and `PyModule::import_bound` ( #3775 )
...
* add `PyModule::new` and `PyModule::import_bound`
* review: Icxolu feedback
2024-02-22 09:35:47 +00:00
Icxolu
61bc02d927
deprecate `PyCell::new` in favor of `Py::new` or `Bound::new` ( #3872 )
...
* deprecate `PyCell::new` in favor of `Py::new` or `Bound::new`
* update deprecation warning
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-20 07:45:47 +00:00
Icxolu
4ce9c35983
port `Python::get_type` to `Bound` API ( #3846 )
...
* port `Python::get_type` to `Bound` API
* fix `is_subclass_and_is_instance` FIXME
2024-02-18 18:27:19 +00:00
Icxolu
e45fbe493c
port `IntoPyDict` to `Bound` API
2024-02-10 15:47:26 +01:00
Icxolu
4d423b0c67
port `Python::run` to `Bound` API
2024-02-09 22:09:16 +01:00
David Hewitt
a15614844d
add PyErr::display
2023-07-24 22:14:55 +01:00
David Hewitt
45ff25cd2a
clippy: deny / fix used-underscope-binding lint
2023-07-16 20:49:45 +01:00
Alex Gaynor
0b78bb851e
Allow `#[new]` to return existing instances
...
fixes #2384
2023-07-02 19:57:53 -04:00
Georg Brandl
2a630a2a52
Fix being able to call arg-less `#[new]` with any args from Python
...
Fixes #2748
2022-11-20 08:25:19 +01:00
Georg Brandl
c489809938
Py/PyAny: deprecate cast_as() in favor of downcast()
...
They are (practically) identical on PyAny, and `downcast()` is the more
useful name.
2022-11-18 07:00:40 +01:00
mejrs
984fdf57c7
Use Python:;with_gil in tests
2022-07-19 19:34:23 +02:00
David Hewitt
6433d884fc
dev: remove self dev dependency
2021-12-08 07:48:58 +00: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
David Hewitt
fa8c93cfd1
pyclass #[new]: allow using custom error type
2020-12-13 23:50:03 +00:00
kngwyu
b70ee9a5ad
Use subclass correctly in tp_new
2020-06-22 01:38:13 +09:00
kngwyu
da4ed398bb
Fix PyCell to share BorrowFlag with parents
2020-02-15 18:13:39 +09:00
kngwyu
a6639076b9
Introduce PyInternalCaster
2019-12-14 23:16:39 +09:00
konstin
6cd07c369c
Simpler new and clippy fixes
2019-02-23 18:38:00 +01:00
konstin
ad590bd158
Some api improvements
2019-02-23 18:01:22 +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
dbaa2de061
Small improvements around function calling
2018-10-31 11:38:45 +01:00
konstin
302c099a76
Big refactoring to shrink the prelude
2018-09-21 23:34:28 +02:00
konstin
f58549f1d8
Get rid of a bunch of PyTokens
2018-09-02 23:33:45 +02:00
konstin
7c0379b13a
Remove many specialization uses
...
From over a hundret "default fn" uses down to 17
2018-08-25 20:48:17 +02:00
konstin
991a8b94d2
More nightly fixes
2018-08-19 20:42:17 +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
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
3e8a36b297
Split up test_class into multiple files
2018-05-02 20:56:11 +02:00