Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3"
version = "0.24.0"
version = "0.25.0-dev"
description = "Bindings to Python interpreter"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
readme = "README.md"
Expand All @@ -21,10 +21,10 @@ memoffset = "0.9"
once_cell = "1.13"

# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
pyo3-ffi = { path = "pyo3-ffi", version = "=0.24.0" }
pyo3-ffi = { path = "pyo3-ffi", version = "=0.25.0-dev" }

# support crates for macros feature
pyo3-macros = { path = "pyo3-macros", version = "=0.24.0", optional = true }
pyo3-macros = { path = "pyo3-macros", version = "=0.25.0-dev", optional = true }
indoc = { version = "2.0.1", optional = true }
unindent = { version = "0.2.1", optional = true }

Expand Down Expand Up @@ -68,7 +68,7 @@ static_assertions = "1.1.0"
uuid = { version = "1.10.0", features = ["v4"] }

[build-dependencies]
pyo3-build-config = { path = "pyo3-build-config", version = "=0.24.0", features = ["resolve-config"] }
pyo3-build-config = { path = "pyo3-build-config", version = "=0.25.0-dev", features = ["resolve-config"] }

[features]
default = ["macros"]
Expand Down
2 changes: 1 addition & 1 deletion guide/src/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ With the removal of the old API, many "Bound" API functions which had been intro

Before:

```rust
```rust,ignore
# #![allow(deprecated)]
# use pyo3::prelude::*;
# use pyo3::types::PyTuple;
Expand Down
4 changes: 2 additions & 2 deletions guide/src/python-from-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ are met. Its lifetime `'py` is a central part of PyO3's API.

The `Python<'py>` token serves three purposes:

