Commit graph

3717 commits

Author SHA1 Message Date
David Hewitt a2375f336f
Merge pull request #1832 from mejrs/decorator
guide: add decorator example
2021-08-26 18:55:59 +01:00
mejrs 76179967f3 use &mut self receiver and py args. 2021-08-26 15:28:52 +02:00
David Hewitt f20079bf78
Merge pull request #1829 from davidhewitt/slice-index
list,tuple,sequence: add slice indexing
2021-08-26 08:30:30 +01:00
David Hewitt 9e81603762
Merge pull request #1831 from davidhewitt/guide-optional-deps
guide: add "Optional Dependencies" section
2021-08-26 08:13:50 +01:00
David Hewitt 3a90ff77f4 list,tuple,sequence: add slice indexing 2021-08-26 07:57:12 +01:00
David Hewitt f2ff6cad37 guide: add "Optional Dependencies" section
Co-authored-by: mejrs <59372212+mejrs@users.noreply.github.com>
2021-08-26 07:22:54 +01:00
mejrs eaf5e6de9c add decorator example 2021-08-26 04:18:49 +02:00
David Hewitt 2df0cb6d13
Merge pull request #1823 from deantvv/ffi-cleanup
ffi cleanup: pylifecycle to pystate
2021-08-24 21:15:29 +01:00
David Hewitt de87971bf6
Merge pull request #1827 from davidhewitt/changelog-tidy
changelog: fix PR links
2021-08-24 20:29:58 +01:00
Dean Li ebeee22d71
ffi: cleanup pystate 2021-08-25 00:41:45 +08:00
Dean Li 0a50b42352
ffi: cleanup pymem 2021-08-24 23:50:26 +08:00
Dean Li 1eeeb1fa32
ffi: cleanup pylifecycle 2021-08-24 23:50:17 +08:00
Georg Brandl 3bed78230d
Merge pull request #1828 from PyO3/get_slice_rename 2021-08-24 10:38:32 +02:00
David Hewitt 688823fbbf
Merge pull request #1826 from davidhewitt/pysequence-tidy
sequence: tidy up implementation
2021-08-24 09:14:56 +01:00
Georg Brandl 50cd4c60ca
Merge pull request #1825 from PyO3/index_trait 2021-08-24 09:34:42 +02:00
Georg Brandl 097216702f tuple: add back old slice() for deprecation cycle 2021-08-24 09:08:08 +02:00
David Hewitt 764b1e5b95 changelog: fix PR links 2021-08-24 07:44:50 +01:00
Georg Brandl c522a9c087 list/tuple: rename slice -> get_slice 2021-08-24 08:40:05 +02:00
Georg Brandl a0f7488e1a list/tuple/sequence: use Index in tests 2021-08-24 08:37:17 +02:00
David Hewitt 7ff7c76268 sequence: tidy up implementation 2021-08-24 07:36:20 +01:00
Georg Brandl 54e7da515a migration: add guide entry for sequence indexing 2021-08-24 08:32:19 +02:00
Georg Brandl 611126d994 list/tuple/sequence: implement Index
See #1667.
2021-08-24 08:24:47 +02:00
David Hewitt cfd6a5bc35
Merge pull request #1803 from PyO3/pysequence_usize
PySequence: use usize everywhere, fix in-place methods
2021-08-24 07:09:58 +01:00
Georg Brandl ead86bd666 PySequence: add missing tests 2021-08-23 16:38:59 +02:00
Georg Brandl 8083c1c310 Update changelog for #1802 and #1803. 2021-08-23 15:47:09 +02:00
Georg Brandl 925fef1ece PySequence: fix the in_place methods to
a) not leak a reference
b) correctly return the result, since for immutable types `self` is not actually mutated in place
2021-08-23 15:47:09 +02:00
Georg Brandl b55d62dd3e PySequence: use usize everywhere
See #1667
2021-08-23 15:47:09 +02:00
Georg Brandl 2979fb8268 tests: fix new clippy warning (does not like Foo::foo) 2021-08-23 15:47:09 +02:00
Dean Li d126d764d7
ffi: cleanup genobject 2021-08-23 21:23:39 +08:00
David Hewitt bbc23e3bf4
Merge pull request #1821 from davidhewitt/0.14.3-changelog
changelog: update for 0.14.3 release
2021-08-22 07:01:25 +01:00
David Hewitt bc1a983371 changelog: update for 0.14.3 release 2021-08-22 01:25:29 +01:00
David Hewitt 591f44ea6d
Merge pull request #1794 from indygreg/pystringdata
string: implement API to access raw string data
2021-08-21 22:54:58 +01:00
David Hewitt 6807c8069e
Merge pull request #1818 from indygreg/interpreter-config-docs
build: document InterpreterConfig fields
2021-08-21 22:52:14 +01:00
Gregory Szorc 736b03b8cc build: document InterpreterConfig fields
I'm building functionality on top of this config and figured I'd
take the time to document the fields to make things easier to
understand.
2021-08-21 12:47:20 -07:00
David Hewitt 17077fd05e
Merge pull request #1816 from mejrs/dedup
deduplicate pyo3-macros documentation
2021-08-21 09:23:50 +01:00
Benjamin Kay ac4613eb9f
Improve documentation about when we free memory, resolves #311 (#1807)
* Improve API docs regarding when we free memory, resolves #311

