Commit graph

153 commits

Author SHA1 Message Date
David Hewitt adf6bdba8e release: 0.14.0 2021-07-03 08:37:00 +01:00
mejrs c07c5a4c93 Add full path for PyCell 2021-07-03 07:51:18 +01:00
David Hewitt 542a6124b1
Merge pull request #1696 from scalexm/unwrap
Unwrap `syn::*::Group` in a few places
2021-06-29 22:12:49 +01:00
David Hewitt 8fb4ce6fbc pyo3-build-config: fix cross compilation 2021-06-26 14:19:03 +01:00
scalexm 20fa398fdb Unwrap syn::*::Group in a few places 2021-06-25 00:12:38 +02:00
scalexm 53773d5484 Use explicit lifetimes in proc-macro expansion 2021-06-25 00:02:21 +02:00
David Hewitt 67948a24f7 while let unwrap_group 2021-06-24 09:11:27 +01:00
Giles Cope aaad7ffd63 Need to be able to create structs via macro_rules
(Currently only possible using tt escape type.)
2021-06-24 08:40:49 +01:00
David Hewitt f916867375 pyclass: refactor initialization, call native type dealloc 2021-06-23 07:45:51 +01:00
R2D2 ec40446fa3 Removed stray newline character from error message 2021-06-09 14:23:16 +02:00
R2D2 e6da1ebc73 Fixed formatting of error messages and tests 2021-06-09 11:40:14 +02:00
David Hewitt b081e37de5
Merge pull request #1665 from PyO3/kwds_varargs
Argument parsing: use VARARGS for *any* function taking **kwds
2021-06-07 23:23:05 +01:00
R2D2 35060f4693 Removed unused custom keyword in macros 2021-06-07 11:50:15 +02:00
R2D2 0b3fbb5533 Fixed formatting 2021-06-07 10:26:58 +02:00
R2D2 973f0a5bae Removed the custom error messages from the macro api 2021-06-07 10:18:38 +02:00
Georg Brandl b60a56d9fd Reorganize method wrapper generation
Remove unneded splitting of functions in two, and reorder the
functions to order of the main match {} in gen_py_method().
2021-06-07 07:33:28 +02:00
Georg Brandl f12c1a4005 Argument parsing: use VARARGS for *any* function taking **kwds 2021-06-06 15:58:19 +02:00
David Hewitt 18e0aa17e0 pymodule: accept #[pyo3(name = "...")] option 2021-06-06 08:41:20 +01:00
Georg Brandl bd6788b2fa Argument parsing: optimize the f(*args, **kwds) case.
Use the VARARGS calling convention and just pass through the two objects.
2021-06-06 07:48:38 +02:00
Georg Brandl c670c57ddb Refactor PyMethodDef creation too. 2021-06-06 07:07:48 +02:00
Georg Brandl a8d2649032 Refactor wrapper generation, and enable fastcall for static/class methods. 2021-06-06 07:07:46 +02:00
David Hewitt 9b8b133905 pyfunction: document #[pyo3(pass_module)] 2021-06-05 17:36:50 +01:00
David Hewitt cec4c2d2e9 text_signature: move to #[pyo3(text_signature = "...")] 2021-06-05 16:33:03 +01:00
Georg Brandl 3e8d003faf Implement METH_FASTCALL for pyfunctions and pymethods. 2021-06-05 12:57:22 +02:00
David Hewitt d011467e63 pyclass: allow #[pyo3(get, set, name = "foo")] 2021-06-04 11:30:40 +01:00
R2D2 416b1132b4 Added custom error messages to enum fields and container types. Covered with tests. Fixed formatting and linting issues 2021-06-01 22:44:16 +02:00
R2D2 1a8fec2e88 Added detailed TypeError messages to enums with derive(FromPyOjbect) 2021-05-31 17:38:15 +02:00
R2D2 4a99bfaaba Fixed tests after modifying TypeErrors originating from structs. Started work on TypeError message on Enums 2021-05-31 00:28:53 +02:00
Tim Robinson 1ba32178dd Method and slot visitors accept slices instead of individual items 2021-05-29 09:38:15 +01:00
Tim Robinson 030aa43544 Simplify code generated for for_each_method_def and for_each_proto_slot 2021-05-29 09:10:38 +01:00
R2D2 1843ff20fd Added support for enhanced errors for the FromPyObject trait derived on tuples and newtype structs/tuples 2021-05-28 00:38:32 +02:00
R2D2 8981b84b79 Added customizable conversion error message for type errors encounted in FromPyObject::extract 2021-05-28 00:24:47 +02:00
R2D2 d71d4329ae Changed format of TypeError messages 2021-05-27 22:36:19 +02:00
R2D2 f68ab481ba Added improved error messages to the derive FromPyObject macro for basic structs and enums 2021-05-27 15:42:57 +02:00
messense 5523ad6d5b
Merge pull request #1633 from davidhewitt/async-fn-error
pyfunction: better error message with `async fn`
2021-05-26 14:33:52 +08:00
David Hewitt 9f74336bc9 pyfunction: better error message with async fn 2021-05-25 11:32:52 +01:00
David Hewitt 355bd0c336 pymodule: tidy up module init 2021-05-25 10:54:16 +01:00
David Hewitt 9a4e7b5877
Merge pull request #1622 from davidhewitt/pyo3-build-config
pyo3-build-config: new crate to re-use build.rs across crates
2021-05-25 07:11:24 +01:00
David Hewitt 284ad1f98a pyo3-build-config: fix build 2021-05-21 23:05:36 +01:00
David Hewitt 825ec08681 pyo3-build-config: docs wip 2021-05-21 08:34:51 +01:00
David Hewitt 79c7149d52 pyo3-build-config: new crate to re-use build.rs across crates 2021-05-20 09:03:33 +01:00
David Hewitt a109640850 pyfn: deprecate name argument 2021-05-20 08:54:29 +01:00
Georg Brandl f6e4399f26 pyfunction: use METH_NOARGS for no-argument functions
As suggested in #1607.

