Skip to content

Commit 7e4d1c4

Browse files
kngwyudavidhewitt
andauthored
Bump version to 0.10.0 (#919)
* Bump version to 0.10.0 * Apply suggestions from code review Co-authored-by: David Hewitt <[email protected]> * Improve CHANGELOG completeness and messaging * ObjectProtocol was in prelude Co-authored-by: David Hewitt <[email protected]>
1 parent 956ed52 commit 7e4d1c4

File tree

8 files changed

+82
-44
lines changed

8 files changed

+82
-44
lines changed

Diff for: CHANGELOG.md

+32-27
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,43 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
9+
## [0.10.0]
810
### Added
9-
- `_PyDict_NewPresized`. [#849](https://github.com/PyO3/pyo3/pull/849)
10-
- `IntoPy<PyObject>` for `HashSet` and `BTreeSet`. [#864](https://github.com/PyO3/pyo3/pull/864)
11-
- `PyAny::dir`. [#886](https://github.com/PyO3/pyo3/pull/886)
12-
- `impl Clone` for `PyObject` and `Py<T>`. [#908](https://github.com/PyO3/pyo3/pull/908)
13-
- All builtin types (`PyList`, `PyTuple`, `PyDict`) etc. now implement `Deref<Target = PyAny>`. [#911](https://github.com/PyO3/pyo3/pull/911)
14-
- `PyCell<T>` now implements `Deref<Target = PyAny>`. [#911](https://github.com/PyO3/pyo3/pull/911)
15-
- Methods and associated constants can now be annotated with `#[classattr]` to define class attributes. [#905](https://github.com/PyO3/pyo3/pull/905) [#914](https://github.com/PyO3/pyo3/pull/914)
11+
- Add FFI definition `_PyDict_NewPresized`. [#849](https://github.com/PyO3/pyo3/pull/849)
12+
- Implement `IntoPy<PyObject>` for `HashSet` and `BTreeSet`. [#864](https://github.com/PyO3/pyo3/pull/864)
13+
- Add `PyAny::dir` method. [#886](https://github.com/PyO3/pyo3/pull/886)
14+
- Gate macros behind a `macros` feature (enabled by default). [#897](https://github.com/PyO3/pyo3/pull/897)
15+
- Add ability to define class attributes using `#[classattr]` on functions in `#[pymethods]`. [#905](https://github.com/PyO3/pyo3/pull/905)
16+
- Implement `Clone` for `PyObject` and `Py<T>`. [#908](https://github.com/PyO3/pyo3/pull/908)
17+
- Implement `Deref<Target = PyAny>` for all builtin types. (`PyList`, `PyTuple`, `PyDict` etc.) [#911](https://github.com/PyO3/pyo3/pull/911)
18+
- Implement `Deref<Target = PyAny>` for `PyCell<T>`. [#911](https://github.com/PyO3/pyo3/pull/911)
19+
- Add `#[classattr]` support for associated constants in `#[pymethods]`. [#914](https://github.com/PyO3/pyo3/pull/914)
1620

1721
### Changed
18-
- Panics from Rust will now be caught and raised as Python errors. [#797](https://github.com/PyO3/pyo3/pull/797)
19-
- `PyObject` and `Py<T>` reference counts are now decremented sooner after `drop()`. [#851](https://github.com/PyO3/pyo3/pull/851)
20-
- When the GIL is held, the refcount is now decreased immediately on drop. (Previously would wait until just before releasing the GIL.)
21-
- When the GIL is not held, the refcount is now decreased when the GIL is next acquired. (Previously would wait until next time the GIL was released.)
22-
- `FromPyObject` for `Py<T>` now works for a wider range of `T`, in particular for `T: PyClass`. [#880](https://github.com/PyO3/pyo3/pull/880)
23-
- Some functions such as `PyList::get_item` which return borrowed objects at the C ffi layer now return owned objects at the PyO3 layer, for safety reasons. [#890](https://github.com/PyO3/pyo3/pull/890)
24-
- The `GILGuard` returned from `Python::acquire_gil` will now only assume responsiblity for freeing owned references on drop if no other `GILPool` or `GILGuard` exists. This ensures that multiple calls to the safe api `Python::acquire_gil` cannot lead to dangling references. [#893](https://github.com/PyO3/pyo3/pull/893)
25-
- The trait `ObjectProtocol` has been removed, and all the methods from the trait have been moved to `PyAny`. [#911](https://github.com/PyO3/pyo3/pull/911)
26-
- The exception to this is `ObjectProtocol::None`, which has simply been removed. Use `Python::None` instead.
27-
- No `#![feature(specialization)]` in user code. [#917](https://github.com/PyO3/pyo3/pull/917)
22+
- Panics will now be raised as a Python `PanicException`. [#797](https://github.com/PyO3/pyo3/pull/797)
23+
- Change `PyObject` and `Py<T>` reference counts to decrement immediately upon drop when the GIL is held. [#851](https://github.com/PyO3/pyo3/pull/851)
24+
- Allow `PyIterProtocol` methods to use either `PyRef` or `PyRefMut` as the receiver type. [#856](https://github.com/PyO3/pyo3/pull/856)
25+
- Change the implementation of `FromPyObject` for `Py<T>` to apply to a wider range of `T`, including all `T: PyClass`. [#880](https://github.com/PyO3/pyo3/pull/880)
26+
- Move all methods from the `ObjectProtocol` trait to the `PyAny` struct. [#911](https://github.com/PyO3/pyo3/pull/911)
27+
- Remove need for `#![feature(specialization)]` in crates depending on PyO3. [#917](https://github.com/PyO3/pyo3/pull/917)
2828

2929
### Removed
30-
- `PyMethodsProtocol` is now renamed to `PyMethodsImpl` and hidden. [#889](https://github.com/PyO3/pyo3/pull/889)
31-
- `num-traits` is no longer a dependency. [#895](https://github.com/PyO3/pyo3/pull/895)
32-
- `ObjectProtocol`. [#911](https://github.com/PyO3/pyo3/pull/911)
33-
- All `*ProtocolImpl` traits. [#917](https://github.com/PyO3/pyo3/pull/917)
30+
- Remove `PyMethodsProtocol` trait. [#889](https://github.com/PyO3/pyo3/pull/889)
31+
- Remove `num-traits` dependency. [#895](https://github.com/PyO3/pyo3/pull/895)
32+
- Remove `ObjectProtocol` trait. [#911](https://github.com/PyO3/pyo3/pull/911)
33+
- Remove `PyAny::None`. Users should use `Python::None` instead. [#911](https://github.com/PyO3/pyo3/pull/911)
34+
- Remove all `*ProtocolImpl` traits. [#917](https://github.com/PyO3/pyo3/pull/917)
3435

3536
### Fixed
36-
- `__radd__` and other `__r*__` methods now correctly work with operators. [#839](https://github.com/PyO3/pyo3/pull/839)
37-
- Garbage Collector causing random panics when traversing objects that were mutably borrowed. [#855](https://github.com/PyO3/pyo3/pull/855)
38-
- `&'static Py~` being allowed as arguments. [#869](https://github.com/PyO3/pyo3/pull/869)
39-
- `#[pyo3(get)]` for `Py<T>`. [#880](https://github.com/PyO3/pyo3/pull/880)
40-
- `allow_threads` will no longer cause segfaults in the event of panics inside the closure. [#912](https://github.com/PyO3/pyo3/pull/912)
37+
- Fix support for `__radd__` and other `__r*__` methods as implementations for Python mathematical operators. [#839](https://github.com/PyO3/pyo3/pull/839)
38+
- Fix panics during garbage collection when traversing objects that were already mutably borrowed. [#855](https://github.com/PyO3/pyo3/pull/855)
39+
- Prevent `&'static` references to Python objects as arguments to `#[pyfunction]` and `#[pymethods]`. [#869](https://github.com/PyO3/pyo3/pull/869)
40+
- Fix lifetime safety bug with `AsPyRef::as_ref`. [#876](https://github.com/PyO3/pyo3/pull/876)
41+
- Fix `#[pyo3(get)]` attribute on `Py<T>` fields. [#880](https://github.com/PyO3/pyo3/pull/880)
42+
- Fix segmentation faults caused by functions such as `PyList::get_item` returning borrowed objects when it was not safe to do so. [#890](https://github.com/PyO3/pyo3/pull/890)
43+
- Fix segmentation faults caused by nested `Python::acquire_gil` calls creating dangling references. [#893](https://github.com/PyO3/pyo3/pull/893)
44+
- Fix segmentatation faults when a panic occurs during a call to `Python::allow_threads`. [#912](https://github.com/PyO3/pyo3/pull/912)
4145

4246
## [0.9.2] - 2020-04-09
4347
### Added
@@ -385,7 +389,8 @@ Yanked
385389
### Added
386390
- Initial release
387391

388-
[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.9.2...HEAD
392+
[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.10.0...HEAD
393+
[0.10.0]: https://github.com/pyo3/pyo3/compare/v0.9.2...v0.10.0
389394
[0.9.2]: https://github.com/pyo3/pyo3/compare/v0.9.1...v0.9.2
390395
[0.9.1]: https://github.com/pyo3/pyo3/compare/v0.9.0...v0.9.1
391396
[0.9.0]: https://github.com/pyo3/pyo3/compare/v0.8.5...v0.9.0

Diff for: Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyo3"
3-
version = "0.9.2"
3+
version = "0.10.0"
44
description = "Bindings to Python interpreter"
55
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
66
readme = "README.md"
@@ -25,7 +25,7 @@ libc = "0.2.62"
2525
num-bigint = { version = "0.2", optional = true }
2626
num-complex = { version = "0.2", optional = true }
2727
paste = { version = "0.1.6", optional = true }
28-
pyo3cls = { path = "pyo3cls", version = "=0.9.2", optional = true }
28+
pyo3cls = { path = "pyo3cls", version = "=0.10.0", optional = true }
2929
unindent = { version = "0.1.4", optional = true }
3030

3131
[dev-dependencies]

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ name = "string_sum"
5050
crate-type = ["cdylib"]
5151

5252
[dependencies.pyo3]
53-
version = "0.9.2"
53+
version = "0.10.0"
5454
features = ["extension-module"]
5555
```
5656

@@ -95,7 +95,7 @@ Add `pyo3` to your `Cargo.toml` like this:
9595

9696
```toml
9797
[dependencies]
98-
pyo3 = "0.9.2"
98+
pyo3 = "0.10.0"
9999
```
100100

101101
Example program displaying the value of `sys.version` and the current user name:

Diff for: guide/src/get_started.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ name = "string_sum"
4444
crate-type = ["cdylib"]
4545

4646
[dependencies.pyo3]
47-
version = "0.9.2"
47+
version = "0.10.0"
4848
features = ["extension-module"]
4949
```
5050

@@ -90,7 +90,7 @@ use it to run Python code, add `pyo3` to your `Cargo.toml` like this:
9090

9191
```toml
9292
[dependencies]
93-
pyo3 = "0.9.2"
93+
pyo3 = "0.10.0"
9494
```
9595

9696
Example program displaying the value of `sys.version` and the current user name:

Diff for: guide/src/migration.md

+39-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
# Appendix B: Migrating from older PyO3 versions
2-
This guide can help you upgrade code through breaking changes from one PyO3 version to the next. For a detailed list of all changes, see [CHANGELOG.md](https://github.com/PyO3/pyo3/blob/master/CHANGELOG.md)
2+
3+
This guide can help you upgrade code through breaking changes from one PyO3 version to the next.
4+
For a detailed list of all changes, see [CHANGELOG.md](https://github.com/PyO3/pyo3/blob/master/CHANGELOG.md)
5+
6+
## from 0.9.* to 0.10
7+
8+
### `ObjectProtocol` is removed
9+
All methods are moved to [`PyAny`].
10+
And since now all native types (e.g., `PyList`) implements `Deref<Target=PyAny>`,
11+
all you need to do is remove `ObjectProtocol` from your code.
12+
Or if you use `ObjectProtocol` by `use pyo3::prelude::*`, you have to do nothing.
13+
14+
Before:
15+
```rust,compile_fail
16+
use pyo3::ObjectProtocol;
17+
18+
let gil = pyo3::Python::acquire_gil();
19+
let obj = gil.python().eval("lambda: 'Hi :)'", None, None).unwrap();
20+
let hi: &pyo3::types::PyString = obj.call0().unwrap().downcast().unwrap();
21+
assert_eq!(hi.len().unwrap(), 5);
22+
```
23+
24+
After:
25+
```rust
26+
let gil = pyo3::Python::acquire_gil();
27+
let obj = gil.python().eval("lambda: 'Hi :)'", None, None).unwrap();
28+
let hi: &pyo3::types::PyString = obj.call0().unwrap().downcast().unwrap();
29+
assert_eq!(hi.len().unwrap(), 5);
30+
```
31+
32+
### No `#![feature(specialization)]` in user code
33+
While PyO3 itself still requires specialization and nightly Rust,
34+
now you don't have to use `#![feature(specialization)]` in your crate.
35+
336
## from 0.8.* to 0.9
437

538
### `#[new]` interface
@@ -191,10 +224,10 @@ impl PySequenceProtocol for ByteSequence {
191224
```
192225

193226
[`FromPyObject`]: https://docs.rs/pyo3/latest/pyo3/conversion/trait.FromPyObject.html
194-
195-
[`PyCell`]: https://pyo3.rs/master/doc/pyo3/pycell/struct.PyCell.html
196-
[`PyBorrowMutError`]: https://pyo3.rs/master/doc/pyo3/pycell/struct.PyBorrowMutError.html
197-
[`PyRef`]: https://pyo3.rs/master/doc/pyo3/pycell/struct.PyRef.html
198-
[`PyRefMut`]: https://pyo3.rs/master/doc/pyo3/pycell/struct.PyRefMut.html
227+
[`PyAny`]: https://docs.rs/pyo3/latest/pyo3/types/struct.PyAny.html
228+
[`PyCell`]: https://docs.rs/pyo3/latest/pyo3/pycell/struct.PyCell.html
229+
[`PyBorrowMutError`]: https://docs.rs/pyo3/latest/pyo3/pycell/struct.PyBorrowMutError.html
230+
[`PyRef`]: https://docs.rs/pyo3/latest/pyo3/pycell/struct.PyRef.html
231+
[`PyRefMut`]: https://docs.rs/pyo3/latest/pyo3/pycell/struct.PyRef.html
199232

200233
[`RefCell`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html

Diff for: pyo3-derive-backend/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyo3-derive-backend"
3-
version = "0.9.2"
3+
version = "0.10.0"
44
description = "Code generation for PyO3 package"
55
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
66
keywords = ["pyo3", "python", "cpython", "ffi"]

Diff for: pyo3cls/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyo3cls"
3-
version = "0.9.2"
3+
version = "0.10.0"
44
description = "Proc macros for PyO3 package"
55
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
66
keywords = ["pyo3", "python", "cpython", "ffi"]
@@ -16,4 +16,4 @@ proc-macro = true
1616
[dependencies]
1717
quote = "1"
1818
syn = { version = "1", features = ["full", "extra-traits"] }
19-
pyo3-derive-backend = { path = "../pyo3-derive-backend", version = "=0.9.2" }
19+
pyo3-derive-backend = { path = "../pyo3-derive-backend", version = "=0.10.0" }

Diff for: src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
//! crate-type = ["cdylib"]
5353
//!
5454
//! [dependencies.pyo3]
55-
//! version = "0.9.2"
55+
//! version = "0.10.0"
5656
//! features = ["extension-module"]
5757
//! ```
5858
//!
@@ -109,7 +109,7 @@
109109
//!
110110
//! ```toml
111111
//! [dependencies]
112-
//! pyo3 = "0.9.2"
112+
//! pyo3 = "0.10.0"
113113
//! ```
114114
//!
115115
//! Example program displaying the value of `sys.version`:

0 commit comments

Comments
 (0)