* Add chapter to guide about when we free memory, resolves #311

* Fix typos in documentation

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

* Add links from guide to docs.rs

* Update guide/src/memory.md

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-08-21 09:23:10 +01:00
Gregory Szorc 0cf7776a4d string: implement API to access raw string data
With the recent implementation of non-limited unicode APIs, we're
able to query Python's low-level state to access the raw bytes that
Python is using to store string objects.

This commit implements a safe Rust API for obtaining a view into
Python's internals and representing the raw bytes Python is using
to store strings.

Not only do we allow accessing what Python has stored internally,
but we also support coercing this data to a `Cow<str>`.

Closes #1776.
2021-08-19 18:24:17 -07:00
David Hewitt 79c7e28799
Merge pull request #1812 from tiran/datetime_use_crate
Use 'crate::' to refer to pyo3
2021-08-19 22:46:25 +01:00
mejrs e753d77e4a deduplicate documentation 2021-08-19 22:55:39 +02:00
David Hewitt 0613b5a8f8
Merge pull request #1805 from mejrs/proc_macro_hygiene
Test proc macro hygiene for `#[pyclass]` macro.
2021-08-18 19:08:41 +01:00
Christian Heimes d74c3f6cd0 Use 'crate::' to refer to pyo3
Fixes: #1811
Signed-off-by: Christian Heimes <christian@python.org>
2021-08-18 12:54:27 +02:00
Péter Leéh f72b2c8f09
Py_CompileString decref (#1810)
* update changelog

* fix memory leak in PyModule::from_code

* add PR link to changelog

* Add Py_DECREF also when PyImport_ExecCodeModuleEx fails

* Remove duplicated calls, simplify logic

Co-authored-by: messense <messense@icloud.com>

Co-authored-by: messense <messense@icloud.com>
2021-08-18 10:50:57 +00:00
messense 78b924db07
Merge pull request #1806 from pschafhalter/fix-memory-leak
Fix memory leak when calling Python from Rust
2021-08-18 14:52:25 +08:00
Peter Schafhalter 37ea57de2b Update changelog 2021-08-17 22:56:27 -07:00
Peter Schafhalter e4466549e5 Edit changelog 2021-08-17 14:37:39 -07:00
Peter Schafhalter cf39181efd Fix memory leak when calling Python from Rust 2021-08-17 14:21:56 -07:00
mejrs 21196e68e2 fully disambiguate types 2021-08-17 22:32:41 +02:00
mejrs f79420dabd remove shadowing 2021-08-17 21:38:28 +02:00
David Hewitt fc90092ef9
Merge pull request #1733 from aviramha/list_stuff
Tuple/List get_item to fallible
2021-08-17 17:13:51 +01:00
Aviram Hassan c6255e6734 - PyList, PyTuple and PySequence's get_item now accepts only usize indices instead of isize.
- `PyList` and `PyTuple`'s `get_item` now always uses the safe API. See `get_item_unchecked` for retrieving index without checks.
2021-08-17 15:01:22 +01:00