David Hewitt
00ddd21535
change PyModule::add_class to return an error if class creation fails
2023-02-14 22:08:35 +00:00
Georg Brandl
99c8dea30e
Use Python::get_type() instead of PyTypeInfo::type_object()
...
The former needs one less import and uses a familiar object.
2022-11-20 15:16:18 +01: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
mejrs
984fdf57c7
Use Python:;with_gil in tests
2022-07-19 19:34:23 +02:00
David Hewitt
cdf86482d8
ffi: many fixes to pypy definitions
2022-06-04 12:47:40 +01:00
David Hewitt
7e2d3117ce
cleanup: deprecate PyTypeObject trait
2022-04-23 13:36:32 +01:00
David Hewitt
6433d884fc
dev: remove self dev dependency
2021-12-08 07:48:58 +00:00
Georg Brandl
43893158b1
switch is_instance/is_instance_of, is_subclass/is_subclass_of
2021-11-20 13:18:43 +00:00
Georg Brandl
a83c31a3af
add PyType::is_subclass_of and PyAny::is_instance_of
...
which get the type to check against as an arguments,
as opposed to a compile-time generic type.
2021-11-20 13:16:15 +00:00
David Hewitt
f916867375
pyclass: refactor initialization, call native type dealloc
2021-06-23 07:45:51 +01:00
David Hewitt
d011467e63
pyclass: allow #[pyo3(get, set, name = "foo")]
2021-06-04 11:30:40 +01:00
David Hewitt
d81abe8344
pyclass: support extending Exception types
2021-05-04 22:00:22 +01:00
David Hewitt
b92441cd7c
pyclass: fix reference count issue in subclass new
2021-01-08 00:13:49 +00:00
David Hewitt
45599620b5
pyerr: improve debug & display impls
2020-11-15 16:22:45 +00:00
kngwyu
7644d67ad8
Inhibit subclassing native types with ABI3 set
2020-09-20 00:42:55 +09:00
Alex Gaynor
ba1056006a
Get all the tests building, everythign except doctests passes!
2020-09-16 08:42:22 -04:00
Alex Gaynor
400462063d
Proof of concept of using PEP384s PyType_Spec
2020-09-02 16:54:39 -04:00
David Hewitt
4ed9748b45
Rename exceptions to PyException etc; reintroduce deprecated ones
2020-07-18 06:02:57 +01:00
David Hewitt
a7e0c6bfa7
Make exceptions proper native types.
2020-07-18 01:57:39 +01:00
kngwyu
02ee7a5afc
Expose PyAny to lib.rs and prelude
2020-03-18 13:38:18 +09:00
kngwyu
1f5cb83ef8
Add tests for mutability checking
2020-02-18 15:28:04 +09:00
kngwyu
8f8b42591a
Fix PySelf and AsPyRef
2020-02-16 23:54:55 +09:00
kngwyu
a2408cacbb
Rename PyClassShell with PyCell
2020-02-08 15:05:13 +09:00
Alexander Niederbühl
0a84c201f7
Revert "Disable segfaulty subclassing by default"
...
This reverts commit 5096f936dc
.
2020-01-12 01:22:32 +01:00
kngwyu
c57177a169
Refine tests and documents around pyclass.rs
2020-01-08 22:44:50 +09:00
kngwyu
b602b4bf6c
Enhance documentation and tests around #[new]
2020-01-07 12:49:36 +09:00
kngwyu
18e565fab5
New PyClassInitializer
2020-01-05 16:01:05 +09:00
kngwyu
ea51756933
Resolve some clippy complains
2019-12-23 18:05:06 +09:00
kngwyu
e2dc843de5
Fix a corner case for PyClassInitializer
2019-12-22 23:54:41 +09:00
kngwyu
6b84401126
Make it enable to safely inherit native types
2019-12-21 23:28:55 +09:00
kngwyu
b86de9376d
Introduce PyClassInitializer
2019-12-15 21:04:36 +09:00
kngwyu
a6639076b9
Introduce PyInternalCaster
2019-12-14 23:16:39 +09:00
konstin
5096f936dc
Disable segfaulty subclassing by default
...
See https://github.com/PyO3/pyo3/issues/220 and https://github.com/PyO3/pyo3/issues/407 for details on those segfaults
2019-08-05 11:52:47 +02:00
kngwyu
0f9a3b1194
Expose py_run macro
2019-06-13 18:18:06 +09:00
Miles Granger
711155d7ad
Update tests & docs with IntoPyDict::into_py_dict(py)
2019-03-20 20:04:00 +01: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
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
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
302c099a76
Big refactoring to shrink the prelude
2018-09-21 23:34:28 +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
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
dbd74401eb
Rename the base
option in the pyclass
macro to extends
...
"extends" is intuitive for people with java or ES6 experience, and it also aligns pyo3 with
wasm-bindgen (see https://github.com/rustwasm/rfcs/pull/2 )
2018-07-15 12:08:20 +02:00