Commit Graph

687 Commits

Author SHA1 Message Date
bors[bot] a0e285b497
Merge #3066 #3098
3066: Improve default value for `None` in `text_signature` r=davidhewitt a=messense

xref #2863

3098: readme: add new pyo3 article r=adamreichold a=davidhewitt

With thanks to `@ohadravid` for the great piece!

Co-authored-by: messense <messense@icloud.com>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-04-12 07:40:50 +00:00
David Hewitt 80d95f9134 docs: fix migration guide entry for pyproto 2023-04-11 21:23:05 +01:00
Adam Reichold 48f79718f9 Fix redundant imports in doc tests thereby fixing the careful CI job. 2023-04-10 08:09:06 +02:00
Will Jones 52a0378e56 docs: show pattern for self.__class__.__name__ in __repr__
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
2023-03-30 10:59:41 +02:00
messense 57dbc94293
Improve default value for `None` in `text_signature` 2023-03-29 10:14:44 +08:00
bors[bot] ebedcfb8b2
Merge #3050
3050: Improve default values for str, numbers and bool in `text_signature` r=davidhewitt a=messense

xref #2863

Co-authored-by: messense <messense@icloud.com>
2023-03-25 07:07:06 +00:00
bors[bot] e5e8c7a6d0
Merge #2975 #3022 #3023
2975: RFC: Add GILProtected synchronization primitive and use it for LazyTypeObjectInner. r=davidhewitt a=adamreichold

I would also like to use that type in rust-numpy and it seems we can avoid ~~both a manual unsafe impl and~~ a full blown mutex if we apply it to `LazyTypeObjectInner`.

One downside might be that it ties us closer to the GIL when we want to enable nogil experimentation, but on the other hand, it may also help by reifying the GIL usage. (This is currently limited to comments in unsafe code in rust-numpy for example.)

3022: Fix function name shadowing r=davidhewitt a=mejrs

Fixes https://github.com/PyO3/pyo3/issues/3017

3023: Emit a better error for bad argument names r=davidhewitt a=mejrs

This will emit a better error for code like 
```rust
#[pyfunction]
fn output([a,b,c]: [u8;3]) {}
```



Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
Co-authored-by: mejrs <59372212+mejrs@users.noreply.github.com>
2023-03-23 08:04:11 +00:00
messense 79a70f3923
Improve default values for str, numbers and bool in `text_signature` 2023-03-16 11:06:51 +08:00
Adrian Garcia Badaracco 626a67ca49 Add note about garbage collection on PyPy 2023-03-12 23:35:47 +00:00
Antoine Romero-Romero a629e8267a feat: add #[pyo3(get, set)] for Cell 2023-03-09 23:09:30 +00:00
bors[bot] 410bb15d71
Merge #2982
2982: explain STATUS_DLL_NOT_FOUND r=adamreichold a=mejrs

I had someone ask me this today, and googling for it I found various other places where this was asked, with no (good) answers. 

Co-authored-by: mejrs <59372212+mejrs@users.noreply.github.com>
2023-02-24 17:13:38 +00:00
mejrs db16580b63 Make changes 2023-02-23 12:36:54 +01:00
Adam Reichold 9534749d8b Add GILProtected synchronization primitive replacement and use it for LazyTypeObjectInner. 2023-02-23 09:38:02 +01:00
mejrs 90ce52175f explain STATUS_DLL_NOT_FOUND 2023-02-22 23:30:19 +01:00
Adam Reichold a16f2e45c8 Include conversions for bytes, bytearrays and Cow<[u8]> in the guide. 2023-02-22 22:07:59 +01:00
Azat Ibrakov 9f7368922f docs: fix typo in method name 2023-02-18 22:02:05 +01:00
David Hewitt c7cc48f8e4 use PyO3 types within LazyTypeObject 2023-02-18 09:06:36 +00:00
David Hewitt 00ddd21535 change PyModule::add_class to return an error if class creation fails 2023-02-14 22:08:35 +00:00
David Hewitt dbeb3b4453 move some private internals out of public implementation 2023-02-11 21:28:27 +00:00
bors[bot] 9e5c845dee
Merge #2934
2934: guide: add documentation for trailing option arguments r=davidhewitt a=davidhewitt

