python3_sys/lib.rs
1#![no_std]
2#![allow(
3 non_camel_case_types,
4 non_snake_case,
5 non_upper_case_globals,
6 unused_parens,
7 clippy::missing_safety_doc,
8 clippy::transmute_ptr_to_ptr,
9 clippy::unused_unit,
10 clippy::identity_op
11)]
12#![cfg_attr(Py_LIMITED_API, allow(unused_imports))]
13
14// old: marked with TODO
15// Based on the headers of Python 3.4.3
16// Supports the stable ABI (PEP 384) only.
17
18// new:
19// Based on the headers of Python 3.3.0, 3.4.0 and 3.5.0.
20
21// Macro for marking parts of the Python headers as ignored.
22macro_rules! ignore {
23 ( $( $_tokens:tt )* ) => {};
24}
25
26pub use crate::bltinmodule::*;
27pub use crate::boolobject::*;
28pub use crate::bytearrayobject::*;
29pub use crate::bytesobject::*;
30pub use crate::ceval::*;
31pub use crate::code::*;
32pub use crate::codecs::*;
33pub use crate::compile::*;
34pub use crate::complexobject::*;
35pub use crate::descrobject::*;
36pub use crate::dictobject::*;
37pub use crate::enumobject::*;
38pub use crate::eval::*;
39pub use crate::fileobject::*;
40#[cfg(Py_3_5)]
41pub use crate::fileutils::*;
42pub use crate::floatobject::*;
43pub use crate::frameobject::PyFrameObject;
44pub use crate::import::*;
45#[cfg(all(Py_3_8, not(Py_LIMITED_API)))]
46pub use crate::initconfig::*;
47pub use crate::intrcheck::*;
48pub use crate::iterobject::*;
49pub use crate::listobject::*;
50pub use crate::longobject::*;
51pub use crate::marshal::*;
52pub use crate::memoryobject::*;
53pub use crate::methodobject::*;
54pub use crate::modsupport::*;
55pub use crate::moduleobject::*;
56pub use crate::object::*;
57pub use crate::objectabstract::*;
58pub use crate::objimpl::*;
59#[cfg(Py_3_6)]
60pub use crate::osmodule::*;
61pub use crate::pyarena::*;
62#[cfg(any(Py_3_11, not(Py_LIMITED_API)))]
63pub use crate::pybuffer::*;
64pub use crate::pycapsule::*;
65pub use crate::pydebug::*;
66pub use crate::pyerrors::*;
67#[cfg(Py_3_4)]
68pub use crate::pyhash::*;
69pub use crate::pylifecycle::*;
70pub use crate::pymem::*;
71pub use crate::pyport::*;
72pub use crate::pystate::*;
73pub use crate::pystrtod::*;
74pub use crate::pythonrun::*;
75pub use crate::rangeobject::*;
76pub use crate::setobject::*;
77pub use crate::sliceobject::*;
78pub use crate::structseq::*;
79pub use crate::sysmodule::*;
80pub use crate::traceback::*;
81pub use crate::tupleobject::*;
82pub use crate::typeslots::*;
83pub use crate::unicodeobject::*;
84pub use crate::warnings::*;
85pub use crate::weakrefobject::*;
86
87mod pyport;
88
89// contains nothing of interest for Rust
90// mod pymacro;
91
92// contains nothing of interest for Rust; moved to internal/pycore_atomic.h in 3.8
93// mod pyatomic;
94
95// contains nothing of interest for Rust
96// mod pymath;
97
98// contains nothing of interest; moved to cpython/pytime.h in 3.10
99// [cfg(not(Py_LIMITED_API))]
100// mod pytime;
101
102mod pymem;
103
104#[cfg(any(Py_3_11, not(Py_LIMITED_API)))]
105mod pybuffer;
106
107mod object;
108
109mod objimpl;
110
111mod typeslots;
112
113#[cfg(Py_3_4)]
114mod pyhash;
115
116mod pydebug;
117
118mod bytearrayobject;
119
120mod bytesobject;
121
122mod unicodeobject;
123
124// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
125mod longobject;
126
127// TODO excluded by PEP-384
128// mod longintrepr;
129
130// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
131mod boolobject;
132
133// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
134mod floatobject;
135
136// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
137mod complexobject;
138
139// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
140mod rangeobject;
141
142// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
143mod memoryobject;
144
145mod tupleobject;
146
147// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
148mod listobject;
149
150// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
151mod dictobject;
152
153// TODO new in 3.5
154// mod odictobject;
155
156// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
157mod enumobject;
158
159// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
160mod setobject;
161
162// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
163mod methodobject;
164
165// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
166mod moduleobject;
167
168// TODO excluded by PEP-384
169// mod funcobject;
170
171// TODO excluded by PEP-384
172// mod classobject;
173
174// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
175mod fileobject;
176
177// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
178mod pycapsule;
179
180// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
181mod traceback;
182
183// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
184mod sliceobject;
185
186// TODO excluded by PEP-384
187// mod cellobject;
188
189// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
190mod iterobject;
191
192// TODO excluded by PEP-384
193// mod genobject;
194
195// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
196mod descrobject;
197
198// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
199mod warnings;
200
201// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
202mod weakrefobject;
203
204// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
205mod structseq;
206
207// TODO
208// mod namespaceobject;
209
210// TODO
211// mod picklebufobject;
212
213// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
214mod codecs;
215
216// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
217mod pyerrors;
218
219// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
220mod pystate;
221
222// TODO
223// #[cfg(Py_3_7)]
224// mod context;
225
226#[cfg(Py_LIMITED_API)]
227mod pyarena {}
228
229// TODO: incomplete
230#[cfg(not(Py_LIMITED_API))]
231mod pyarena;
232
233// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
234mod modsupport;
235
236// TODO some functions need to be moved to pylifecycle
237mod pythonrun;
238
239mod pylifecycle;
240
241// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
242mod ceval;
243
244// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
245mod sysmodule;
246
247#[cfg(Py_3_6)]
248mod osmodule;
249
250// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
251mod intrcheck;
252
253// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
254mod import;
255
256mod objectabstract;
257
258// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
259mod bltinmodule;
260
261#[cfg(Py_LIMITED_API)]
262mod code {}
263
264#[cfg(not(Py_LIMITED_API))]
265mod code;
266
267// TODO: incomplete
268mod compile;
269
270// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
271mod eval;
272
273// TODO excluded by PEP-384
274// mod pyctype;
275
276// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
277mod pystrtod;
278
279// TODO nothing interesting for Rust?
280// mod pystrcmp;
281
282// TODO excluded by PEP-384
283// mod dtoa;
284
285#[cfg(Py_3_5)]
286mod fileutils;
287
288// TODO probably not interesting for rust
289// mod pyfpe;
290
291// TODO probably not interesting for rust
292// mod tracemalloc;
293
294// Additional headers that are not exported by Python.h
295
296// TODO supports PEP-384 only; needs adjustment for Python 3.3 and 3.5
297pub mod structmember;
298
299pub mod frameobject;
300
301mod marshal;
302
303#[cfg(all(Py_3_8, not(Py_LIMITED_API)))]
304mod initconfig;