Commit Graph

3419 Commits

Author SHA1 Message Date
David Hewitt 0cc77c77b2 benches: add bench_gil 2021-05-17 07:37:03 +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
Georg Brandl 1c557a52cd
Merge pull request #1611 from TheGhostHuCodes/fix-doc-typos
Fix typos in Architecture and Contributing docs
2021-05-17 07:06:20 +02:00
Yung-Jin (Joey) Hu edb3d0d03b Fix typos in Architecture and Contributing docs 2021-05-16 19:49:23 -07:00
David Hewitt c4b19c7e7c
Merge pull request #1604 from 1tgr/shrink
Improve compilation times for projects using PyO3
2021-05-16 07:18:33 +01:00
David Hewitt 85f1055db8
Merge pull request #1605 from goodbyekansas/cross-compile-wasm
Add support for cross compilation for wasm/wasi
2021-05-16 07:15:02 +01:00
David Hewitt c48e5b08ea
Merge pull request #1608 from alex/opt-no-args
Reduce function calling overhead by ~25% in ReferencePool::update_counts:
2021-05-15 21:11:08 +01:00
Alex Gaynor 56973d762b Reduce function calling overhead by ~25% in ReferencePool::update_counts:
1) Place both increfs and decrefs behind a single mutex, rather than two. Even uncontended mutexes aren't free to acquire.
2) Keep a dirty tracking bool to avoid acquiring any mutexes at all in the common case of no modifications (because everything happened with the GIL held)
2021-05-15 13:19:51 -04:00
Tim Robinson 50352f9137 Apply review suggestions 2021-05-15 10:34:34 +01:00
Simon Rainerson b0f7145f9c Add support for cross compilation for wasm/wasi
When using rust after this commit
1a491e2304
the target family for wasm targets is now set to "wasm". Also fix the
assumption that OsStrExt lives inside std::os::unix for all non-windows
targets.
2021-05-14 14:38:28 +02:00
Tim Robinson 735a9a1156 Update for_each_proto_slot for consistency 2021-05-13 17:32:59 +01:00
Tim Robinson c803033f5e Add to CHANGELOG 2021-05-13 13:17:56 +01:00
Tim Robinson c3b935f06c Reduce size of compiled code for class initialization 2021-05-13 13:08:58 +01:00
Tim Robinson 95636f1ba7 Reduce size of compiled code for methods 2021-05-13 13:06:38 +01:00
Tim Robinson 32dc93e389 Shorten typical argument extraction checks 2021-05-13 13:06:38 +01:00
mejrs 1ae3d87973
More docs+examples (freelist, pyany, pymodule, puthon::check_signals) (#1600)
* expanded freelist docs

* added check_signals doc example

* added doc examples for pyany methods

* doc examples for pymodule + deprecate add_wrapped

* fixed tabs+whitespace...

* stronger wording on running signal handler code

Co-authored-by: Georg Brandl <georg@python.org>

* fix keyboardinterrupt spelling

Co-authored-by: Georg Brandl <georg@python.org>

* remove semicolon

Co-authored-by: Georg Brandl <georg@python.org>

* add space

Co-authored-by: Georg Brandl <georg@python.org>

* add space

Co-authored-by: Georg Brandl <georg@python.org>

* added suggested changes

* fixed doctest

* fixed triple backslash

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>

* spacing inside struct

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>

* use ? rather than unwrap in doc examples

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>

* remove use of "we", "us", "you" from docs

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>

* add that freelist shouldnt be impl'd by users

* added suggested changes

Co-authored-by: Georg Brandl <georg@python.org>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-05-12 07:32:46 +01:00
David Hewitt cc68f4a021
Merge pull request #1567 from davidhewitt/attribute-tidy
macros: support `#[pyo3(name = "...")]` in pyfunction
2021-05-11 08:14:56 +01:00
David Hewitt 70f9d198e5 docs: add docs for `#[pyo3(name = "...")]` 2021-05-07 22:43:57 +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 eb251a2f22
Merge pull request #1599 from PyO3/davidhewitt-patch-1-1
guide: update CI job names
2021-05-07 22:28:18 +01:00
David Hewitt 926b2a7325 guide: update CI job names 2021-05-07 08:30:49 +01:00
messense 272d014518
Merge pull request #1598 from davidhewitt/rust-1.52
rust: updates for rust 1.52
2021-05-07 09:01:38 +08:00
David Hewitt defd09c166 rust: updates for rust 1.52 2021-05-06 23:18:34 +01:00
David Hewitt 4edc7c6dc5
Merge pull request #1597 from m-ou-se/wrap-pyfunction-as-closure
Expand wrap_pyfunction!() to a closure to improve deduction.
2021-05-06 22:57:55 +01:00
Mara Bos d33c5010c7 Add test for wrap_pyfunction!() deduction. 2021-05-06 16:05:17 +02:00
Mara Bos 5289ce0eda Expand wrap_pyfunction!() to a closure.
The change to wrap_pyfunction!() in #1143 makes it impossible to
implement `context.add_wrapped(wrap_pyfunction!(something))` in
`inline-python`.
`context` does not carry the GIL lifetime, which causes type deduction
trouble now that `wrap_pyfunction` results in a generic function.

```
error[E0308]: mismatched types
  --> examples/rust-fn.rs:12:4
   |
12 |     c.add_wrapped(wrap_pyfunction!(rust_print));
   |       ^^^^^^^^^^^ one type is more general than the other
   |
   = note: expected enum `Result<&pyo3::types::PyCFunction, _>`
              found enum `Result<&pyo3::types::PyCFunction, _>`
```

By re-wrapping the function as a closure, we trigger 'closure signature
deduction' when passing `wrap_pyfunction!()` as an argument to a
function: Rustc will deduce the signature of the closure from the
function that closure is passed to. This way, the generic arguments can
be deduced in more contexts, fixing the problem.
2021-05-06 16:03:05 +02:00
messense dfee3474f8
Merge pull request #1590 from mejrs/docsrs
docsrs feature
2021-05-05 20:42:49 +08:00
messense 136b7d400f Also run gh-pages deploy on release 2021-05-05 16:39:46 +08:00
messense 8a89d04ee9 Remove docs job from CI workflow 2021-05-05 16:35:18 +08:00
messense 3402e72427 Run guide workflow on pull request 2021-05-05 11:27:12 +08:00
messense 620c2730f5 Build docs of main branch with docsrs feature 2021-05-05 11:26:34 +08:00
David Hewitt 350e7b2be7
Merge pull request #1591 from davidhewitt/inherit-exceptions
pyclass: support extending Exception types
2021-05-04 23:04:10 +01:00
mejrs dd26566d0c added package.metadata.docs.rs information 2021-05-04 23:25:09 +02:00
David Hewitt d81abe8344 pyclass: support extending Exception types 2021-05-04 22:00:22 +01:00
David Hewitt 7536554ceb type_object: remove layout and base type from PyTypeInfo 2021-05-04 21:39:42 +01:00
mejrs ce03fb4e71 fixed whitespace 2021-05-04 12:38:22 +02:00
mejrs 5f51520559
Merge branch 'main' into docsrs 2021-05-04 12:34:38 +02:00
mejrs 40dd618c46 added doc alias for intopy 2021-05-03 20:31:53 +02:00
mejrs 4c3cbcdde2 impl docsrs for lib.rs 2021-05-03 20:04:13 +02:00
mejrs d11de0e15d impl docsrs for gil 2021-05-03 20:03:56 +02:00
mejrs f4b11f61d5 impl docs for conversions 2021-05-03 20:03:41 +02:00
mejrs 624921a83e impl docsrs in /types 2021-05-03 20:03:27 +02:00
mejrs 9a74c7fc65 impl docsrs in mod.rs 2021-05-03 20:03:03 +02:00
mejrs 1c740ecbdc
Update .github/workflows/ci.yml
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-05-03 19:50:19 +02:00
David Hewitt 05db24ce33
Merge pull request #1594 from davidhewitt/nowrap
docs: use white-space style instead of &nbsp; blob
2021-05-03 18:15:44 +01:00
David Hewitt 20e10b3693
Merge pull request #1592 from davidhewitt/tidy-types-macros
types: clean up types macros
2021-05-03 17:35:59 +01:00
David Hewitt ea9cf5b58a docs: use white-space style instead of &nbsp; blob 2021-05-03 16:38:57 +01:00
David Hewitt 81ad5b3544
Merge pull request #1585 from mejrs/proc_macro_docs
Proc macro documentation
2021-05-03 16:33:44 +01:00