remove `gil-refs` feature from `full` feature (#3930)
This commit is contained in:
parent
811a3e5d00
commit
b08ee4b7e1
|
@ -110,7 +110,6 @@ nightly = []
|
||||||
# This is mostly intended for testing purposes - activating *all* of these isn't particularly useful.
|
# This is mostly intended for testing purposes - activating *all* of these isn't particularly useful.
|
||||||
full = [
|
full = [
|
||||||
"macros",
|
"macros",
|
||||||
"gil-refs",
|
|
||||||
# "multiple-pymethods", # TODO re-add this when MSRV is greater than 1.62
|
# "multiple-pymethods", # TODO re-add this when MSRV is greater than 1.62
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -140,7 +139,7 @@ members = [
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
no-default-features = true
|
no-default-features = true
|
||||||
features = ["full"]
|
features = ["full", "gil-refs"]
|
||||||
rustdoc-args = ["--cfg", "docsrs"]
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
|
|
18
noxfile.py
18
noxfile.py
|
@ -46,6 +46,7 @@ def test_rust(session: nox.Session):
|
||||||
_run_cargo_test(session, features="abi3")
|
_run_cargo_test(session, features="abi3")
|
||||||
if "skip-full" not in session.posargs:
|
if "skip-full" not in session.posargs:
|
||||||
_run_cargo_test(session, features="full")
|
_run_cargo_test(session, features="full")
|
||||||
|
_run_cargo_test(session, features="full gil-refs")
|
||||||
_run_cargo_test(session, features="abi3 full")
|
_run_cargo_test(session, features="abi3 full")
|
||||||
|
|
||||||
|
|
||||||
|
@ -617,6 +618,7 @@ def check_feature_powerset(session: nox.Session):
|
||||||
|
|
||||||
EXCLUDED_FROM_FULL = {
|
EXCLUDED_FROM_FULL = {
|
||||||
"nightly",
|
"nightly",
|
||||||
|
"gil-refs",
|
||||||
"extension-module",
|
"extension-module",
|
||||||
"full",
|
"full",
|
||||||
"default",
|
"default",
|
||||||
|
@ -658,10 +660,15 @@ def check_feature_powerset(session: nox.Session):
|
||||||
session.error("no experimental features exist; please simplify the noxfile")
|
session.error("no experimental features exist; please simplify the noxfile")
|
||||||
|
|
||||||
features_to_skip = [
|
features_to_skip = [
|
||||||
*EXCLUDED_FROM_FULL,
|
*(EXCLUDED_FROM_FULL - {"gil-refs"}),
|
||||||
*abi3_version_features,
|
*abi3_version_features,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# deny warnings
|
||||||
|
env = os.environ.copy()
|
||||||
|
rust_flags = env.get("RUSTFLAGS", "")
|
||||||
|
env["RUSTFLAGS"] = f"{rust_flags} -Dwarnings"
|
||||||
|
|
||||||
comma_join = ",".join
|
comma_join = ",".join
|
||||||
_run_cargo(
|
_run_cargo(
|
||||||
session,
|
session,
|
||||||
|
@ -672,6 +679,7 @@ def check_feature_powerset(session: nox.Session):
|
||||||
*(f"--group-features={comma_join(group)}" for group in features_to_group),
|
*(f"--group-features={comma_join(group)}" for group in features_to_group),
|
||||||
"check",
|
"check",
|
||||||
"--all-targets",
|
"--all-targets",
|
||||||
|
env=env,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -715,8 +723,8 @@ def _get_feature_sets() -> Tuple[Tuple[str, ...], ...]:
|
||||||
"--no-default-features",
|
"--no-default-features",
|
||||||
"--features=abi3",
|
"--features=abi3",
|
||||||
),
|
),
|
||||||
("--features=full multiple-pymethods",),
|
("--features=full gil-refs multiple-pymethods",),
|
||||||
("--features=abi3 full multiple-pymethods",),
|
("--features=abi3 full gil-refs multiple-pymethods",),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return (
|
return (
|
||||||
|
@ -725,8 +733,8 @@ def _get_feature_sets() -> Tuple[Tuple[str, ...], ...]:
|
||||||
"--no-default-features",
|
"--no-default-features",
|
||||||
"--features=abi3",
|
"--features=abi3",
|
||||||
),
|
),
|
||||||
("--features=full",),
|
("--features=full gil-refs",),
|
||||||
("--features=abi3 full",),
|
("--features=abi3 full gil-refs",),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -980,13 +980,13 @@ mod tests {
|
||||||
let td = new_py_datetime_ob(py, "timedelta", (0, 3600, 0));
|
let td = new_py_datetime_ob(py, "timedelta", (0, 3600, 0));
|
||||||
let py_timedelta = new_py_datetime_ob(py, "timezone", (td,));
|
let py_timedelta = new_py_datetime_ob(py, "timezone", (td,));
|
||||||
// Should be equal
|
// Should be equal
|
||||||
assert!(offset.as_ref(py).eq(py_timedelta).unwrap());
|
assert!(offset.bind(py).eq(py_timedelta).unwrap());
|
||||||
|
|
||||||
// Same but with negative values
|
// Same but with negative values
|
||||||
let offset = FixedOffset::east_opt(-3600).unwrap().to_object(py);
|
let offset = FixedOffset::east_opt(-3600).unwrap().to_object(py);
|
||||||
let td = new_py_datetime_ob(py, "timedelta", (0, -3600, 0));
|
let td = new_py_datetime_ob(py, "timedelta", (0, -3600, 0));
|
||||||
let py_timedelta = new_py_datetime_ob(py, "timezone", (td,));
|
let py_timedelta = new_py_datetime_ob(py, "timezone", (td,));
|
||||||
assert!(offset.as_ref(py).eq(py_timedelta).unwrap());
|
assert!(offset.bind(py).eq(py_timedelta).unwrap());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -282,7 +282,7 @@ mod tests {
|
||||||
let mut f0 = 1.to_object(py);
|
let mut f0 = 1.to_object(py);
|
||||||
let mut f1 = 1.to_object(py);
|
let mut f1 = 1.to_object(py);
|
||||||
std::iter::from_fn(move || {
|
std::iter::from_fn(move || {
|
||||||
let f2 = f0.call_method1(py, "__add__", (f1.as_ref(py),)).unwrap();
|
let f2 = f0.call_method1(py, "__add__", (f1.bind(py),)).unwrap();
|
||||||
Some(std::mem::replace(&mut f0, std::mem::replace(&mut f1, f2)))
|
Some(std::mem::replace(&mut f0, std::mem::replace(&mut f1, f2)))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ mod tests {
|
||||||
// Python -> Rust
|
// Python -> Rust
|
||||||
assert_eq!(py_result.extract::<BigUint>(py).unwrap(), rs_result);
|
assert_eq!(py_result.extract::<BigUint>(py).unwrap(), rs_result);
|
||||||
// Rust -> Python
|
// Rust -> Python
|
||||||
assert!(py_result.as_ref(py).eq(rs_result).unwrap());
|
assert!(py_result.bind(py).eq(rs_result).unwrap());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ mod tests {
|
||||||
// Python -> Rust
|
// Python -> Rust
|
||||||
assert_eq!(py_result.extract::<BigInt>(py).unwrap(), rs_result);
|
assert_eq!(py_result.extract::<BigInt>(py).unwrap(), rs_result);
|
||||||
// Rust -> Python
|
// Rust -> Python
|
||||||
assert!(py_result.as_ref(py).eq(&rs_result).unwrap());
|
assert!(py_result.bind(py).eq(&rs_result).unwrap());
|
||||||
|
|
||||||
// negate
|
// negate
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ mod tests {
|
||||||
// Python -> Rust
|
// Python -> Rust
|
||||||
assert_eq!(py_result.extract::<BigInt>(py).unwrap(), rs_result);
|
assert_eq!(py_result.extract::<BigInt>(py).unwrap(), rs_result);
|
||||||
// Rust -> Python
|
// Rust -> Python
|
||||||
assert!(py_result.as_ref(py).eq(rs_result).unwrap());
|
assert!(py_result.bind(py).eq(rs_result).unwrap());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,7 @@ use crate::sync::GILOnceCell;
|
||||||
use crate::types::any::PyAnyMethods;
|
use crate::types::any::PyAnyMethods;
|
||||||
use crate::types::string::PyStringMethods;
|
use crate::types::string::PyStringMethods;
|
||||||
use crate::types::PyType;
|
use crate::types::PyType;
|
||||||
use crate::{
|
use crate::{Bound, FromPyObject, IntoPy, Py, PyAny, PyObject, PyResult, Python, ToPyObject};
|
||||||
intern, Bound, FromPyObject, IntoPy, Py, PyAny, PyObject, PyResult, Python, ToPyObject,
|
|
||||||
};
|
|
||||||
use rust_decimal::Decimal;
|
use rust_decimal::Decimal;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
@ -74,14 +72,8 @@ impl FromPyObject<'_> for Decimal {
|
||||||
|
|
||||||
static DECIMAL_CLS: GILOnceCell<Py<PyType>> = GILOnceCell::new();
|
static DECIMAL_CLS: GILOnceCell<Py<PyType>> = GILOnceCell::new();
|
||||||
|
|
||||||
fn get_decimal_cls(py: Python<'_>) -> PyResult<&PyType> {
|
fn get_decimal_cls(py: Python<'_>) -> PyResult<&Bound<'_, PyType>> {
|
||||||
DECIMAL_CLS
|
DECIMAL_CLS.get_or_try_init_type_ref(py, "decimal", "Decimal")
|
||||||
.get_or_try_init(py, || {
|
|
||||||
py.import_bound(intern!(py, "decimal"))?
|
|
||||||
.getattr(intern!(py, "Decimal"))?
|
|
||||||
.extract()
|
|
||||||
})
|
|
||||||
.map(|ty| ty.as_ref(py))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToPyObject for Decimal {
|
impl ToPyObject for Decimal {
|
||||||
|
|
Loading…
Reference in New Issue