auto-initialize: remove from default features
This commit is contained in:
parent
32841c1338
commit
9e4e0dbbe0
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
- Change `PyTimeAcces::get_fold()` to return a `bool` instead of a `u8`. [#1397](https://github.com/PyO3/pyo3/pull/1397)
|
||||
- Deprecate FFI definition `PyCFunction_Call` for Python 3.9 and later. [#1425](https://github.com/PyO3/pyo3/pull/1425)
|
||||
- Deprecate FFI definitions `PyModule_GetFilename`. [#1425](https://github.com/PyO3/pyo3/pull/1425)
|
||||
- The `auto-initialize` feature is no longer enabled by default. [#1443](https://github.com/PyO3/pyo3/pull/1443)
|
||||
|
||||
### Removed
|
||||
- Remove deprecated exception names `BaseException` etc. [#1426](https://github.com/PyO3/pyo3/pull/1426)
|
||||
|
|
|
@ -40,7 +40,7 @@ pyo3 = { path = ".", default-features = false, features = ["macros", "auto-initi
|
|||
serde_json = "1.0.61"
|
||||
|
||||
[features]
|
||||
default = ["macros", "auto-initialize"]
|
||||
default = ["macros"]
|
||||
|
||||
# Enables macros: #[pyclass], #[pymodule], #[pyfunction] etc.
|
||||
macros = ["pyo3-macros", "indoc", "inventory", "paste", "unindent"]
|
||||
|
|
|
@ -34,11 +34,7 @@ See the [building and distribution](building_and_distribution.md#minimum-python-
|
|||
|
||||
This feature changes [`Python::with_gil`](https://docs.rs/pyo3/latest/pyo3/struct.Python.html#method.with_gil) and [`Python::acquire_gil`](https://docs.rs/pyo3/latest/pyo3/struct.Python.html#method.acquire_gil) to automatically initialize a Python interpreter (by calling [`prepare_freethreaded_python`](https://docs.rs/pyo3/latest/pyo3/fn.prepare_freethreaded_python.html)) if needed.
|
||||
|
||||
This feature is not needed for extension modules, but for compatibility it is enabled by default until at least the PyO3 0.14 release.
|
||||
|
||||
If you choose not to enable this feature, you should call `pyo3::prepare_freethreaded_python()` before attempting to call any other Python APIs.
|
||||
|
||||
> This feature is enabled by default. To disable it, set `default-features = false` for the `pyo3` entry in your Cargo.toml.
|
||||
If you do not enable this feature, you should call `pyo3::prepare_freethreaded_python()` before attempting to call any other Python APIs.
|
||||
|
||||
## Advanced Features
|
||||
|
||||
|
@ -67,7 +63,7 @@ The `nightly` feature needs the nightly Rust compiler. This allows PyO3 to use R
|
|||
|
||||
### `serde`
|
||||
|
||||
The `serde` feature enables (de)serialization of Py<T> objects via [serde](https://serde.rs/).
|
||||
The `serde` feature enables (de)serialization of Py<T> objects via [serde](https://serde.rs/).
|
||||
This allows to use [`#[derive(Serialize, Deserialize)`](https://serde.rs/derive.html) on structs that hold references to `#[pyclass]` instances
|
||||
|
||||
```rust
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
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 the [CHANGELOG](changelog.md).
|
||||
|
||||
## from 0.13.* to 0.14
|
||||
|
||||
### `auto-initialize` feature is now opt-in
|
||||
|
||||
For projects embedding Python in Rust, PyO3 no longer automatically initalizes a Python interpreter on the first call to `Python::with_gil` (or `Python::acquire_gil`) unless the [`auto-initalize` feature](features.md#auto-initalize) is enabled.
|
||||
|
||||
## from 0.12.* to 0.13
|
||||
|
||||
### Minimum Rust version increased to Rust 1.45
|
||||
|
|
|
@ -217,7 +217,7 @@ impl GILGuard {
|
|||
cfg_if::cfg_if! {
|
||||
if #[cfg(all(feature = "auto-initialize", Py_SHARED, not(PyPy)))] {
|
||||
prepare_freethreaded_python();
|
||||
} else if #[cfg(all(feature = "auto-initialize", not(feature = "extension-module"), not(Py_SHARED), not(__pyo3_ci)))] {
|
||||
} else if #[cfg(all(feature = "auto-initialize", not(Py_SHARED), not(__pyo3_ci)))] {
|
||||
compile_error!(concat!(
|
||||
"The `auto-initialize` feature is not supported when linking Python ",
|
||||
"statically instead of with a shared library.\n\n",
|
||||
|
@ -229,7 +229,7 @@ impl GILGuard {
|
|||
"Alternatively, compile PyO3 using a Python distribution which contains a shared ",
|
||||
"libary."
|
||||
));
|
||||
} else if #[cfg(all(feature = "auto-initialize", not(feature = "extension-module"), PyPy, not(__pyo3_ci)))] {
|
||||
} else if #[cfg(all(feature = "auto-initialize", PyPy, not(__pyo3_ci)))] {
|
||||
compile_error!(concat!(
|
||||
"The `auto-initialize` feature is not supported by PyPy.\n\n",
|
||||
"Please disable the `auto-initialize` feature, for example by entering the following ",
|
||||
|
|
Loading…
Reference in New Issue