If I ran the benchmarks correctly, this shaves only about 5ns from
the noargs case.  But since it's relatively easy to do...
2021-05-17 07:53:24 +02:00
Tim Robinson 735a9a1156 Update for_each_proto_slot for consistency 2021-05-13 17:32:59 +01:00
Tim Robinson c3b935f06c Reduce size of compiled code for class initialization 2021-05-13 13:08:58 +01:00
Tim Robinson 32dc93e389 Shorten typical argument extraction checks 2021-05-13 13:06:38 +01:00
David Hewitt 48e98818cf [review] kngwyu 2021-05-07 22:35:52 +01:00
David Hewitt 4d46abde73 macros: support #[pyo3(name = "...")] 2021-05-07 22:35:52 +01:00
David Hewitt 4613b3dd7e
Merge pull request #1596 from davidhewitt/remove-pytypeinfo-layout
type_object: remove layout and base type from PyTypeInfo
2021-05-07 22:32:24 +01:00
David Hewitt 7536554ceb type_object: remove layout and base type from PyTypeInfo 2021-05-04 21:39:42 +01:00
mejrs 78c2d40cb8 install doc_cfg feature and workflow 2021-05-02 21:10:53 +02:00
David Hewitt 48823e22d6 pyproto: deprecate py_methods 2021-04-20 00:21:19 +01:00
David Hewitt ce851ad7d9 1506: fixes to macro hygiene 2021-03-28 11:01:51 +01:00
David Hewitt 246335bee2
Merge pull request #1505 from scalexm/macro
Ignore `syn::Type::Group` in `is_python`
2021-03-20 11:09:04 +00:00
Yuji Kanagawa f0763f069e
Merge pull request #1507 from scalexm/getter-name
Allow `#[name]` with `#[getter]` and `#[setter]`
2021-03-20 16:23:07 +09:00
messense 2cec240b0e Ban pyo3(get, set) on tuple struct field 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
scalexm b27ee3fd64 Allow #[name] with #[getter] and #[setter] 2021-03-18 19:35:17 +01:00
scalexm adc6e6fe4e Ignore syn::Type::Group in is_python 2021-03-18 18:56:53 +01:00
Yuji Kanagawa 6137e3a726
Merge pull request #1456 from davidhewitt/pyclass-impl-flags
pyclass: move flags to PyClassImpl
2021-03-17 12:50:49 +09:00
David Hewitt dab62a5835
Merge pull request #1495 from davidhewitt/macros-wrapper-expressions
macros-backend: make __wrap fns expressions
2021-03-16 07:26:15 +00:00
messense e6374240b1 Get rid of _LOCATION 2021-03-15 16:47:25 +08:00
messense 10339ea61f Add () inside of FunctionDescription::full_name()
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-03-15 16:20:55 +08:00
messense c70eba1aaa Fix wrong class name in function call error message 2021-03-15 14:24:19 +08:00
David Hewitt 3891788aa7 macros-backend: make __wrap fns expressions 2021-03-14 17:21:57 +00:00
David Hewitt d9fe404d69 [review] kngwyu 2021-03-14 00:50:59 +00:00
David Hewitt 66b3022d0e
Merge pull request #1483 from davidhewitt/macros-tidy-ups
pymethods: macros tidy-ups
2021-03-14 00:09:23 +00:00
David Hewitt 31c7af2ac7 pyclass: move flags to PyClassImpl 2021-03-13 22:44:53 +00:00
David Hewitt e55fe205ed msrv: remove use of matches! macro 2021-03-12 07:28:49 +00:00
David Hewitt 9613228a0c pyfunction: reject generic functions 2021-03-09 23:47:47 +00:00
David Hewitt 78080ebbd2 macros-backend: support noargs for pyproto py_methods 2021-03-08 23:56:08 +00:00
David Hewitt abe19e2ecc macros-backend: flatten call structure 2021-03-08 23:07:12 +00:00
David Hewitt 977735db20 pymethods: make inventory optional 2021-03-04 19:52:58 +00:00
Yuji Kanagawa 21b26fcf3a
Merge pull request #1440 from davidhewitt/fix-multiple-kw-only-arg
pyfunction: refactor argument extraction
2021-03-04 00:15:34 +09:00
David Hewitt fe74160a7d pyo3_benchmarks: benchmarks as separate Python example 2021-03-01 19:12:39 +00:00
David Hewitt 29a525b327 pyfunction: refactor argument extraction 2021-03-01 17:49:46 +00:00
David Hewitt ffd5874c3a pyfunction: fix args conflicting with keyword only arg 2021-03-01 17:49:46 +00:00
konstin d668ff2ad5 Use Self instead of #cls 2021-03-01 12:42:27 +01:00
konstin f97c3a9479 Convert callback_body_without_convert function to handle_panic function 2021-03-01 12:42:19 +01:00
David Hewitt 1aa1e91ce6 pycfunction: take &'static str arguments to new
Co-authored-by: messense <messense@icloud.com>
2021-02-27 09:33:15 +00:00
David Hewitt c4bd9335fc
Merge pull request #1446 from davidhewitt/no-pyproto-inventory
pyproto: don't use inventory for methods
2021-02-26 09:09:23 +00:00
David Hewitt aa2855b6a0 pyproto: don't use inventory for methods 2021-02-25 00:17:22 +00:00
David Hewitt d9fc4d783c
defs: remove dead __unicode__ def 2021-02-25 00:11:14 +00:00
Daniil Konovalenko 554cffd60d
add #[pyo3(from_py_with="...")] attribute (#1411)
* allow from_py_with inside #[derive(FromPyObject)]
* split up FnSpec::parse
2021-02-21 00:15:20 +09:00
David Hewitt 1e134aa0de pyclass-impl: use impl Trait arguments
Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2021-02-19 07:45:14 +00:00
David Hewitt 7b99e391fa pyclass-impl: merge implementation traits 2021-02-18 08:19:07 +00:00
David Hewitt 190eb72803 release: 0.13.2 2021-02-12 21:34:29 +00:00
David Hewitt b2675b11fe rust 1.50: clippy and lint fixes 2021-02-11 22:03:34 +00:00
Georg Brandl fa8d7518ca Restore compatibility with Rust 1.41.
This version is currently supported by Debian stable and Alpine Linux.