* It provides global APIs for the Python interpreter, such as [`py.eval_bound()`][eval] and [`py.import_bound()`][import].
* It provides global APIs for the Python interpreter, such as [`py.eval()`][eval] and [`py.import()`][import].
* It can be passed to functions that require a proof of holding the GIL, such as [`Py::clone_ref`][clone_ref].
* Its lifetime `'py` is used to bind many of PyO3's types to the Python interpreter, such as [`Bound<'py, T>`][Bound].

Expand Down Expand Up @@ -45,6 +45,6 @@ Because of the lack of exclusive `&mut` references, PyO3's APIs for Python objec
[obtaining-py]: {{#PYO3_DOCS_URL}}/pyo3/marker/struct.Python.html#obtaining-a-python-token
[`pyo3::sync`]: {{#PYO3_DOCS_URL}}/pyo3/sync/index.html
[eval]: {{#PYO3_DOCS_URL}}/pyo3/marker/struct.Python.html#method.eval
[import]: {{#PYO3_DOCS_URL}}/pyo3/marker/struct.Python.html#method.import_bound
[import]: {{#PYO3_DOCS_URL}}/pyo3/marker/struct.Python.html#method.import
[clone_ref]: {{#PYO3_DOCS_URL}}/pyo3/prelude/struct.Py.html#method.clone_ref
[Bound]: {{#PYO3_DOCS_URL}}/pyo3/struct.Bound.html
1 change: 1 addition & 0 deletions newsfragments/4982.removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove all functionality deprecated in PyO3 0.23.
4 changes: 2 additions & 2 deletions pyo3-benches/benches/bench_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn list_get_item(b: &mut Bencher<'_>) {
fn list_nth(b: &mut Bencher<'_>) {
Python::with_gil(|py| {
const LEN: usize = 50;
let list = PyList::new_bound(py, 0..LEN);
let list = PyList::new(py, 0..LEN).unwrap();
let mut sum = 0;
b.iter(|| {
for i in 0..LEN {
Expand All @@ -55,7 +55,7 @@ fn list_nth(b: &mut Bencher<'_>) {
fn list_nth_back(b: &mut Bencher<'_>) {
Python::with_gil(|py| {
const LEN: usize = 50;
let list = PyList::new_bound(py, 0..LEN);
let list = PyList::new(py, 0..LEN).unwrap();
let mut sum = 0;
b.iter(|| {
for i in 0..LEN {
Expand Down
2 changes: 1 addition & 1 deletion pyo3-build-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-build-config"
version = "0.24.0"
version = "0.25.0-dev"
description = "Build configuration for the PyO3 ecosystem"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
Expand Down
4 changes: 2 additions & 2 deletions pyo3-ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-ffi"
version = "0.24.0"
version = "0.25.0-dev"
description = "Python-API bindings for the PyO3 ecosystem"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
Expand Down Expand Up @@ -43,7 +43,7 @@ generate-import-lib = ["pyo3-build-config/python3-dll-a"]
paste = "1"

[build-dependencies]
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.24.0", features = ["resolve-config"] }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.25.0-dev", features = ["resolve-config"] }

[lints]
workspace = true
Expand Down
6 changes: 3 additions & 3 deletions pyo3-macros-backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-macros-backend"
version = "0.24.0"
version = "0.25.0-dev"
description = "Code generation for PyO3 package"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
Expand All @@ -17,7 +17,7 @@ rust-version = "1.63"
[dependencies]
heck = "0.5"
proc-macro2 = { version = "1.0.60", default-features = false }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.24.0", features = ["resolve-config"] }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.25.0-dev", features = ["resolve-config"] }
quote = { version = "1", default-features = false }

[dependencies.syn]
Expand All @@ -26,7 +26,7 @@ default-features = false
features = ["derive", "parsing", "printing", "clone-impls", "full", "extra-traits"]

[build-dependencies]
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.24.0" }
pyo3-build-config = { path = "../pyo3-build-config", version = "=0.25.0-dev" }

[lints]
workspace = true
Expand Down
4 changes: 2 additions & 2 deletions pyo3-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3-macros"
version = "0.24.0"
version = "0.25.0-dev"
description = "Proc macros for PyO3 package"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
keywords = ["pyo3", "python", "cpython", "ffi"]
Expand All @@ -22,7 +22,7 @@ experimental-async = ["pyo3-macros-backend/experimental-async"]
proc-macro2 = { version = "1.0.60", default-features = false }
quote = "1"
syn = { version = "2", features = ["full", "extra-traits"] }
pyo3-macros-backend = { path = "../pyo3-macros-backend", version = "=0.24.0" }
pyo3-macros-backend = { path = "../pyo3-macros-backend", version = "=0.25.0-dev" }

[lints]
workspace = true
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[tool.towncrier]
filename = "CHANGELOG.md"
version = "0.24.0"
version = "0.25.0-dev"
start_string = "<!-- towncrier release notes start -->\n"
template = ".towncrier.template.md"
title_format = "## [{version}] - {project_date}"
Expand Down
7 changes: 0 additions & 7 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,6 @@ impl<T: Element> PyBuffer<T> {
}
}

/// Deprecated name for [`PyBuffer::get`].
#[deprecated(since = "0.23.0", note = "renamed to `PyBuffer::get`")]
#[inline]
pub fn get_bound(obj: &Bound<'_, PyAny>) -> PyResult<PyBuffer<T>> {
Self::get(obj)
}

/// Gets the pointer to the start of the buffer memory.
///
/// Warning: the buffer memory might be mutated by other Python functions,
Expand Down
124 changes: 5 additions & 119 deletions src/err/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{Borrowed, BoundObject, Py, PyAny, PyObject, Python};
#[allow(deprecated)]
use crate::{IntoPy, ToPyObject};
use std::borrow::Cow;
use std::ffi::{CStr, CString};
use std::ffi::CStr;

mod err_state;
mod impls;
Expand All @@ -29,8 +29,8 @@ use std::convert::Infallible;
/// compatibility with `?` and other Rust errors) this type supports creating exceptions instances
/// in a lazy fashion, where the full Python object for the exception is created only when needed.
///
/// Accessing the contained exception in any way, such as with [`value_bound`](PyErr::value_bound),
/// [`get_type_bound`](PyErr::get_type_bound), or [`is_instance_bound`](PyErr::is_instance_bound)
/// Accessing the contained exception in any way, such as with [`value`](PyErr::value),
/// [`get_type`](PyErr::get_type), or [`is_instance`](PyErr::is_instance)
/// will create the full exception object if it was not already created.
pub struct PyErr {
state: PyErrState,
Expand Down Expand Up @@ -126,7 +126,7 @@ impl PyErr {
///
/// This exception instance will be initialized lazily. This avoids the need for the Python GIL
/// to be held, but requires `args` to be `Send` and `Sync`. If `args` is not `Send` or `Sync`,
/// consider using [`PyErr::from_value_bound`] instead.
/// consider using [`PyErr::from_value`] instead.
///
/// If `T` does not inherit from `BaseException`, then a `TypeError` will be returned.
///
Expand Down Expand Up @@ -198,16 +198,6 @@ impl PyErr {
PyErr::from_state(PyErrState::lazy_arguments(ty.unbind().into_any(), args))
}

/// Deprecated name for [`PyErr::from_type`].
#[deprecated(since = "0.23.0", note = "renamed to `PyErr::from_type`")]
#[inline]
pub fn from_type_bound<A>(ty: Bound<'_, PyType>, args: A) -> PyErr
where
A: PyErrArguments + Send + Sync + 'static,
{
Self::from_type(ty, args)
}

/// Creates a new PyErr.
///
/// If `obj` is a Python exception object, the PyErr will contain that object.
Expand Down Expand Up @@ -256,13 +246,6 @@ impl PyErr {
PyErr::from_state(state)
}

/// Deprecated name for [`PyErr::from_value`].
#[deprecated(since = "0.23.0", note = "renamed to `PyErr::from_value`")]
#[inline]
pub fn from_value_bound(obj: Bound<'_, PyAny>) -> PyErr {
Self::from_value(obj)
}

/// Returns the type of this exception.
///
/// # Examples
Expand All @@ -278,13 +261,6 @@ impl PyErr {
self.normalized(py).ptype(py)
}

/// Deprecated name for [`PyErr::get_type`].
#[deprecated(since = "0.23.0", note = "renamed to `PyErr::get_type`")]
#[inline]
pub fn get_type_bound<'py>(&self, py: Python<'py>) -> Bound<'py, PyType> {
self.get_type(py)
}

/// Returns the value of this exception.
///
/// # Examples
Expand All @@ -302,13 +278,6 @@ impl PyErr {
self.normalized(py).pvalue.bind(py)
}

/// Deprecated name for [`PyErr::value`].
#[deprecated(since = "0.23.0", note = "renamed to `PyErr::value`")]
#[inline]
pub fn value_bound<'py>(&self, py: Python<'py>) -> &Bound<'py, PyBaseException> {
self.value(py)
}

/// Consumes self to take ownership of the exception value contained in this error.
pub fn into_value(self, py: Python<'_>) -> Py<PyBaseException> {
// NB technically this causes one reference count increase and decrease in quick succession
Expand Down Expand Up @@ -339,13 +308,6 @@ impl PyErr {
self.normalized(py).ptraceback(py)
}

/// Deprecated name for [`PyErr::traceback`].
#[deprecated(since = "0.23.0", note = "renamed to `PyErr::traceback`")]
#[inline]
pub fn traceback_bound<'py>(&self, py: Python<'py>) -> Option<Bound<'py, PyTraceback>> {
self.traceback(py)
}

/// Gets whether an error is present in the Python interpreter's global state.
#[inline]
pub fn occurred(_: Python<'_>) -> bool {
Expand Down Expand Up @@ -449,29 +411,6 @@ impl PyErr {
unsafe { Py::from_owned_ptr_or_err(py, ptr) }
}

/// Deprecated name for [`PyErr::new_type`].
#[deprecated(since = "0.23.0", note = "renamed to `PyErr::new_type`")]
#[inline]
pub fn new_type_bound<'py>(
py: Python<'py>,
name: &str,
doc: Option<&str>,
base: Option<&Bound<'py, PyType>>,
dict: Option<PyObject>,
) -> PyResult<Py<PyType>> {
let null_terminated_name =
CString::new(name).expect("Failed to initialize nul terminated exception name");
let null_terminated_doc =
doc.map(|d| CString::new(d).expect("Failed to initialize nul terminated docstring"));
Self::new_type(
py,
&null_terminated_name,
null_terminated_doc.as_deref(),
base,
dict,
)
}

/// Prints a standard traceback to `sys.stderr`.
pub fn display(&self, py: Python<'_>) {
#[cfg(Py_3_12)]
Expand Down Expand Up @@ -529,13 +468,6 @@ impl PyErr {
(unsafe { ffi::PyErr_GivenExceptionMatches(type_bound.as_ptr(), ty.as_ptr()) }) != 0
}

/// Deprecated name for [`PyErr::is_instance`].
#[deprecated(since = "0.23.0", note = "renamed to `PyErr::is_instance`")]
#[inline]
pub fn is_instance_bound(&self, py: Python<'_>, ty: &Bound<'_, PyAny>) -> bool {
self.is_instance(py, ty)
}

/// Returns true if the current exception is instance of `T`.
#[inline]
pub fn is_instance_of<T>(&self, py: Python<'_>) -> bool
Expand Down Expand Up @@ -586,13 +518,6 @@ impl PyErr {
unsafe { ffi::PyErr_WriteUnraisable(obj.map_or(std::ptr::null_mut(), Bound::as_ptr)) }
}

/// Deprecated name for [`PyErr::write_unraisable`].
#[deprecated(since = "0.23.0", note = "renamed to `PyErr::write_unraisable`")]
#[inline]
pub fn write_unraisable_bound(self, py: Python<'_>, obj: Option<&Bound<'_, PyAny>>) {
self.write_unraisable(py, obj)
}

/// Issues a warning message.
///
/// May return an `Err(PyErr)` if warnings-as-errors is enabled.
Expand All @@ -601,7 +526,7 @@ impl PyErr {
///
/// The `category` should be one of the `Warning` classes available in
/// [`pyo3::exceptions`](crate::exceptions), or a subclass. The Python
/// object can be retrieved using [`Python::get_type_bound()`].
/// object can be retrieved using [`Python::get_type()`].
///
/// Example:
/// ```rust
Expand Down Expand Up @@ -630,19 +555,6 @@ impl PyErr {
})
}

