Skip to content

Commit

Permalink
Add changelog & migration entry
Browse files Browse the repository at this point in the history
  • Loading branch information
bschoenmaeckers committed Jul 31, 2024
1 parent 4b4e551 commit f890653
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
45 changes: 45 additions & 0 deletions guide/src/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,51 @@ let tup = PyTuple::new(py, [1, 2, 3]);
```
</details>

### Renamed `IntoPyDict::into_py_dict_bound` into `IntoPyDict::into_py_dict`.
<details open>
<summary><small>Click to expand</small></summary>

The `IntoPyDict::into_py_dict_bound` method has been renamed to `IntoPyDict::into_py_dict`. If you implemented `IntoPyDict` for your type, you should implement `into_py_dict` instead of `into_py_dict_bound`. The old name is still available but deprecated.

Before:

```rust
impl<T, I> IntoPyDict for I
where
T: PyDictItem,
I: IntoIterator<Item = T>,
{
fn into_py_dict_bound(self, py: Python<'_>) -> Bound<'_, PyDict> {
let dict = PyDict::new(py);
for item in self {
dict.set_item(item.key(), item.value())
.expect("Failed to set_item on dict");
}
dict
}
}
```

After:

```rust
impl<T, I> IntoPyDict for I
where
T: PyDictItem,
I: IntoIterator<Item = T>,
{
fn into_py_dict(self, py: Python<'_>) -> Bound<'_, PyDict> {
let dict = PyDict::new(py);
for item in self {
dict.set_item(item.key(), item.value())
.expect("Failed to set_item on dict");
}
dict
}
}
```
</details>

## from 0.21.* to 0.22

### Deprecation of `gil-refs` feature continues
Expand Down
1 change: 1 addition & 0 deletions newsfragments/4388.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Renamed `IntoPyDict::into_py_dict_bound` into `IntoPyDict::into_py_dict`.

0 comments on commit f890653

Please sign in to comment.