Fixes #1420
2021-02-11 10:14:25 +01:00
David Hewitt d10708abbf pyproto: small refactoring to backend macro 2021-01-15 00:21:16 +00:00
David Hewitt 9807ef8ed4 macros-backend: fix raw idents in pymethods 2021-01-12 22:01:11 +00:00
David Hewitt 0729fb1e03
Merge pull request #1374 from davidhewitt/macros-error-handling
macros-backend: improve error handling ergonomics
2021-01-12 08:05:30 +00:00
David Hewitt d2e87d95f3 release: 0.13.1 2021-01-10 12:20:10 +00:00
David Hewitt 88872eba4f macros-backend: improve error handling ergonomics 2021-01-10 10:25:43 +00:00
Yuji Kanagawa 4562de7bd9
Merge branch 'master' into osraw 2021-01-07 17:06:03 +09:00
Dexter Chua 005b0aa798 Prefer to use std::os::raw type definitions
Certain types e.g. c_char are provided by both std::os::raw and libc.
Previously, both are used interchangably. This commit changes all
instances to use std::os::raw, which is slightly more portable, since
libc is not implemented for all targets (e.g. wasm32-unknown-unknown).
2021-01-07 15:34:47 +08:00
kngwyu 05f32a2007 Replace edition2015-style paths 2021-01-07 13:32:17 +09:00
David Hewitt b1012ebb68 build: update for Rust 1.49 2020-12-31 18:16:02 +00:00
David Hewitt 26ca1f5bca Release 0.13 2020-12-22 15:42:04 +00:00
David Hewitt 9e7fa408d4 pyproto: use buffer slots on Python 3.9 and up 2020-12-22 13:33:42 +00:00