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
roblabla
d479b54b94
Fix #1285 , text_signature and raw ident interaction
2020-11-19 17:21:02 +00:00
David Hewitt
8a8c098a2e
rust-1.48: fix tests and warnings
2020-11-19 12:49:29 +00:00
David Hewitt
45599620b5
pyerr: improve debug & display impls
2020-11-15 16:22:45 +00:00
David Hewitt
9617edfca9
msrv: bump to 1.45
2020-11-12 11:33:08 +00:00
Alex Gaynor
90a825d0c2
Merge branch 'master' into abi3-merge-master
2020-10-19 14:32:49 -04:00
David Hewitt
afd9b823d2
Drop support for Python 3.5
2020-10-18 19:02:27 +01:00
Alex Gaynor
ba6f0ecdfa
Merge branch 'master' into abi3-merge-master
2020-10-18 10:47:06 -04:00
Askaholic
6724783395
Change wording of PyDowncastError display implementation
...
Displays type(obj) instead of repr(obj) and uses `cannot` instead of
`can't`
to be more consistent with existing python error messages.
See discussion at #1212 .
2020-10-14 17:32:00 -08:00
Askaholic
19889bc6b9
Add argument name to TypeError messages caused during argument conversion
2020-10-14 17:32:00 -08:00
Askaholic
007bfb7ab0
Refactor py_expect_exception to also verify error string representation
2020-10-13 14:02:14 -08:00
Alex Gaynor
9e34835b76
Merge branch 'master' into abi3-merge-master
2020-10-12 18:03:14 -04:00
David Hewitt
7b3dd68bfb
Fix support for MSRV
...
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2020-10-12 15:46:40 +01: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
kngwyu
e7092fe630
Make PyCFunction more backward-compatible
2020-10-09 01:35:55 +09:00
kngwyu
b42886a38a
Change PyCFunction to take &'static str as a function name
2020-10-08 17:26:55 +09: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
Alex Gaynor
c22dd6c54c
Remove symbols not available in abi3
2020-09-23 22:30:07 -04:00
Yuji Kanagawa
e33e58fc72
Merge pull request #1201 from alex/abi3-text-signature
...
Hack __text_signature__ back to working with abi3
2020-09-20 16:46:04 +09:00
kngwyu
869a5e2f20
Fix an abi3 ui test for the latest Rustc
2020-09-20 15:33:55 +09:00
Alex Gaynor
9d8559158b
Hack __text_signature__ back to working with abi3
2020-09-19 11:43:57 -04: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
5bfb4674b1
Merge branch 'master' into abi3-merge-master
2020-09-10 17:01:13 -04:00
David Hewitt
151af7a0b7
Merge pull request #1115 from davidhewitt/std-py-err
...
Implement std::error::Error for PyErr
2020-09-10 21:17:11 +01:00
David Hewitt
b9e95dc7c9
Implement std::error::Error for PyErr
2020-09-10 19:04:24 +01:00
kngwyu
7a4c5e2960
Merge branch 'master' into abi3
2020-09-10 00:48:20 +09:00
Sebastian Pütz
22881a3c2f
Change add_function, ensure static docstrings.
...
Change add_function to take `&PyCFunction` instead of a wrapper
fn and ensure that dostrings of functions are `&'static str`.
2020-09-09 12:37:37 +02:00
Alex Gaynor
117f60bed0
Make PyType::name abi3 compatible
...
The implementation is more complex, because there's no equivalent to tp_name in the limited API
2020-09-08 12:22:59 -04:00
Sebastian Pütz
be877d133f
Add constructor for PyCFunction.
2020-09-08 14:26:08 +02:00
Sebastian Pütz
2e8010b5df
Add native Function native types.
...
Add bindings for PyCFunction, PyFunction, PyClassMethod and
PyStaticMethod.
2020-09-08 09:51:31 +02:00
Sebastian Pütz
64b06ea9ec
Change `add_submodule()` to take `&PyModule`.
...
The C-exported wrapper generated through `#[pymodule]` is only
required for the top-level module.
2020-09-05 15:54:57 +02: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
3214249010
Make python function wrapper creation fallible.
...
Wrapping a function can fail if we can't get the module name.
Based on suggestion by @kngwyu
2020-09-03 15:48:32 +02:00
Sebastian Pütz
5bbca1a052
Set the module of `#[pyfunction]`s.
...
Previously neither the module nor the name of the module of
pyfunctions were registered. This commit passes the module and
its name when creating a new pyfunction.
PyModule::add_function and PyModule::add_module have been added and are
set to replace `add_wrapped` in a future release. `add_wrapped` is kept
for compatibility reasons during the transition.
Depending on whether a `PyModule` or `Python` is the argument for the
Python function-wrapper, the module will be registered with the function.
2020-09-03 14:49:28 +02:00
Alex Gaynor
400462063d
Proof of concept of using PEP384s PyType_Spec
2020-09-02 16:54:39 -04:00
Yuji Kanagawa
729f2f42e7
Merge pull request #1065 from sebpuetz/union
...
FromPyObject derivation for structs and enums
2020-08-31 21:28:49 +09:00
Sebastian Pütz
0f32f886b8
More FromPyObject derive suggestions by @davidhewitt
2020-08-30 19:16:59 +02:00
David Hewitt
82cb815afa
Use IntoPy<PyObject> for PyModule::add
2020-08-30 16:24:20 +01: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
Sebastian Pütz
7781bb78de
Specify item key and attr name as arguments.
2020-08-30 10:22:01 +02:00
Sebastian Pütz
60fe4925f5
'#[derive(FromPyObject)]` changes suggested by @davidwhewitt.
2020-08-30 10:22:01 +02:00
Sebastian Pütz
7168309464
Derive FromPyObject
2020-08-30 10:22:01 +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
kngwyu
8cbfdd52b8
Simplify test cases where both __*__ and __r*__ are defined
2020-08-20 14:53:47 +09:00
kngwyu
71a7a76227
More tests for RHS
2020-08-20 14:33:47 +09:00