Following the increased clarity around PyO3's handling of function signatures of 0.18.0, I wanted to add a section to the guide documenting the default-to-none behaviour for trailing `Option<T>` arguments.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-02-07 08:15:57 +00:00
Jeff Hodges bc1a33f9fe
bump maturin version in getting_started.md
Latest maturin is 0.14.x
2023-02-04 00:09:04 -08:00
Julien Jerphanion 9306d56b27 docs: Precise the abscense of `py: Python` for the #[pyo3(signature)] 2023-02-03 20:57:23 +00:00
David Hewitt c709f30638 guide: add documentation for trailing option arguments 2023-02-03 20:54:51 +00:00
David Hewitt e83803e813 add link on how to obtain GIL to guide 2023-01-20 08:21:57 +00:00
David Hewitt 586fed2c4b send errors in `__releasebuffer__` to `sys.unraisablehook` 2023-01-19 19:10:06 +00:00
David Hewitt ca1bbe3d39 add migration notes for PyO3 0.18 2023-01-17 08:14:32 +00:00
David Hewitt 20ca3be659 inspect: gate behind `experimental-inspect` feature 2023-01-15 12:41:23 +00:00
David Hewitt eea2a31bd3 adjust location and wording for extension module memory management 2023-01-10 07:42:39 +00:00
Haixuan Xavier Tao 8af9d2a19a Add a section on memory management for `extension`
Adding a special case of memory management when writing an extension.

This is a documentation of: https://github.com/PyO3/pyo3/issues/1056 and https://github.com/PyO3/pyo3/issues/2853
2023-01-10 07:37:21 +00:00
David Hewitt 8651d3b0e8 address feedback in review #2678 2023-01-06 08:53:00 +00:00
James Welchman e52dbc907d GH-2649 example for inserting moulde in sys.dict 2023-01-05 21:26:47 +00:00
messense c722402e46
Fix links in `logging.md` 2023-01-03 20:03:51 +08:00
Dylan Storey fefd224e4a Update logging.md for logging->rust
Demonstrates how to register a rust log consumer with a pythong logging instance.
2023-01-03 10:22:54 +00:00
David Hewitt f2608a923c remove functionality deprecated in 0.16 2022-12-28 12:23:53 +00:00
David Hewitt 5039fd746a add automatic text signature generation 2022-12-24 09:43:02 +00:00
David Hewitt 97487ffbb5 add abi3-py311 feature 2022-11-23 08:08:12 +00:00
Georg Brandl f1f1ffcdc7 More typos and grammar. 2022-11-23 07:42:53 +01:00
Georg Brandl c91ed70bbc Fix various typos/omissions in guide. 2022-11-23 07:42:17 +01:00
Georg Brandl 5f7d67615c Use PYO3_DOCS_URL in guide-to-rustdoc links. 2022-11-23 07:42:17 +01:00
bors[bot] 08423557d4
Merge #2739
2739: error when `#[pyo3(signature = ())]` used on invalid methods r=davidhewitt a=davidhewitt

A follow-up to #2702 to reject some invalid applications of `#[pyo3(signature = (...))]` attribute, specifically on magic methods and getters / setters / class attributes.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-11-22 19:41:27 +00:00
bors[bot] b485199cfb
Merge #2762
2762: Add a nox task to rustfmt code in the guide r=birkenfeld a=birkenfeld

Also apply it. Two caveats:

1) needs nightly rustfmt to be available
2) not all reformat diffs have been applied; using best judgment for readability


Co-authored-by: Georg Brandl <georg@python.org>
2022-11-22 11:11:19 +00:00
Georg Brandl a7a53d6c0d Add a nox task to rustfmt code in the guide.
Also apply it. Two caveats:

1) needs nightly rustfmt to be available
2) not all reformat diffs have been applied; using best judgment for readability.
2022-11-22 09:19:40 +01:00
Saul Shanabrook 8a75352122
Add link to Python typing docs for type stubs
AFAIK there isn't currently a link to the article on ["Type Stubs"](https://typing.readthedocs.io/en/latest/source/stubs.html) in the official Python static typing documentation. This PR adds a link to this documentation, which is the most comprehensive I have seen around type stubs.
2022-11-21 16:48:43 -05:00
Matthew Lloyd b2014c30aa
guide: linkify "Method arguments" in class.md 2022-11-20 16:33:15 -05:00
David Hewitt 8ca41be87b
Merge pull request #2749 from PyO3/2748-fix
Fix being able to call arg-less `#[new]` with any args from Python
2022-11-20 11:39:42 +00:00
Georg Brandl 51eeb6db96 guide: explain how #[new] works w.r.t. native base types 2022-11-20 08:25:42 +01:00
Georg Brandl 77f5fc107e guide: better document negative index behavior w.r.t. PySequence
Fixes #2601
2022-11-20 08:09:50 +01:00
Georg Brandl c489809938 Py/PyAny: deprecate cast_as() in favor of downcast()
They are (practically) identical on PyAny, and `downcast()` is the more
useful name.
2022-11-18 07:00:40 +01:00
David Hewitt 00fc0358b9 error when `#[pyo3(signature = ())]` used on invalid methods 2022-11-17 08:28:34 +00:00
messense dee791de90
`pyo3-build-config`: rebuild when `PYO3_ENVIRONMENT_SIGNATURE` value changed 2022-11-09 20:28:18 +08:00