/// Deprecated name for [`PyErr::warn`].
#[deprecated(since = "0.23.0", note = "renamed to `PyErr::warn`")]
#[inline]
pub fn warn_bound<'py>(
py: Python<'py>,
category: &Bound<'py, PyAny>,
message: &str,
stacklevel: i32,
) -> PyResult<()> {
let message = CString::new(message)?;
Self::warn(py, category, &message, stacklevel)
}

/// Issues a warning message, with more control over the warning attributes.
///
/// May return a `PyErr` if warnings-as-errors is enabled.
Expand Down Expand Up @@ -680,32 +592,6 @@ impl PyErr {
})
}

/// Deprecated name for [`PyErr::warn_explicit`].
#[deprecated(since = "0.23.0", note = "renamed to `PyErr::warn`")]
#[inline]
pub fn warn_explicit_bound<'py>(
py: Python<'py>,
category: &Bound<'py, PyAny>,
message: &str,
filename: &str,
lineno: i32,
module: Option<&str>,
registry: Option<&Bound<'py, PyAny>>,
) -> PyResult<()> {
let message = CString::new(message)?;
let filename = CString::new(filename)?;
let module = module.map(CString::new).transpose()?;
Self::warn_explicit(
py,
category,
&message,
&filename,
lineno,
module.as_deref(),
registry,
)
}

/// Clone the PyErr. This requires the GIL, which is why PyErr does not implement Clone.
///
/// # Examples
Expand Down
Loading
Loading