Remove doc_cfg attributes
This commit is contained in:
parent
7087ee1183
commit
20c3c068f8
|
@ -1,5 +1,4 @@
|
||||||
#![cfg(not(Py_LIMITED_API))]
|
#![cfg(not(Py_LIMITED_API))]
|
||||||
#![cfg_attr(docsrs, doc(cfg(not(Py_LIMITED_API))))]
|
|
||||||
// Copyright (c) 2017 Daniel Grunwald
|
// Copyright (c) 2017 Daniel Grunwald
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||||
|
|
|
@ -7,7 +7,6 @@ mod macros;
|
||||||
|
|
||||||
pub mod basic;
|
pub mod basic;
|
||||||
#[cfg(not(Py_LIMITED_API))]
|
#[cfg(not(Py_LIMITED_API))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(Py_LIMITED_API))))]
|
|
||||||
pub mod buffer;
|
pub mod buffer;
|
||||||
pub mod context;
|
pub mod context;
|
||||||
pub mod descr;
|
pub mod descr;
|
||||||
|
@ -24,7 +23,6 @@ pub mod sequence;
|
||||||
|
|
||||||
pub use self::basic::PyObjectProtocol;
|
pub use self::basic::PyObjectProtocol;
|
||||||
#[cfg(not(Py_LIMITED_API))]
|
#[cfg(not(Py_LIMITED_API))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(Py_LIMITED_API))))]
|
|
||||||
pub use self::buffer::PyBufferProtocol;
|
pub use self::buffer::PyBufferProtocol;
|
||||||
pub use self::context::PyContextProtocol;
|
pub use self::context::PyContextProtocol;
|
||||||
pub use self::descr::PyDescrProtocol;
|
pub use self::descr::PyDescrProtocol;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![cfg(feature = "eyre")]
|
#![cfg(feature = "eyre")]
|
||||||
#![cfg_attr(docsrs, doc(cfg(feature = "eyre")))]
|
|
||||||
//! A conversion from [eyre]’s [`Report`] type to [`PyErr`].
|
//! A conversion from [eyre]’s [`Report`] type to [`PyErr`].
|
||||||
//!
|
//!
|
||||||
//! Use of an error handling library like [eyre] is common in application code and when you just
|
//! Use of an error handling library like [eyre] is common in application code and when you just
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![cfg(feature = "hashbrown")]
|
#![cfg(feature = "hashbrown")]
|
||||||
#![cfg_attr(docsrs, doc(cfg(feature = "hashbrown")))]
|
|
||||||
|
|
||||||
//! Conversions to and from [hashbrown](https://docs.rs/hashbrown/)’s
|
//! Conversions to and from [hashbrown](https://docs.rs/hashbrown/)’s
|
||||||
//! `HashMap` and `HashSet`.
|
//! `HashMap` and `HashSet`.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![cfg(feature = "indexmap")]
|
#![cfg(feature = "indexmap")]
|
||||||
#![cfg_attr(docsrs, doc(cfg(feature = "indexmap")))]
|
|
||||||
|
|
||||||
//! Conversions to and from [indexmap](https://docs.rs/indexmap/)’s
|
//! Conversions to and from [indexmap](https://docs.rs/indexmap/)’s
|
||||||
//! `IndexMap`.
|
//! `IndexMap`.
|
||||||
|
|
|
@ -3,11 +3,6 @@
|
||||||
// based on Daniel Grunwald's https://github.com/dgrunwald/rust-cpython
|
// based on Daniel Grunwald's https://github.com/dgrunwald/rust-cpython
|
||||||
|
|
||||||
#![cfg(all(feature = "num-bigint", not(any(Py_LIMITED_API, PyPy))))]
|
#![cfg(all(feature = "num-bigint", not(any(Py_LIMITED_API, PyPy))))]
|
||||||
#![cfg_attr(
|
|
||||||
docsrs,
|
|
||||||
doc(cfg(all(feature = "num-bigint", not(any(Py_LIMITED_API, PyPy)))))
|
|
||||||
)]
|
|
||||||
|
|
||||||
//! Conversions to and from [num-bigint](https://docs.rs/num-bigint)’s [`BigInt`] and [`BigUint`] types.
|
//! Conversions to and from [num-bigint](https://docs.rs/num-bigint)’s [`BigInt`] and [`BigUint`] types.
|
||||||
//!
|
//!
|
||||||
//! This is useful for converting Python integers when they may not fit in Rust's built-in integer types.
|
//! This is useful for converting Python integers when they may not fit in Rust's built-in integer types.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![cfg(feature = "num-complex")]
|
#![cfg(feature = "num-complex")]
|
||||||
#![cfg_attr(docsrs, doc(cfg(feature = "num-complex")))]
|
|
||||||
//! Conversions to and from [num-complex](https://docs.rs/num-complex)’
|
//! Conversions to and from [num-complex](https://docs.rs/num-complex)’
|
||||||
//! [`Complex`]`<`[`f32`]`>` and [`Complex`]`<`[`f64`]`>`.
|
//! [`Complex`]`<`[`f32`]`>` and [`Complex`]`<`[`f64`]`>`.
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#![cfg_attr(docsrs, doc(cfg(feature = "serde")))]
|
|
||||||
#![cfg(feature = "serde")]
|
#![cfg(feature = "serde")]
|
||||||
|
|
||||||
//! Enables (de)serialization of [`Py`]`<T>` objects via [serde](https://docs.rs/serde).
|
//! Enables (de)serialization of [`Py`]`<T>` objects via [serde](https://docs.rs/serde).
|
||||||
|
|
|
@ -113,7 +113,6 @@ extern "C" {
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyIter_Next")]
|
#[cfg_attr(PyPy, link_name = "PyPyIter_Next")]
|
||||||
pub fn PyIter_Next(arg1: *mut PyObject) -> *mut PyObject;
|
pub fn PyIter_Next(arg1: *mut PyObject) -> *mut PyObject;
|
||||||
#[cfg(all(not(PyPy), Py_3_10))]
|
#[cfg(all(not(PyPy), Py_3_10))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(all(not(PyPy), Py_3_10))))]
|
|
||||||
pub fn PyIter_Send(iter: *mut PyObject, arg: *mut PyObject, presult: *mut *mut PyObject);
|
pub fn PyIter_Send(iter: *mut PyObject, arg: *mut PyObject, presult: *mut *mut PyObject);
|
||||||
|
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyNumber_Check")]
|
#[cfg_attr(PyPy, link_name = "PyPyNumber_Check")]
|
||||||
|
|
|
@ -43,17 +43,14 @@ extern "C" {
|
||||||
// skipped _PyThread_CurrentExceptions
|
// skipped _PyThread_CurrentExceptions
|
||||||
|
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyInterpreterState_Main() -> *mut PyInterpreterState;
|
pub fn PyInterpreterState_Main() -> *mut PyInterpreterState;
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyInterpreterState_Head")]
|
#[cfg_attr(PyPy, link_name = "PyPyInterpreterState_Head")]
|
||||||
pub fn PyInterpreterState_Head() -> *mut PyInterpreterState;
|
pub fn PyInterpreterState_Head() -> *mut PyInterpreterState;
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyInterpreterState_Next")]
|
#[cfg_attr(PyPy, link_name = "PyPyInterpreterState_Next")]
|
||||||
pub fn PyInterpreterState_Next(interp: *mut PyInterpreterState) -> *mut PyInterpreterState;
|
pub fn PyInterpreterState_Next(interp: *mut PyInterpreterState) -> *mut PyInterpreterState;
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyInterpreterState_ThreadHead(interp: *mut PyInterpreterState) -> *mut PyThreadState;
|
pub fn PyInterpreterState_ThreadHead(interp: *mut PyInterpreterState) -> *mut PyThreadState;
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyThreadState_Next(tstate: *mut PyThreadState) -> *mut PyThreadState;
|
pub fn PyThreadState_Next(tstate: *mut PyThreadState) -> *mut PyThreadState;
|
||||||
|
|
||||||
#[cfg(py_sys_config = "WITH_THREAD")]
|
#[cfg(py_sys_config = "WITH_THREAD")]
|
||||||
|
@ -62,7 +59,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(Py_3_9)]
|
#[cfg(Py_3_9)]
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_9)))]
|
|
||||||
pub type _PyFrameEvalFunction = extern "C" fn(
|
pub type _PyFrameEvalFunction = extern "C" fn(
|
||||||
*mut crate::ffi::PyThreadState,
|
*mut crate::ffi::PyThreadState,
|
||||||
*mut crate::ffi::PyFrameObject,
|
*mut crate::ffi::PyFrameObject,
|
||||||
|
@ -72,13 +68,11 @@ pub type _PyFrameEvalFunction = extern "C" fn(
|
||||||
#[cfg(Py_3_9)]
|
#[cfg(Py_3_9)]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
/// Get the frame evaluation function.
|
/// Get the frame evaluation function.
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_9)))]
|
|
||||||
pub fn _PyInterpreterState_GetEvalFrameFunc(
|
pub fn _PyInterpreterState_GetEvalFrameFunc(
|
||||||
interp: *mut PyInterpreterState,
|
interp: *mut PyInterpreterState,
|
||||||
) -> _PyFrameEvalFunction;
|
) -> _PyFrameEvalFunction;
|
||||||
|
|
||||||
///Set the frame evaluation function.
|
///Set the frame evaluation function.
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_9)))]
|
|
||||||
pub fn _PyInterpreterState_SetEvalFrameFunc(
|
pub fn _PyInterpreterState_SetEvalFrameFunc(
|
||||||
interp: *mut PyInterpreterState,
|
interp: *mut PyInterpreterState,
|
||||||
eval_frame: _PyFrameEvalFunction,
|
eval_frame: _PyFrameEvalFunction,
|
||||||
|
|
|
@ -252,7 +252,6 @@ extern "C" {
|
||||||
// skipped _PyUnicode_Copy
|
// skipped _PyUnicode_Copy
|
||||||
|
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyUnicode_CopyCharacters(
|
pub fn PyUnicode_CopyCharacters(
|
||||||
to: *mut PyObject,
|
to: *mut PyObject,
|
||||||
to_start: Py_ssize_t,
|
to_start: Py_ssize_t,
|
||||||
|
@ -264,7 +263,6 @@ extern "C" {
|
||||||
// skipped _PyUnicode_FastCopyCharacters
|
// skipped _PyUnicode_FastCopyCharacters
|
||||||
|
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyUnicode_Fill(
|
pub fn PyUnicode_Fill(
|
||||||
unicode: *mut PyObject,
|
unicode: *mut PyObject,
|
||||||
start: Py_ssize_t,
|
start: Py_ssize_t,
|
||||||
|
|
|
@ -54,7 +54,6 @@ extern "C" {
|
||||||
// skipped non-limited _PyArg_Fini
|
// skipped non-limited _PyArg_Fini
|
||||||
|
|
||||||
#[cfg(Py_3_10)]
|
#[cfg(Py_3_10)]
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_10)))]
|
|
||||||
pub fn PyModule_AddObjectRef(
|
pub fn PyModule_AddObjectRef(
|
||||||
module: *mut PyObject,
|
module: *mut PyObject,
|
||||||
name: *const c_char,
|
name: *const c_char,
|
||||||
|
|
|
@ -353,11 +353,9 @@ extern "C" {
|
||||||
pub const Py_PRINT_RAW: c_int = 1; // No string quotes etc.
|
pub const Py_PRINT_RAW: c_int = 1; // No string quotes etc.
|
||||||
|
|
||||||
#[cfg(Py_3_10)]
|
#[cfg(Py_3_10)]
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_10)))]
|
|
||||||
pub const Py_TPFLAGS_DISALLOW_INSTANTIATION: c_ulong = 1 << 7;
|
pub const Py_TPFLAGS_DISALLOW_INSTANTIATION: c_ulong = 1 << 7;
|
||||||
|
|
||||||
#[cfg(Py_3_10)]
|
#[cfg(Py_3_10)]
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_10)))]
|
|
||||||
pub const Py_TPFLAGS_IMMUTABLETYPE: c_ulong = 1 << 8;
|
pub const Py_TPFLAGS_IMMUTABLETYPE: c_ulong = 1 << 8;
|
||||||
|
|
||||||
/// Set if the type object is dynamically allocated
|
/// Set if the type object is dynamically allocated
|
||||||
|
@ -468,10 +466,8 @@ extern "C" {
|
||||||
pub fn Py_DecRef(o: *mut PyObject);
|
pub fn Py_DecRef(o: *mut PyObject);
|
||||||
|
|
||||||
#[cfg(Py_3_10)]
|
#[cfg(Py_3_10)]
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_10)))]
|
|
||||||
pub fn Py_NewRef(obj: *mut PyObject) -> *mut PyObject;
|
pub fn Py_NewRef(obj: *mut PyObject) -> *mut PyObject;
|
||||||
#[cfg(Py_3_10)]
|
#[cfg(Py_3_10)]
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_10)))]
|
|
||||||
pub fn Py_XNewRef(obj: *mut PyObject) -> *mut PyObject;
|
pub fn Py_XNewRef(obj: *mut PyObject) -> *mut PyObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,10 @@ extern "C" {
|
||||||
pub fn PyGC_Collect() -> Py_ssize_t;
|
pub fn PyGC_Collect() -> Py_ssize_t;
|
||||||
|
|
||||||
#[cfg(Py_3_10)]
|
#[cfg(Py_3_10)]
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_10)))]
|
|
||||||
pub fn PyGC_Enable() -> c_int;
|
pub fn PyGC_Enable() -> c_int;
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_10)))]
|
|
||||||
pub fn PyGC_Disable() -> c_int;
|
pub fn PyGC_Disable() -> c_int;
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_10)))]
|
|
||||||
pub fn PyGC_IsEnabled() -> c_int;
|
pub fn PyGC_IsEnabled() -> c_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -375,7 +375,6 @@ extern "C" {
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyErr_SetInterrupt")]
|
#[cfg_attr(PyPy, link_name = "PyPyErr_SetInterrupt")]
|
||||||
pub fn PyErr_SetInterrupt();
|
pub fn PyErr_SetInterrupt();
|
||||||
#[cfg(Py_3_10)]
|
#[cfg(Py_3_10)]
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_10)))]
|
|
||||||
pub fn PyErr_SetInterruptEx(signum: c_int);
|
pub fn PyErr_SetInterruptEx(signum: c_int);
|
||||||
pub fn PyErr_SyntaxLocation(filename: *const c_char, lineno: c_int);
|
pub fn PyErr_SyntaxLocation(filename: *const c_char, lineno: c_int);
|
||||||
pub fn PyErr_SyntaxLocationEx(filename: *const c_char, lineno: c_int, col_offset: c_int);
|
pub fn PyErr_SyntaxLocationEx(filename: *const c_char, lineno: c_int, col_offset: c_int);
|
||||||
|
|
|
@ -13,37 +13,28 @@ opaque_struct!(PyInterpreterState);
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyInterpreterState_New() -> *mut PyInterpreterState;
|
pub fn PyInterpreterState_New() -> *mut PyInterpreterState;
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyInterpreterState_Clear(arg1: *mut PyInterpreterState);
|
pub fn PyInterpreterState_Clear(arg1: *mut PyInterpreterState);
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyInterpreterState_Delete(arg1: *mut PyInterpreterState);
|
pub fn PyInterpreterState_Delete(arg1: *mut PyInterpreterState);
|
||||||
|
|
||||||
#[cfg(all(Py_3_9, not(PyPy)))]
|
#[cfg(all(Py_3_9, not(PyPy)))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(all(Py_3_9, not(PyPy)))))]
|
|
||||||
pub fn PyInterpreterState_Get() -> *mut PyInterpreterState;
|
pub fn PyInterpreterState_Get() -> *mut PyInterpreterState;
|
||||||
|
|
||||||
#[cfg(all(Py_3_8, not(PyPy)))]
|
#[cfg(all(Py_3_8, not(PyPy)))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(all(Py_3_8, not(PyPy)))))]
|
|
||||||
pub fn PyInterpreterState_GetDict(arg1: *mut PyInterpreterState) -> *mut PyObject;
|
pub fn PyInterpreterState_GetDict(arg1: *mut PyInterpreterState) -> *mut PyObject;
|
||||||
|
|
||||||
#[cfg(all(Py_3_7, not(PyPy)))]
|
#[cfg(all(Py_3_7, not(PyPy)))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(all(Py_3_7, not(PyPy)))))]
|
|
||||||
pub fn PyInterpreterState_GetID(arg1: *mut PyInterpreterState) -> i64;
|
pub fn PyInterpreterState_GetID(arg1: *mut PyInterpreterState) -> i64;
|
||||||
|
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyState_AddModule(arg1: *mut PyObject, arg2: *mut PyModuleDef) -> c_int;
|
pub fn PyState_AddModule(arg1: *mut PyObject, arg2: *mut PyModuleDef) -> c_int;
|
||||||
|
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyState_RemoveModule(arg1: *mut PyModuleDef) -> c_int;
|
pub fn PyState_RemoveModule(arg1: *mut PyModuleDef) -> c_int;
|
||||||
|
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyState_FindModule(arg1: *mut PyModuleDef) -> *mut PyObject;
|
pub fn PyState_FindModule(arg1: *mut PyModuleDef) -> *mut PyObject;
|
||||||
|
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyThreadState_New")]
|
#[cfg_attr(PyPy, link_name = "PyPyThreadState_New")]
|
||||||
|
@ -68,7 +59,6 @@ extern "C" {
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyThreadState_GetDict")]
|
#[cfg_attr(PyPy, link_name = "PyPyThreadState_GetDict")]
|
||||||
pub fn PyThreadState_GetDict() -> *mut PyObject;
|
pub fn PyThreadState_GetDict() -> *mut PyObject;
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyThreadState_SetAsyncExc(arg1: c_long, arg2: *mut PyObject) -> c_int;
|
pub fn PyThreadState_SetAsyncExc(arg1: c_long, arg2: *mut PyObject) -> c_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +79,5 @@ extern "C" {
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyGILState_Release")]
|
#[cfg_attr(PyPy, link_name = "PyPyGILState_Release")]
|
||||||
pub fn PyGILState_Release(arg1: PyGILState_STATE);
|
pub fn PyGILState_Release(arg1: PyGILState_STATE);
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyGILState_GetThisThreadState() -> *mut PyThreadState;
|
pub fn PyGILState_GetThisThreadState() -> *mut PyThreadState;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,6 @@ pub unsafe fn PyAnySet_Check(ob: *mut PyObject) -> c_int {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg(Py_3_10)]
|
#[cfg(Py_3_10)]
|
||||||
#[cfg_attr(docsrs, doc(cfg(Py_3_10)))]
|
|
||||||
pub unsafe fn PySet_CheckExact(op: *mut PyObject) -> c_int {
|
pub unsafe fn PySet_CheckExact(op: *mut PyObject) -> c_int {
|
||||||
crate::ffi::Py_IS_TYPE(op, &mut PySet_Type)
|
crate::ffi::Py_IS_TYPE(op, &mut PySet_Type)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ extern "C" {
|
||||||
) -> c_int;
|
) -> c_int;
|
||||||
|
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyStructSequence_NewType(desc: *mut PyStructSequence_Desc) -> *mut PyTypeObject;
|
pub fn PyStructSequence_NewType(desc: *mut PyStructSequence_Desc) -> *mut PyTypeObject;
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyStructSequence_New")]
|
#[cfg_attr(PyPy, link_name = "PyPyStructSequence_New")]
|
||||||
pub fn PyStructSequence_New(_type: *mut PyTypeObject) -> *mut PyObject;
|
pub fn PyStructSequence_New(_type: *mut PyTypeObject) -> *mut PyObject;
|
||||||
|
@ -57,10 +56,8 @@ pub unsafe fn PyStructSequence_GET_ITEM(op: *mut PyObject, i: Py_ssize_t) -> *mu
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyStructSequence_SetItem(arg1: *mut PyObject, arg2: Py_ssize_t, arg3: *mut PyObject);
|
pub fn PyStructSequence_SetItem(arg1: *mut PyObject, arg2: Py_ssize_t, arg3: *mut PyObject);
|
||||||
|
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn PyStructSequence_GetItem(arg1: *mut PyObject, arg2: Py_ssize_t) -> *mut PyObject;
|
pub fn PyStructSequence_GetItem(arg1: *mut PyObject, arg2: Py_ssize_t) -> *mut PyObject;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,11 +166,9 @@ extern "C" {
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyUnicode_AsUTF8String")]
|
#[cfg_attr(PyPy, link_name = "PyPyUnicode_AsUTF8String")]
|
||||||
pub fn PyUnicode_AsUTF8String(unicode: *mut PyObject) -> *mut PyObject;
|
pub fn PyUnicode_AsUTF8String(unicode: *mut PyObject) -> *mut PyObject;
|
||||||
#[cfg(any(Py_3_10, all(Py_3_7, not(Py_LIMITED_API))))]
|
#[cfg(any(Py_3_10, all(Py_3_7, not(Py_LIMITED_API))))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(any(Py_3_10, not(Py_LIMITED_API)))))]
|
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyUnicode_AsUTF8AndSize")]
|
#[cfg_attr(PyPy, link_name = "PyPyUnicode_AsUTF8AndSize")]
|
||||||
pub fn PyUnicode_AsUTF8AndSize(unicode: *mut PyObject, size: *mut Py_ssize_t) -> *const c_char;
|
pub fn PyUnicode_AsUTF8AndSize(unicode: *mut PyObject, size: *mut Py_ssize_t) -> *const c_char;
|
||||||
#[cfg(not(any(Py_3_7, Py_LIMITED_API)))]
|
#[cfg(not(any(Py_3_7, Py_LIMITED_API)))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(any(Py_3_10, not(Py_LIMITED_API)))))]
|
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyUnicode_AsUTF8AndSize")]
|
#[cfg_attr(PyPy, link_name = "PyPyUnicode_AsUTF8AndSize")]
|
||||||
pub fn PyUnicode_AsUTF8AndSize(unicode: *mut PyObject, size: *mut Py_ssize_t) -> *mut c_char;
|
pub fn PyUnicode_AsUTF8AndSize(unicode: *mut PyObject, size: *mut Py_ssize_t) -> *mut c_char;
|
||||||
#[cfg_attr(PyPy, link_name = "PyPyUnicode_DecodeUTF32")]
|
#[cfg_attr(PyPy, link_name = "PyPyUnicode_DecodeUTF32")]
|
||||||
|
|
|
@ -69,7 +69,6 @@ pub(crate) fn gil_is_acquired() -> bool {
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
#[allow(clippy::collapsible_if)] // for if cfg!
|
#[allow(clippy::collapsible_if)] // for if cfg!
|
||||||
pub fn prepare_freethreaded_python() {
|
pub fn prepare_freethreaded_python() {
|
||||||
// Protect against race conditions when Python is not yet initialized and multiple threads
|
// Protect against race conditions when Python is not yet initialized and multiple threads
|
||||||
|
@ -135,7 +134,6 @@ pub fn prepare_freethreaded_python() {
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
#[allow(clippy::collapsible_if)] // for if cfg!
|
#[allow(clippy::collapsible_if)] // for if cfg!
|
||||||
pub unsafe fn with_embedded_python_interpreter<F, R>(f: F) -> R
|
pub unsafe fn with_embedded_python_interpreter<F, R>(f: F) -> R
|
||||||
where
|
where
|
||||||
|
|
|
@ -285,7 +285,6 @@ pub use crate::conversion::{
|
||||||
};
|
};
|
||||||
pub use crate::err::{PyDowncastError, PyErr, PyErrArguments, PyResult};
|
pub use crate::err::{PyDowncastError, PyErr, PyErrArguments, PyResult};
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub use crate::gil::{prepare_freethreaded_python, with_embedded_python_interpreter};
|
pub use crate::gil::{prepare_freethreaded_python, with_embedded_python_interpreter};
|
||||||
pub use crate::gil::{GILGuard, GILPool};
|
pub use crate::gil::{GILGuard, GILPool};
|
||||||
pub use crate::instance::{Py, PyNativeType, PyObject};
|
pub use crate::instance::{Py, PyNativeType, PyObject};
|
||||||
|
@ -351,7 +350,6 @@ pub mod proc_macro {
|
||||||
pub use pyo3_macros::{pyclass, pyfunction, pymethods, pymodule, pyproto};
|
pub use pyo3_macros::{pyclass, pyfunction, pymethods, pymodule, pyproto};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
|
||||||
#[cfg(feature = "macros")]
|
#[cfg(feature = "macros")]
|
||||||
pub use pyo3_macros::{pyclass, pyfunction, pymethods, pymodule, pyproto, FromPyObject};
|
pub use pyo3_macros::{pyclass, pyfunction, pymethods, pymodule, pyproto, FromPyObject};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![cfg(not(Py_LIMITED_API))]
|
#![cfg(not(Py_LIMITED_API))]
|
||||||
#![cfg_attr(docsrs, doc(cfg(not(Py_LIMITED_API))))]
|
|
||||||
//! Support for the Python `marshal` format.
|
//! Support for the Python `marshal` format.
|
||||||
|
|
||||||
use crate::ffi;
|
use crate::ffi;
|
||||||
|
|
|
@ -22,6 +22,5 @@ pub use crate::python::Python;
|
||||||
pub use crate::types::{PyAny, PyModule};
|
pub use crate::types::{PyAny, PyModule};
|
||||||
pub use crate::wrap_pyfunction;
|
pub use crate::wrap_pyfunction;
|
||||||
|
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
|
||||||
#[cfg(feature = "macros")]
|
#[cfg(feature = "macros")]
|
||||||
pub use pyo3_macros::{pyclass, pyfunction, pymethods, pymodule, pyproto, FromPyObject};
|
pub use pyo3_macros::{pyclass, pyfunction, pymethods, pymodule, pyproto, FromPyObject};
|
||||||
|
|
|
@ -37,7 +37,6 @@ impl PyComplex {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
|
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(any(Py_LIMITED_API, PyPy)))))]
|
|
||||||
mod not_limited_impls {
|
mod not_limited_impls {
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::ops::{Add, Div, Mul, Neg, Sub};
|
use std::ops::{Add, Div, Mul, Neg, Sub};
|
||||||
|
|
|
@ -39,7 +39,6 @@ impl PyDict {
|
||||||
/// Returns an error on invalid input. In the case of key collisions,
|
/// Returns an error on invalid input. In the case of key collisions,
|
||||||
/// this keeps the last entry seen.
|
/// this keeps the last entry seen.
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn from_sequence(py: Python, seq: PyObject) -> PyResult<&PyDict> {
|
pub fn from_sequence(py: Python, seq: PyObject) -> PyResult<&PyDict> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let dict = py.from_owned_ptr::<PyDict>(ffi::PyDict_New());
|
let dict = py.from_owned_ptr::<PyDict>(ffi::PyDict_New());
|
||||||
|
|
|
@ -71,7 +71,6 @@ impl<'p> Iterator for &'p PyIterator {
|
||||||
|
|
||||||
// PyIter_Check does not exist in the limited API until 3.8
|
// PyIter_Check does not exist in the limited API until 3.8
|
||||||
#[cfg(any(not(Py_LIMITED_API), Py_3_8))]
|
#[cfg(any(not(Py_LIMITED_API), Py_3_8))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(any(not(Py_LIMITED_API), Py_3_8))))]
|
|
||||||
impl<'v> PyTryFrom<'v> for PyIterator {
|
impl<'v> PyTryFrom<'v> for PyIterator {
|
||||||
fn try_from<V: Into<&'v PyAny>>(value: V) -> Result<&'v PyIterator, PyDowncastError<'v>> {
|
fn try_from<V: Into<&'v PyAny>>(value: V) -> Result<&'v PyIterator, PyDowncastError<'v>> {
|
||||||
let value = value.into();
|
let value = value.into();
|
||||||
|
|
|
@ -98,7 +98,6 @@ impl PyList {
|
||||||
///
|
///
|
||||||
/// Caller must verify that the index is within the bounds of the list.
|
/// Caller must verify that the index is within the bounds of the list.
|
||||||
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
|
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(any(Py_LIMITED_API, PyPy)))))]
|
|
||||||
pub unsafe fn get_item_unchecked(&self, index: usize) -> &PyAny {
|
pub unsafe fn get_item_unchecked(&self, index: usize) -> &PyAny {
|
||||||
let item = ffi::PyList_GET_ITEM(self.as_ptr(), index as Py_ssize_t);
|
let item = ffi::PyList_GET_ITEM(self.as_ptr(), index as Py_ssize_t);
|
||||||
// PyList_GET_ITEM return borrowed ptr; must make owned for safety (see #890).
|
// PyList_GET_ITEM return borrowed ptr; must make owned for safety (see #890).
|
||||||
|
|
|
@ -8,7 +8,6 @@ pub use self::bytearray::PyByteArray;
|
||||||
pub use self::bytes::PyBytes;
|
pub use self::bytes::PyBytes;
|
||||||
pub use self::complex::PyComplex;
|
pub use self::complex::PyComplex;
|
||||||
#[cfg(not(Py_LIMITED_API))]
|
#[cfg(not(Py_LIMITED_API))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(Py_LIMITED_API))))]
|
|
||||||
pub use self::datetime::{
|
pub use self::datetime::{
|
||||||
PyDate, PyDateAccess, PyDateTime, PyDelta, PyDeltaAccess, PyTime, PyTimeAccess, PyTzInfo,
|
PyDate, PyDateAccess, PyDateTime, PyDelta, PyDeltaAccess, PyTime, PyTimeAccess, PyTzInfo,
|
||||||
};
|
};
|
||||||
|
@ -225,7 +224,6 @@ mod bytearray;
|
||||||
mod bytes;
|
mod bytes;
|
||||||
mod complex;
|
mod complex;
|
||||||
#[cfg(not(Py_LIMITED_API))]
|
#[cfg(not(Py_LIMITED_API))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(Py_LIMITED_API))))]
|
|
||||||
mod datetime;
|
mod datetime;
|
||||||
mod dict;
|
mod dict;
|
||||||
mod floatob;
|
mod floatob;
|
||||||
|
|
|
@ -176,7 +176,6 @@ impl PyModule {
|
||||||
///
|
///
|
||||||
/// May fail if the module does not have a `__file__` attribute.
|
/// May fail if the module does not have a `__file__` attribute.
|
||||||
#[cfg(not(all(windows, PyPy)))]
|
#[cfg(not(all(windows, PyPy)))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(all(windows, PyPy)))))]
|
|
||||||
pub fn filename(&self) -> PyResult<&str> {
|
pub fn filename(&self) -> PyResult<&str> {
|
||||||
use crate::types::PyString;
|
use crate::types::PyString;
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -183,7 +183,6 @@ impl PySequence {
|
||||||
/// number of keys for which `self[key] == value`.
|
/// number of keys for which `self[key] == value`.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg(not(PyPy))]
|
#[cfg(not(PyPy))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(PyPy))))]
|
|
||||||
pub fn count<V>(&self, value: V) -> PyResult<usize>
|
pub fn count<V>(&self, value: V) -> PyResult<usize>
|
||||||
where
|
where
|
||||||
V: ToBorrowedObject,
|
V: ToBorrowedObject,
|
||||||
|
|
|
@ -16,7 +16,6 @@ use std::str;
|
||||||
/// Python internally stores strings in various representations. This enumeration
|
/// Python internally stores strings in various representations. This enumeration
|
||||||
/// represents those variations.
|
/// represents those variations.
|
||||||
#[cfg(not(any(Py_LIMITED_API, target_endian = "big")))]
|
#[cfg(not(any(Py_LIMITED_API, target_endian = "big")))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(any(Py_LIMITED_API, target_endian = "big")))))]
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
pub enum PyStringData<'a> {
|
pub enum PyStringData<'a> {
|
||||||
/// UCS1 representation.
|
/// UCS1 representation.
|
||||||
|
@ -225,7 +224,6 @@ impl PyString {
|
||||||
///
|
///
|
||||||
/// For example, it is known not to work on big-endian platforms.
|
/// For example, it is known not to work on big-endian platforms.
|
||||||
#[cfg(not(any(Py_LIMITED_API, target_endian = "big")))]
|
#[cfg(not(any(Py_LIMITED_API, target_endian = "big")))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(any(Py_LIMITED_API, target_endian = "big")))))]
|
|
||||||
pub unsafe fn data(&self) -> PyResult<PyStringData<'_>> {
|
pub unsafe fn data(&self) -> PyResult<PyStringData<'_>> {
|
||||||
let ptr = self.as_ptr();
|
let ptr = self.as_ptr();
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,6 @@ impl PyTuple {
|
||||||
///
|
///
|
||||||
/// Caller must verify that the index is within the bounds of the tuple.
|
/// Caller must verify that the index is within the bounds of the tuple.
|
||||||
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
|
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(any(Py_LIMITED_API, PyPy)))))]
|
|
||||||
pub unsafe fn get_item_unchecked(&self, index: usize) -> &PyAny {
|
pub unsafe fn get_item_unchecked(&self, index: usize) -> &PyAny {
|
||||||
let item = ffi::PyTuple_GET_ITEM(self.as_ptr(), index as Py_ssize_t);
|
let item = ffi::PyTuple_GET_ITEM(self.as_ptr(), index as Py_ssize_t);
|
||||||
self.py().from_borrowed_ptr(item)
|
self.py().from_borrowed_ptr(item)
|
||||||
|
@ -142,7 +141,6 @@ impl PyTuple {
|
||||||
|
|
||||||
/// Returns `self` as a slice of objects.
|
/// Returns `self` as a slice of objects.
|
||||||
#[cfg(not(Py_LIMITED_API))]
|
#[cfg(not(Py_LIMITED_API))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(not(Py_LIMITED_API))))]
|
|
||||||
pub fn as_slice(&self) -> &[&PyAny] {
|
pub fn as_slice(&self) -> &[&PyAny] {
|
||||||
// This is safe because &PyAny has the same memory layout as *mut ffi::PyObject,
|
// This is safe because &PyAny has the same memory layout as *mut ffi::PyObject,
|
||||||
// and because tuples are immutable.
|
// and because tuples are immutable.
|
||||||
|
|
Loading…
Reference in a new issue