Commit graph

336 commits

Author SHA1 Message Date
David Hewitt afa5ed3ba2 Release notes for backported 0.12.4 2020-11-28 20:21:52 +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
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 5ac213fac4 derive-backend: fix clippy warning for strip_prefix 2020-11-19 11:37:59 +00:00
David Hewitt fbcf3eb1ac wrap_pyfunction: allow working on all crate functions 2020-11-15 21:34:41 +00:00
dvermd dcad61066d refactor pyproto internals 2020-11-13 22:15:58 +01:00
David Hewitt 9617edfca9 msrv: bump to 1.45 2020-11-12 11:33:08 +00:00
kngwyu 16ad3bf676 Use TypedSlot as internal representation of ffi::PyType_Slot 2020-10-27 00:43:26 +09:00
kngwyu 6627658127 Renew proc-macros for new #[pyproto] backend 2020-10-21 01:29:28 +09:00
Alex Gaynor 90a825d0c2 Merge branch 'master' into abi3-merge-master 2020-10-19 14:32:49 -04:00
Alex Gaynor 781bb9f602 Merge branch 'master' into abi3-merge-master 2020-10-18 17:28:02 -04:00
Alex Gaynor bb3b8122aa Make get_free_list API sound
Without having a Py (which ensures the GIL is held) multiple thraeds could call get_free_list concurrently.
2020-10-18 13:41:33 -04:00
David Hewitt 7ddcf45ec5 Fix lifetime soundness in freelist 2020-10-18 18:36:31 +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
Alex Gaynor 9e34835b76 Merge branch 'master' into abi3-merge-master 2020-10-12 18:03:14 -04:00
David Hewitt 38af32e33e Release 0.12.3 2020-10-12 16:18:25 +01:00
David Hewitt 1cecad884a Release 0.12.2 2020-10-12 12:56:46 +01: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 359d878fb6 Fix clippy warnings 2020-10-09 00:28:16 +09:00
kngwyu b42886a38a Change PyCFunction to take &'static str as a function name 2020-10-08 17:26:55 +09:00
kngwyu 41c2f5a748 Use &'static CStr for representing method names and docs 2020-10-08 17:26:55 +09:00
kngwyu ddfbee4b3c Add null-check for function's documents 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
David Hewitt c05815520c Release 0.12.1 2020-09-16 21:45:36 +01:00
Alex Gaynor ba1056006a Get all the tests building, everythign except doctests passes! 2020-09-16 08:42:22 -04:00
David Hewitt 32be8d9a3c Release 0.12 2020-09-12 14:13:45 +01: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
kngwyu c2f10e2185 Restructure protcol-table initialization 2020-09-06 01:50:39 +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 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 1f017b66fb Move py fn wrapper argument expansion to associated function.
Suggestion by @kngwyu.

Additionally replace some `expect` calls with error handling.
2020-09-03 15:21:33 +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
David Hewitt 74f981120d
Merge pull request #1146 from programmerjake/fix-snake-case-warning
Add #[allow(non_snake_case)] to function with generated name
2020-09-03 08:27:43 +01:00
Jacob Lifshay 7acf8d9f57 Add #[allow(non_snake_case)] to function with generated name
Fixes #1145
2020-09-02 20:32:51 -07:00
David Hewitt 3e86e4c247 Refactor proc_macro optional / python detection 2020-09-02 08:01:21 +01:00
David Hewitt c5065893dd
Merge pull request #1135 from sebpuetz/remove-duplicate-pool
Remove duplicate pool and py in py_init.
2020-09-01 20:47:04 +01:00
Sebastian Puetz 4e7fe6e638 Remove proc-macro panics. 2020-09-01 20:27:47 +02:00
Sebastian Puetz 74ecd15580 Remove duplicate pool and py in py_init. 2020-09-01 19:45:27 +02:00