Fix #10: Windows support.

We keep the #[link] attributes in #[cfg_attr(windows)] so that we don't require a nightly Rust build on non-Windows platforms.
This can be simplified once RFC 1717 is available in a stable rust version.

This commit also increases the minimum Rust version to 1.13.
This commit is contained in:
Daniel Grunwald 2016-12-17 15:04:39 +01:00
parent 278c1aece8
commit f6ed2bbae9
104 changed files with 223 additions and 217 deletions

View File

@ -5,7 +5,7 @@ python:
- "3.4"
- "3.5"
env:
- RUST_VERSION=1.7.0
- RUST_VERSION=1.13.0
- RUST_VERSION=nightly
sudo: false
install:

View File

@ -19,7 +19,8 @@ Supported Python versions:
* Python 3.5
Supported Rust version:
* Rust 1.7.0 or later
* Rust 1.13.0 or later
* On Windows, we require rustc 1.15.0-nightly
# Usage
@ -35,21 +36,23 @@ Example program displaying the value of `sys.version`:
```rust
extern crate cpython;
use cpython::Python;
use cpython::ObjectProtocol; //for call method
use cpython::{Python, PyDict, PyResult};
fn main() {
let gil = Python::acquire_gil();
let py = gil.python();
hello(gil.python()).unwrap();
}
let sys = py.import("sys").unwrap();
let version: String = sys.get(py, "version").unwrap().extract(py).unwrap();
fn hello(py: Python) -> PyResult<()> {
let sys = py.import("sys")?;
let version: String = sys.get(py, "version")?.extract(py)?;
let os = py.import("os").unwrap();
let getenv = os.get(py, "getenv").unwrap();
let user: String = getenv.call(py, ("USER",), None).unwrap().extract(py).unwrap();
let locals = PyDict::new(py);
locals.set_item(py, "os", py.import("os")?)?;
let user: String = py.eval("os.getenv('USER') or os.getenv('USERNAME')", None, Some(&locals))?.extract(py)?;
println!("Hello {}, I'm Python {}", user, version);
Ok(())
}
```

View File

@ -22,6 +22,6 @@ install:
build_script:
- set PATH=C:\Python27-x64;%PATH%&& cargo build --verbose --features python27-sys --no-default-features
- set PATH=C:\Python34-x64;%PATH%&& cargo build --verbose --features python3-sys --no-default-features
test: false
#test_script:
# - cargo test --verbose
test_script:
- set PATH=C:\Python27-x64;%PATH%&& cargo test --verbose --features python27-sys --no-default-features
- set PATH=C:\Python34-x64;%PATH%&& cargo test --verbose --features python3-sys --no-default-features

View File

@ -1,18 +1,20 @@
extern crate cpython;
use cpython::Python;
use cpython::ObjectProtocol; //for call method
use cpython::{Python, PyDict, PyResult};
fn main() {
let gil = Python::acquire_gil();
let py = gil.python();
hello(gil.python()).unwrap();
}
let sys = py.import("sys").unwrap();
let version: String = sys.get(py, "version").unwrap().extract(py).unwrap();
fn hello(py: Python) -> PyResult<()> {
let sys = py.import("sys")?;
let version: String = sys.get(py, "version")?.extract(py)?;
let os = py.import("os").unwrap();
let getenv = os.get(py, "getenv").unwrap();
let user: String = getenv.call(py, ("USER",), None).unwrap().extract(py).unwrap();
let locals = PyDict::new(py);
locals.set_item(py, "os", py.import("os")?)?;
let user: String = py.eval("os.getenv('USER') or os.getenv('USERNAME')", None, Some(&locals))?.extract(py)?;
println!("Hello {}, I'm Python {}", user, version);
Ok(())
}

View File

@ -226,7 +226,7 @@ fn get_interpreter_version(line: &str) -> Result<PythonVersion, String> {
#[cfg(target_os="windows")]
fn get_rustc_link_lib(version: &PythonVersion, _: bool) -> Result<String, String> {
// Py_ENABLE_SHARED doesn't seem to be present on windows.
Ok(format!("cargo:rustc-link-lib=python{}{}", version.major,
Ok(format!("cargo:rustc-link-lib=pythonXY:python{}{}", version.major,
match version.minor {
Some(minor) => minor.to_string(),
None => "".to_owned()

View File

@ -4,8 +4,7 @@ use intobject::PyIntObject;
pub type PyBoolObject = PyIntObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyBool_Type: PyTypeObject;
static mut _Py_ZeroStruct: PyIntObject;
static mut _Py_TrueStruct: PyIntObject;

View File

@ -2,7 +2,7 @@ use libc::{c_void, c_int};
use object::*;
use pyport::Py_ssize_t;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyBuffer_Type: PyTypeObject;
}
@ -14,7 +14,7 @@ pub unsafe fn PyBuffer_Check(op : *mut PyObject) -> c_int {
pub const Py_END_OF_BUFFER: Py_ssize_t = -1;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyBuffer_FromObject(base: *mut PyObject, offset: Py_ssize_t,
size: Py_ssize_t) -> *mut PyObject;
pub fn PyBuffer_FromReadWriteObject(base: *mut PyObject,

View File

@ -17,7 +17,7 @@ struct PyByteArrayObject {
pub ob_bytes: *mut c_char,
}*/
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyByteArray_Type: PyTypeObject;
pub static mut PyByteArrayIter_Type: PyTypeObject;
}
@ -31,7 +31,7 @@ pub unsafe fn PyByteArray_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == u) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyByteArray_FromObject(o: *mut PyObject) -> *mut PyObject;
pub fn PyByteArray_Concat(a: *mut PyObject, b: *mut PyObject)
-> *mut PyObject;

View File

@ -14,7 +14,7 @@ struct PyCellObject {
pub ob_ref: *mut PyObject
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyCell_Type: PyTypeObject;
}
@ -23,7 +23,7 @@ pub unsafe fn PyCell_Check(op: *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyCell_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyCell_New(obj: *mut PyObject) -> *mut PyObject;
pub fn PyCell_Get(op: *mut PyObject) -> *mut PyObject;
pub fn PyCell_Set(op: *mut PyObject, obj: *mut PyObject) -> c_int;

View File

@ -5,7 +5,7 @@ use frameobject::PyFrameObject;
use pystate::{PyThreadState, Py_tracefunc};
use pythonrun::PyCompilerFlags;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyEval_CallObjectWithKeywords(callable: *mut PyObject,
args: *mut PyObject,
kwds: *mut PyObject)
@ -53,7 +53,7 @@ extern "C" {
}
#[cfg(py_sys_config="WITH_THREAD")]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyEval_ThreadsInitialized() -> c_int;
pub fn PyEval_InitThreads();
pub fn PyEval_AcquireLock();

View File

@ -49,7 +49,7 @@ pub struct PyMethodObject {
pub im_weakreflist: *mut PyObject,
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyClass_Type: PyTypeObject;
pub static mut PyInstance_Type: PyTypeObject;
pub static mut PyMethod_Type: PyTypeObject;
@ -73,7 +73,7 @@ pub unsafe fn PyMethod_Check(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == u) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyClass_New(arg1: *mut PyObject, arg2: *mut PyObject,
arg3: *mut PyObject) -> *mut PyObject;
pub fn PyInstance_New(arg1: *mut PyObject, arg2: *mut PyObject,

View File

@ -1,7 +1,7 @@
use libc::{c_void, c_char, c_int};
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyCObject_Type: PyTypeObject;
}
@ -10,7 +10,7 @@ pub unsafe fn PyCObject_Check(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyCObject_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyCObject_FromVoidPtr(cobj: *mut c_void,
destruct:
Option<unsafe extern "C" fn

View File

@ -51,7 +51,7 @@ pub const CO_FUTURE_UNICODE_LITERALS : c_int = 0x20000;
pub const CO_MAXBLOCKS : usize = 20;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyCode_Type: PyTypeObject;
pub fn PyCode_New(arg1: c_int, arg2: c_int,

View File

@ -18,7 +18,7 @@ pub const FUTURE_WITH_STATEMENT : &'static str = "with_statement";
pub const FUTURE_PRINT_FUNCTION : &'static str = "print_function";
pub const FUTURE_UNICODE_LITERALS : &'static str = "unicode_literals";
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyNode_Compile(arg1: *mut Struct__node,
arg2: *const c_char) -> *mut PyCodeObject;
pub fn PyAST_Compile(arg1: *mut Struct__mod, arg2: *const c_char,

View File

@ -9,7 +9,7 @@ pub struct Py_complex {
pub imag: c_double
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn _Py_c_sum(left: Py_complex, right: Py_complex) -> Py_complex;
pub fn _Py_c_diff(left: Py_complex, right: Py_complex) -> Py_complex;
pub fn _Py_c_neg(complex: Py_complex) -> Py_complex;
@ -31,7 +31,7 @@ pub struct PyComplexObject {
pub cval: Py_complex
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyComplex_Type: PyTypeObject;
}
@ -46,7 +46,7 @@ pub unsafe fn PyComplex_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == u) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyComplex_FromCComplex(v: Py_complex) -> *mut PyObject;
pub fn PyComplex_FromDoubles(real: c_double,
imag: c_double) -> *mut PyObject;

View File

@ -53,7 +53,7 @@ impl Clone for wrapperbase {
pub const PyWrapperFlag_KEYWORDS : c_int = 1;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyWrapperDescr_Type: PyTypeObject;
pub static mut PyDictProxy_Type: PyTypeObject;
pub static mut PyGetSetDescr_Type: PyTypeObject;
@ -78,7 +78,7 @@ pub unsafe fn PyDescr_IsData(d: *mut PyObject) -> c_int {
(*Py_TYPE(d)).tp_descr_set.is_some() as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
//pub fn PyDictProxy_New(arg1: *mut PyObject) -> *mut PyObject;
// PyDictProxy_New is also defined in dictobject.h
pub fn PyWrapper_New(arg1: *mut PyObject, arg2: *mut PyObject)

View File

@ -4,7 +4,7 @@ use object::*;
//pub enum PyDictObject { /* representation hidden */ }
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyDict_Type: PyTypeObject;
pub static mut PyDictIterKey_Type: PyTypeObject;
pub static mut PyDictIterValue_Type: PyTypeObject;
@ -25,7 +25,7 @@ pub unsafe fn PyDict_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == u) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyDict_New() -> *mut PyObject;
pub fn PyDictProxy_New(dict: *mut PyObject) -> *mut PyObject;
pub fn PyDict_Clear(mp: *mut PyObject);

View File

@ -1,6 +1,6 @@
use object::PyTypeObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyEnum_Type: PyTypeObject;
pub static mut PyReversed_Type: PyTypeObject;
}

View File

@ -2,7 +2,7 @@ use libc::c_int;
use object::PyObject;
use code::PyCodeObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyEval_EvalCode(arg1: *mut PyCodeObject, arg2: *mut PyObject,
arg3: *mut PyObject) -> *mut PyObject;
pub fn PyEval_EvalCodeEx(co: *mut PyCodeObject, globals: *mut PyObject,

View File

@ -1,7 +1,7 @@
use libc::{c_char, c_int, size_t, FILE};
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyFile_Type: PyTypeObject;
}
@ -18,7 +18,7 @@ pub unsafe fn PyFile_CheckExact(op : *mut PyObject) -> c_int {
pub const PY_STDIOTEXTMODE : &'static str = "b";
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyFile_FromString(arg1: *mut c_char,
arg2: *mut c_char) -> *mut PyObject;
pub fn PyFile_SetBufSize(arg1: *mut PyObject, arg2: c_int);

View File

@ -14,7 +14,7 @@ struct PyFloatObject {
pub ob_fval: c_double
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyFloat_Type: PyTypeObject;
}
@ -31,7 +31,7 @@ pub unsafe fn PyFloat_CheckExact(op : *mut PyObject) -> c_int {
pub const PyFloat_STR_PRECISION : c_int = 12;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyFloat_FromString(str: *mut PyObject,
pend: *mut *mut c_char)
-> *mut PyObject;

View File

@ -52,7 +52,7 @@ pub struct PyFrameObject {
pub f_localsplus: [*mut PyObject; 1] /* locals+stack, dynamically sized */
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyFrame_Type: PyTypeObject;
}
@ -66,7 +66,7 @@ pub unsafe fn PyFrame_Check(op: *mut PyObject) -> c_int {
// ((*f).f_builtins != (*(*(*f).f_tstate).interp).builtins) as c_int
//}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyFrame_New(tstate: *mut PyThreadState, code: *mut PyCodeObject,
globals: *mut PyObject, locals: *mut PyObject) -> *mut PyFrameObject;

View File

@ -1,7 +1,7 @@
use libc::c_int;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyFunction_Type: PyTypeObject;
}
@ -12,7 +12,7 @@ pub unsafe fn PyFunction_Check(op : *mut PyObject) -> c_int {
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyFunction_New(code: *mut PyObject, globals: *mut PyObject)
-> *mut PyObject;
pub fn PyFunction_GetCode(f: *mut PyObject) -> *mut PyObject;

View File

@ -18,7 +18,7 @@ pub struct PyGenObject {
pub gi_weakreflist: *mut PyObject
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyGen_Type: PyTypeObject;
}
@ -32,7 +32,7 @@ pub unsafe fn PyGen_CheckExact(op: *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyGen_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyGen_New(frame: *mut PyFrameObject) -> *mut PyObject;
pub fn PyGen_NeedsFinalizing(op: *mut PyGenObject) -> c_int;
}

View File

@ -28,7 +28,7 @@ pub unsafe fn PyImport_ImportModuleEx(name: *mut c_char,
PyImport_ImportModuleLevel(name, globals, locals, fromlist, -1)
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyImport_ImportModule(name: *const c_char)
-> *mut PyObject;
pub fn PyImport_ImportModuleNoBlock(name: *const c_char)

View File

@ -14,7 +14,7 @@ pub struct PyIntObject {
pub ob_ival: c_long
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyInt_Type: PyTypeObject;
}
@ -29,7 +29,7 @@ pub unsafe fn PyInt_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == u) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyInt_FromString(str: *mut c_char,
pend: *mut *mut c_char,
base: c_int) -> *mut PyObject;

View File

@ -1,7 +1,7 @@
use libc::c_int;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PySeqIter_Type: PyTypeObject;
pub static mut PyCallIter_Type: PyTypeObject;

View File

@ -16,7 +16,7 @@ pub struct PyListObject {
pub allocated: Py_ssize_t,
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyList_Type: PyTypeObject;
}
@ -49,7 +49,7 @@ pub unsafe fn PyList_SET_ITEM(op: *mut PyObject, i: Py_ssize_t, v: *mut PyObject
*(*(op as *mut PyListObject)).ob_item.offset(i as isize) = v;
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyList_New(size: Py_ssize_t) -> *mut PyObject;
pub fn PyList_Size(list: *mut PyObject) -> Py_ssize_t;
pub fn PyList_GetItem(list: *mut PyObject, index: Py_ssize_t)

View File

@ -5,7 +5,7 @@ use object::*;
//enum PyLongObject { /* representation hidden */ }
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyLong_Type: PyTypeObject;
}
@ -20,7 +20,7 @@ pub unsafe fn PyLong_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == u) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyLong_FromLong(v: c_long) -> *mut PyObject;
pub fn PyLong_FromUnsignedLong(v: c_ulong) -> *mut PyObject;
pub fn PyLong_FromSsize_t(v: Py_ssize_t) -> *mut PyObject;

View File

@ -2,7 +2,7 @@ use libc::{c_int, c_char};
use pyport::Py_ssize_t;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyMemoryView_Type: PyTypeObject;
}
@ -23,7 +23,7 @@ pub unsafe fn PyMemoryView_GET_BASE(op : *mut PyObject) -> *mut PyObject {
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyMemoryView_GetContiguous(base: *mut PyObject,
buffertype: c_int,
fort: c_char) -> *mut PyObject;

View File

@ -3,7 +3,7 @@ use core::ptr;
//use pyport::Py_ssize_t;
use object::{PyObject, PyTypeObject, Py_TYPE};
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyCFunction_Type: PyTypeObject;
}
@ -26,7 +26,7 @@ pub type PyNoArgsFunction =
-> *mut PyObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyCFunction_GetFunction(f: *mut PyObject) -> Option<PyCFunction>;
pub fn PyCFunction_GetSelf(f: *mut PyObject) -> *mut PyObject;
pub fn PyCFunction_GetFlags(f: *mut PyObject) -> c_int;
@ -92,7 +92,7 @@ struct PyCFunctionObject {
}
*/
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn Py_FindMethod(methods: *mut PyMethodDef, slf: *mut PyObject,
name: *const c_char) -> *mut PyObject;
pub fn PyCFunction_NewEx(ml: *mut PyMethodDef, slf: *mut PyObject,

View File

@ -4,7 +4,7 @@ use pyport::Py_ssize_t;
use object::PyObject;
use methodobject::PyMethodDef;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyArg_Parse(args: *mut PyObject, format: *const c_char, ...)
-> c_int;
pub fn PyArg_ParseTuple(args: *mut PyObject,

View File

@ -1,7 +1,7 @@
use libc::{c_char, c_int};
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyModule_Type: PyTypeObject;
pub fn PyModule_New(name: *const c_char) -> *mut PyObject;

View File

@ -614,7 +614,7 @@ pub unsafe fn PyHeapType_GET_MEMBERS(etype: *mut PyHeapTypeObject) -> *mut ::str
(etype as *mut u8).offset(basicsize as isize) as *mut ::structmember::PyMemberDef
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyType_IsSubtype(a: *mut PyTypeObject, b: *mut PyTypeObject) -> c_int;
}
@ -623,7 +623,7 @@ pub unsafe fn PyObject_TypeCheck(ob: *mut PyObject, tp: *mut PyTypeObject) -> c_
(Py_TYPE(ob) == tp || PyType_IsSubtype(Py_TYPE(ob), tp) != 0) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyType_Type: PyTypeObject;
pub static mut PyBaseObject_Type: PyTypeObject;
pub static mut PySuper_Type: PyTypeObject;
@ -639,7 +639,7 @@ pub unsafe fn PyType_CheckExact(op: *mut PyObject) -> c_int {
(Py_TYPE(op) == (&mut PyType_Type as *mut _)) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyType_Ready(t: *mut PyTypeObject) -> c_int;
pub fn PyType_GenericAlloc(t: *mut PyTypeObject, nitems: Py_ssize_t)
-> *mut PyObject;
@ -666,7 +666,7 @@ pub unsafe fn PyObject_Bytes(o: *mut PyObject) -> *mut PyObject {
PyObject_Str(o)
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
#[cfg(py_sys_config="Py_USING_UNICODE")]
pub fn PyObject_Unicode(o: *mut PyObject) -> *mut PyObject;
@ -862,7 +862,7 @@ pub unsafe fn Py_XDECREF(op : *mut PyObject) {
}
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn Py_IncRef(o: *mut PyObject);
pub fn Py_DecRef(o: *mut PyObject);
@ -888,7 +888,7 @@ pub const Py_NE : c_int = 3;
pub const Py_GT : c_int = 4;
pub const Py_GE : c_int = 5;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
fn _PyTrash_thread_deposit_object(o: *mut PyObject);
fn _PyTrash_thread_destroy_chain();
}

View File

@ -13,7 +13,7 @@ pub unsafe fn PyObject_DelAttr(o: *mut PyObject, attr_name: *mut PyObject) -> c_
PyObject_SetAttr(o, attr_name, ptr::null_mut())
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyObject_Cmp(o1: *mut PyObject, o2: *mut PyObject,
result: *mut c_int) -> c_int;
pub fn PyObject_Call(callable_object: *mut PyObject, args: *mut PyObject,

View File

@ -2,7 +2,7 @@ use libc::{c_void, c_char, c_int, size_t};
use pyport::Py_ssize_t;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyObject_Malloc(arg1: size_t) -> *mut c_void;
pub fn PyObject_Realloc(arg1: *mut c_void, arg2: size_t)
-> *mut c_void;

View File

@ -4,7 +4,7 @@ use object::PyObject;
#[allow(missing_copy_implementations)]
pub enum PyArena { }
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyArena_New() -> *mut PyArena;
pub fn PyArena_Free(arg1: *mut PyArena);
pub fn PyArena_Malloc(arg1: *mut PyArena, size: size_t)

View File

@ -1,7 +1,7 @@
use libc::{c_void, c_char, c_int};
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyCapsule_Type: PyTypeObject;
}
@ -12,7 +12,7 @@ pub unsafe fn PyCapsule_CheckExact(ob: *mut PyObject) -> c_int {
(Py_TYPE(ob) == &mut PyCapsule_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyCapsule_New(pointer: *mut c_void,
name: *const c_char,
destructor: Option<PyCapsule_Destructor>) -> *mut PyObject;

View File

@ -1,6 +1,6 @@
use libc::{c_char, c_int};
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut Py_DebugFlag: c_int;
pub static mut Py_VerboseFlag: c_int;
pub static mut Py_InteractiveFlag: c_int;

View File

@ -6,7 +6,7 @@ use stringobject::PyString_AS_STRING;
#[cfg(py_sys_config="Py_USING_UNICODE")]
use unicodeobject::Py_UNICODE;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyErr_SetNone(arg1: *mut PyObject);
pub fn PyErr_SetObject(arg1: *mut PyObject, arg2: *mut PyObject);
pub fn PyErr_SetString(arg1: *mut PyObject, arg2: *const c_char);
@ -54,7 +54,7 @@ pub unsafe fn PyExceptionInstance_Class(x: *mut PyObject) -> *mut PyObject {
}
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyExc_BaseException: *mut PyObject;
pub static mut PyExc_Exception: *mut PyObject;
pub static mut PyExc_StopIteration: *mut PyObject;
@ -138,7 +138,7 @@ extern "C" {
}
#[cfg(py_sys_config="Py_USING_UNICODE")]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyUnicodeDecodeError_Create(arg1: *const c_char,
arg2: *const c_char,
arg3: Py_ssize_t, arg4: Py_ssize_t,

View File

@ -1,6 +1,6 @@
use libc::{c_void, size_t};
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyMem_Malloc(n: size_t) -> *mut c_void;
pub fn PyMem_Realloc(p: *mut c_void, n: size_t)
-> *mut c_void;

View File

@ -59,7 +59,7 @@ pub enum PyGILState_STATE {
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
static mut _PyThreadState_Current: *mut PyThreadState;
//static mut _PyThreadState_GetFrame: PyThreadFrameGetter;

View File

@ -25,7 +25,7 @@ pub enum Struct__node { }
#[allow(missing_copy_implementations)]
pub enum Struct_symtable { }
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn Py_SetProgramName(arg1: *mut c_char);
pub fn Py_GetProgramName() -> *mut c_char;
pub fn Py_SetPythonHome(arg1: *mut c_char);

View File

@ -1,7 +1,7 @@
use libc::c_int;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyRange_Type: PyTypeObject;
}

View File

@ -4,7 +4,7 @@ use object::*;
//enum PySetObject { /* representation hidden */ }
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PySet_Type: PyTypeObject;
pub static mut PyFrozenSet_Type: PyTypeObject;
}
@ -41,7 +41,7 @@ pub unsafe fn PyFrozenSet_Check(ob : *mut PyObject) -> c_int {
(Py_TYPE(ob) == f || PyType_IsSubtype(Py_TYPE(ob), f) != 0) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PySet_New(iterable: *mut PyObject) -> *mut PyObject;
pub fn PyFrozenSet_New(iterable: *mut PyObject) -> *mut PyObject;
pub fn PySet_Size(anyset: *mut PyObject) -> Py_ssize_t;

View File

@ -2,7 +2,7 @@ use libc::c_int;
use pyport::Py_ssize_t;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
static mut _Py_EllipsisObject: PyObject;
}
@ -25,7 +25,7 @@ pub struct PySliceObject {
pub step: *mut PyObject
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PySlice_Type: PyTypeObject;
pub static mut PyEllipsis_Type: PyTypeObject;
}
@ -35,7 +35,7 @@ pub unsafe fn PySlice_Check(op: *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PySlice_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PySlice_New(start: *mut PyObject, stop: *mut PyObject,
step: *mut PyObject) -> *mut PyObject;
pub fn PySlice_GetIndices(r: *mut PyObject, length: Py_ssize_t,

View File

@ -17,7 +17,7 @@ pub struct PyStringObject {
pub ob_sval: [c_char; 1],
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyBaseString_Type: PyTypeObject;
pub static mut PyString_Type: PyTypeObject;
}
@ -45,7 +45,7 @@ pub unsafe fn PyString_AS_STRING(op : *mut PyObject) -> *mut c_char {
(*(op as *mut PyStringObject)).ob_sval.as_mut_ptr()
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyString_FromString(v: *const c_char) -> *mut PyObject;
pub fn PyString_FromStringAndSize(v: *const c_char,
len: Py_ssize_t) -> *mut PyObject;

View File

@ -53,7 +53,7 @@ pub const PY_WRITE_RESTRICTED : c_int = 4;
pub const RESTRICTED : c_int = (READ_RESTRICTED | PY_WRITE_RESTRICTED);
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyMember_GetOne(addr: *const c_char, l: *mut PyMemberDef) -> *mut PyObject;
pub fn PyMember_SetOne(addr: *mut c_char, l: *mut PyMemberDef, value: *mut PyObject) -> c_int;
}

View File

@ -18,7 +18,7 @@ pub struct PyTracebackObject {
pub tb_lineno: c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyTraceBack_Here(arg1: *mut PyFrameObject) -> c_int;
pub fn PyTraceBack_Print(arg1: *mut PyObject, arg2: *mut PyObject)
-> c_int;

View File

@ -15,7 +15,7 @@ pub struct PyTupleObject {
pub ob_item: [*mut PyObject; 1],
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyTuple_Type: PyTypeObject;
}
@ -48,7 +48,7 @@ pub unsafe fn PyTuple_SET_ITEM(op: *mut PyObject, i: Py_ssize_t, v: *mut PyObjec
*(*(op as *mut PyTupleObject)).ob_item.as_mut_ptr().offset(i as isize) = v;
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyTuple_New(size: Py_ssize_t) -> *mut PyObject;
pub fn PyTuple_Size(p: *mut PyObject) -> Py_ssize_t;
pub fn PyTuple_GetItem(p: *mut PyObject, pos: Py_ssize_t)

View File

@ -29,7 +29,7 @@ pub struct PyUnicodeObject {
pub defenc: *mut PyObject,
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyUnicode_Type: PyTypeObject;
}
@ -69,7 +69,7 @@ pub const Py_UNICODE_REPLACEMENT_CHARACTER : Py_UNICODE = 0xFFFD;
#[allow(dead_code)]
#[cfg(py_sys_config="Py_UNICODE_SIZE_4")]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
fn PyUnicodeUCS4_FromUnicode(u: *const Py_UNICODE, size: Py_ssize_t)
-> *mut PyObject;
fn PyUnicodeUCS4_FromStringAndSize(u: *const c_char,
@ -313,7 +313,7 @@ extern "C" {
#[allow(dead_code)]
#[cfg(not(py_sys_config="Py_UNICODE_SIZE_4"))]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
fn PyUnicodeUCS2_FromUnicode(u: *const Py_UNICODE, size: Py_ssize_t)
-> *mut PyObject;
fn PyUnicodeUCS2_FromStringAndSize(u: *const c_char,

View File

@ -2,7 +2,7 @@ use libc::{c_char, c_int};
use pyport::Py_ssize_t;
use object::PyObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyErr_WarnEx(category: *mut PyObject, msg: *const c_char,
stacklevel: Py_ssize_t) -> c_int;
pub fn PyErr_WarnExplicit(arg1: *mut PyObject,

View File

@ -18,7 +18,7 @@ pub struct PyWeakReference {
pub wr_next: *mut PyWeakReference
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
static mut _PyWeakref_RefType: PyTypeObject;
static mut _PyWeakref_ProxyType: PyTypeObject;
static mut _PyWeakref_CallableProxyType: PyTypeObject;
@ -45,7 +45,7 @@ pub unsafe fn PyWeakref_Check(op: *mut PyObject) -> c_int {
(PyWeakref_CheckRef(op) != 0 || PyWeakref_CheckProxy(op) != 0) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyWeakref_NewRef(ob: *mut PyObject, callback: *mut PyObject)
-> *mut PyObject;
pub fn PyWeakref_NewProxy(ob: *mut PyObject, callback: *mut PyObject)

View File

@ -225,7 +225,7 @@ fn get_interpreter_version(line: &str) -> Result<PythonVersion, String> {
#[cfg(target_os="windows")]
fn get_rustc_link_lib(version: &PythonVersion, _: &str, _: bool) -> Result<String, String> {
// Py_ENABLE_SHARED doesn't seem to be present on windows.
Ok(format!("cargo:rustc-link-lib=python{}{}", version.major,
Ok(format!("cargo:rustc-link-lib=pythonXY:python{}{}", version.major,
match version.minor {
Some(minor) => minor.to_string(),
None => "".to_owned()

View File

@ -1,6 +1,6 @@
use object::PyTypeObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyFilter_Type: PyTypeObject;
pub static mut PyMap_Type: PyTypeObject;
pub static mut PyZip_Type: PyTypeObject;

View File

@ -2,7 +2,7 @@ use libc::{c_int, c_long};
use object::*;
use longobject::PyLongObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyBool_Type: PyTypeObject;
static mut _Py_FalseStruct: PyLongObject;
static mut _Py_TrueStruct: PyLongObject;

View File

@ -2,7 +2,7 @@ use libc::{c_char, c_int};
use object::*;
use pyport::Py_ssize_t;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyByteArray_Type: PyTypeObject;
pub static mut PyByteArrayIter_Type: PyTypeObject;
}
@ -17,7 +17,7 @@ pub unsafe fn PyByteArray_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyByteArray_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyByteArray_FromObject(o: *mut PyObject) -> *mut PyObject;
pub fn PyByteArray_Concat(a: *mut PyObject, b: *mut PyObject)
-> *mut PyObject;

View File

@ -2,7 +2,7 @@ use libc::{c_char, c_int};
use object::*;
use pyport::Py_ssize_t;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyBytes_Type: PyTypeObject;
pub static mut PyBytesIter_Type: PyTypeObject;
}
@ -17,7 +17,7 @@ pub unsafe fn PyBytes_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyBytes_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyBytes_FromStringAndSize(arg1: *const c_char,
arg2: Py_ssize_t) -> *mut PyObject;
pub fn PyBytes_FromString(arg1: *const c_char) -> *mut PyObject;

View File

@ -2,7 +2,7 @@ use libc::{c_void, c_char, c_int};
use object::PyObject;
use pystate::PyThreadState;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyEval_CallObjectWithKeywords(func: *mut PyObject,
obj: *mut PyObject,
kwargs: *mut PyObject)
@ -14,7 +14,7 @@ pub unsafe fn PyEval_CallObject(func: *mut PyObject, arg: *mut PyObject) -> *mut
PyEval_CallObjectWithKeywords(func, arg, ::core::ptr::null_mut())
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyEval_CallFunction(obj: *mut PyObject,
format: *const c_char, ...)
-> *mut PyObject;
@ -39,7 +39,7 @@ extern "C" {
// TODO: Py_EnterRecursiveCall etc.
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyEval_GetFuncName(arg1: *mut PyObject) -> *const c_char;
pub fn PyEval_GetFuncDesc(arg1: *mut PyObject) -> *const c_char;
pub fn PyEval_GetCallStats(arg1: *mut PyObject) -> *mut PyObject;
@ -51,7 +51,7 @@ extern "C" {
}
#[cfg(py_sys_config = "WITH_THREAD")]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyEval_ThreadsInitialized() -> c_int;
pub fn PyEval_InitThreads() -> ();
pub fn PyEval_AcquireLock() -> ();

View File

@ -70,7 +70,7 @@ pub const CO_FUTURE_GENERATOR_STOP : c_int = 0x80000;
pub const CO_MAXBLOCKS: usize = 20;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyCode_Type: PyTypeObject;
pub fn PyCode_New(arg1: c_int, arg2: c_int,

View File

@ -1,7 +1,7 @@
use libc::{c_char, c_int};
use object::PyObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyCodec_Register(search_function: *mut PyObject) -> c_int;
pub fn PyCodec_KnownEncoding(encoding: *const c_char)
-> c_int;

View File

@ -32,7 +32,7 @@ pub const FUTURE_BARRY_AS_BDFL : &'static str = "barry_as_FLUFL";
pub const FUTURE_GENERATOR_STOP : &'static str = "generator_stop";
#[cfg(not(Py_LIMITED_API))]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyNode_Compile(arg1: *mut _node,
arg2: *const c_char) -> *mut PyCodeObject;
pub fn PyAST_CompileEx(_mod: *mut _mod,

View File

@ -1,7 +1,7 @@
use libc::{c_double, c_int};
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyComplex_Type: PyTypeObject;
}
@ -15,7 +15,7 @@ pub unsafe fn PyComplex_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyComplex_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyComplex_FromDoubles(real: c_double,
imag: c_double) -> *mut PyObject;
pub fn PyComplex_RealAsDouble(op: *mut PyObject) -> c_double;

View File

@ -27,7 +27,7 @@ impl Clone for PyGetSetDef {
#[inline] fn clone(&self) -> PyGetSetDef { *self }
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyClassMethodDescr_Type: PyTypeObject;
pub static mut PyGetSetDescr_Type: PyTypeObject;
pub static mut PyMemberDescr_Type: PyTypeObject;

View File

@ -2,7 +2,7 @@ use libc::{c_char, c_int};
use pyport::Py_ssize_t;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyDict_Type: PyTypeObject;
pub static mut PyDictIterKey_Type: PyTypeObject;
pub static mut PyDictIterValue_Type: PyTypeObject;
@ -42,7 +42,7 @@ pub unsafe fn PyDictViewSet_Check(op : *mut PyObject) -> c_int {
(PyDictKeys_Check(op) != 0 || PyDictItems_Check(op) != 0) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyDict_New() -> *mut PyObject;
pub fn PyDict_GetItem(mp: *mut PyObject, key: *mut PyObject)
-> *mut PyObject;

View File

@ -1,6 +1,6 @@
use object::PyTypeObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyEnum_Type: PyTypeObject;
pub static mut PyReversed_Type: PyTypeObject;
}

View File

@ -1,7 +1,7 @@
use libc::c_int;
use object::PyObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyEval_EvalCode(arg1: *mut PyObject, arg2: *mut PyObject,
arg3: *mut PyObject) -> *mut PyObject;
pub fn PyEval_EvalCodeEx(co: *mut PyObject, globals: *mut PyObject,

View File

@ -3,7 +3,7 @@ use object::PyObject;
pub const PY_STDIOTEXTMODE : &'static str = "b";
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyFile_FromFd(arg1: c_int, arg2: *const c_char,
arg3: *const c_char, arg4: c_int,
arg5: *const c_char,

View File

@ -1,7 +1,7 @@
use libc::{c_int, c_double};
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyFloat_Type: PyTypeObject;
}
@ -15,7 +15,7 @@ pub unsafe fn PyFloat_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyFloat_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyFloat_GetMax() -> c_double;
pub fn PyFloat_GetMin() -> c_double;
pub fn PyFloat_GetInfo() -> *mut PyObject;

View File

@ -51,7 +51,7 @@ pub struct PyFrameObject {
pub f_localsplus: [*mut PyObject; 1] /* locals+stack, dynamically sized */
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyFrame_Type: PyTypeObject;
}
@ -60,7 +60,7 @@ pub unsafe fn PyFrame_Check(op: *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyFrame_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyFrame_New(tstate: *mut PyThreadState, code: *mut PyCodeObject,
globals: *mut PyObject, locals: *mut PyObject) -> *mut PyFrameObject;

View File

@ -1,7 +1,7 @@
use libc::{c_char, c_int, c_long};
use object::PyObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyImport_GetMagicNumber() -> c_long;
pub fn PyImport_GetMagicTag() -> *const c_char;
pub fn PyImport_ExecCodeModule(name: *const c_char,
@ -51,7 +51,7 @@ pub unsafe fn PyImport_ImportModuleEx(name: *const c_char,
PyImport_ImportModuleLevel(name, globals, locals, fromlist, 0)
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyImport_GetImporter(path: *mut PyObject) -> *mut PyObject;
pub fn PyImport_Import(name: *mut PyObject) -> *mut PyObject;
pub fn PyImport_ReloadModule(m: *mut PyObject) -> *mut PyObject;

View File

@ -1,6 +1,6 @@
use libc::c_int;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyOS_InterruptOccurred() -> c_int;
pub fn PyOS_InitInterrupts() -> ();
pub fn PyOS_AfterFork() -> ();

View File

@ -1,7 +1,7 @@
use libc::c_int;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PySeqIter_Type: PyTypeObject;
pub static mut PyCallIter_Type: PyTypeObject;

View File

@ -2,7 +2,7 @@ use libc::c_int;
use pyport::Py_ssize_t;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyList_Type: PyTypeObject;
pub static mut PyListIter_Type: PyTypeObject;
pub static mut PyListRevIter_Type: PyTypeObject;
@ -18,7 +18,7 @@ pub unsafe fn PyList_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyList_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyList_New(size: Py_ssize_t) -> *mut PyObject;
pub fn PyList_Size(arg1: *mut PyObject) -> Py_ssize_t;
pub fn PyList_GetItem(arg1: *mut PyObject, arg2: Py_ssize_t)

View File

@ -4,7 +4,7 @@ use pyport::Py_ssize_t;
pub enum PyLongObject {}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyLong_Type: PyTypeObject;
}
@ -18,7 +18,7 @@ pub unsafe fn PyLong_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyLong_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyLong_FromLong(arg1: c_long) -> *mut PyObject;
pub fn PyLong_FromUnsignedLong(arg1: c_ulong) -> *mut PyObject;
pub fn PyLong_FromSize_t(arg1: size_t) -> *mut PyObject;

View File

@ -2,7 +2,7 @@ use libc::{c_int, c_char};
use pyport::Py_ssize_t;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyMemoryView_Type: PyTypeObject;
}
@ -11,7 +11,7 @@ pub unsafe fn PyMemoryView_Check(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyMemoryView_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyMemoryView_FromObject(base: *mut PyObject) -> *mut PyObject;
pub fn PyMemoryView_FromMemory(mem: *mut c_char, size: Py_ssize_t,
flags: c_int) -> *mut PyObject;

View File

@ -2,7 +2,7 @@ use libc::{c_char, c_int};
use core::{mem, ptr};
use object::{PyObject, PyTypeObject, Py_TYPE};
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyCFunction_Type: PyTypeObject;
}
@ -31,7 +31,7 @@ pub type PyNoArgsFunction =
unsafe extern "C" fn(slf: *mut PyObject)
-> *mut PyObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyCFunction_GetFunction(f: *mut PyObject) -> Option<PyCFunction>;
pub fn PyCFunction_GetSelf(f: *mut PyObject) -> *mut PyObject;
pub fn PyCFunction_GetFlags(f: *mut PyObject) -> c_int;
@ -60,7 +60,7 @@ pub unsafe fn PyCFunction_New(ml: *mut PyMethodDef, slf: *mut PyObject) -> *mut
PyCFunction_NewEx(ml, slf, ptr::null_mut())
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyCFunction_NewEx(arg1: *mut PyMethodDef, arg2: *mut PyObject,
arg3: *mut PyObject) -> *mut PyObject;
}
@ -88,7 +88,7 @@ pub const METH_COEXIST : c_int = 0x0040;
#[cfg(all(Py_3_6, not(Py_LIMITED_API)))]
pub const METHOD_FASTCALL : c_int = 0x0080;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyCFunction_ClearFreeList() -> c_int;
}

View File

@ -5,7 +5,7 @@ use moduleobject::PyModuleDef;
#[cfg(Py_3_5)]
use methodobject::PyMethodDef;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyArg_Parse(arg1: *mut PyObject, arg2: *const c_char, ...)
-> c_int;
pub fn PyArg_ParseTuple(arg1: *mut PyObject,
@ -53,7 +53,7 @@ pub const Py_CLEANUP_SUPPORTED: i32 = 0x20000;
pub const PYTHON_API_VERSION: i32 = 1013;
pub const PYTHON_ABI_VERSION: i32 = 3;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
#[cfg(not(py_sys_config="Py_TRACE_REFS"))]
pub fn PyModule_Create2(module: *mut PyModuleDef,
apiver: c_int) -> *mut PyObject;

View File

@ -3,7 +3,7 @@ use pyport::Py_ssize_t;
use object::*;
use methodobject::PyMethodDef;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyModule_Type: PyTypeObject;
}
@ -17,7 +17,7 @@ pub unsafe fn PyModule_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyModule_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyModule_NewObject(name: *mut PyObject) -> *mut PyObject;
pub fn PyModule_New(name: *const c_char) -> *mut PyObject;
pub fn PyModule_GetDict(arg1: *mut PyObject) -> *mut PyObject;

View File

@ -657,7 +657,7 @@ impl Default for PyType_Spec {
fn default() -> PyType_Spec { unsafe { ::core::mem::zeroed() } }
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyType_FromSpec(arg1: *mut PyType_Spec) -> *mut PyObject;
//#[cfg(Py_3_3)]
@ -669,7 +669,7 @@ extern "C" {
-> *mut c_void;
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyType_IsSubtype(a: *mut PyTypeObject, b: *mut PyTypeObject) -> c_int;
}
@ -678,7 +678,7 @@ pub unsafe fn PyObject_TypeCheck(ob: *mut PyObject, tp: *mut PyTypeObject) -> c_
(Py_TYPE(ob) == tp || PyType_IsSubtype(Py_TYPE(ob), tp) != 0) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
/// built-in 'type'
pub static mut PyType_Type: PyTypeObject;
/// built-in 'object'
@ -699,7 +699,7 @@ pub unsafe fn PyType_CheckExact(op: *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyType_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyType_Ready(t: *mut PyTypeObject) -> c_int;
pub fn PyType_GenericAlloc(t: *mut PyTypeObject, nitems: Py_ssize_t)
-> *mut PyObject;
@ -824,7 +824,7 @@ pub unsafe fn PyType_FastSubclass(t : *mut PyTypeObject, f : c_ulong) -> c_int {
PyType_HasFeature(t, f)
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn _Py_Dealloc(arg1: *mut PyObject) -> ();
}
@ -873,7 +873,7 @@ pub unsafe fn Py_XDECREF(op : *mut PyObject) {
}
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn Py_IncRef(o: *mut PyObject);
pub fn Py_DecRef(o: *mut PyObject);

View File

@ -13,7 +13,7 @@ pub unsafe fn PyObject_DelAttr(o: *mut PyObject, attr_name: *mut PyObject) -> c_
PyObject_SetAttr(o, attr_name, ptr::null_mut())
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyObject_Call(callable_object: *mut PyObject, args: *mut PyObject,
kw: *mut PyObject) -> *mut PyObject;
pub fn PyObject_CallObject(callable_object: *mut PyObject,
@ -41,7 +41,7 @@ pub unsafe fn PyObject_Length(o: *mut PyObject) -> Py_ssize_t {
PyObject_Size(o)
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
#[cfg(all(not(Py_LIMITED_API), Py_3_4))]
pub fn PyObject_LengthHint(o: *mut PyObject, arg1: Py_ssize_t)
-> Py_ssize_t;
@ -78,7 +78,7 @@ pub unsafe fn PyObject_CheckBuffer(o: *mut PyObject) -> c_int {
}
#[cfg(not(Py_LIMITED_API))]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyObject_GetBuffer(obj: *mut PyObject, view: *mut Py_buffer,
flags: c_int) -> c_int;
pub fn PyBuffer_GetPointer(view: *mut Py_buffer, indices: *mut Py_ssize_t)
@ -105,7 +105,7 @@ extern "C" {
pub fn PyBuffer_Release(view: *mut Py_buffer) -> ();
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyObject_Format(obj: *mut PyObject, format_spec: *mut PyObject)
-> *mut PyObject;
pub fn PyObject_GetIter(arg1: *mut PyObject) -> *mut PyObject;
@ -120,7 +120,7 @@ pub unsafe fn PyIter_Check(o: *mut PyObject) -> c_int {
}) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyIter_Next(arg1: *mut PyObject) -> *mut PyObject;
pub fn PyNumber_Check(o: *mut PyObject) -> c_int;
@ -165,7 +165,7 @@ pub unsafe fn PyIndex_Check(o: *mut PyObject) -> c_int {
(!tp_as_number.is_null() && (*tp_as_number).nb_index.is_some()) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyNumber_Index(o: *mut PyObject) -> *mut PyObject;
pub fn PyNumber_AsSsize_t(o: *mut PyObject, exc: *mut PyObject)
-> Py_ssize_t;
@ -210,7 +210,7 @@ pub unsafe fn PySequence_Length(o: *mut PyObject) -> Py_ssize_t {
PySequence_Size(o)
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PySequence_Concat(o1: *mut PyObject, o2: *mut PyObject)
-> *mut PyObject;
pub fn PySequence_Repeat(o: *mut PyObject, count: Py_ssize_t)
@ -244,7 +244,7 @@ pub unsafe fn PySequence_In(o: *mut PyObject, value: *mut PyObject) -> c_int {
PySequence_Contains(o, value)
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PySequence_Index(o: *mut PyObject, value: *mut PyObject)
-> Py_ssize_t;
pub fn PySequence_InPlaceConcat(o1: *mut PyObject, o2: *mut PyObject)
@ -270,7 +270,7 @@ pub unsafe fn PyMapping_DelItem(o : *mut PyObject, key : *mut PyObject) -> c_int
PyObject_DelItem(o, key)
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyMapping_HasKeyString(o: *mut PyObject,
key: *const c_char)
-> c_int;

View File

@ -2,7 +2,7 @@ use libc::{c_void, c_int, size_t};
use pyport::Py_ssize_t;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyObject_Malloc(size: size_t) -> *mut c_void;
#[cfg(Py_3_5)]
pub fn PyObject_Calloc(nelem: size_t, elsize: size_t) -> *mut c_void;
@ -44,7 +44,7 @@ impl Default for PyObjectArenaAllocator {
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[cfg(all(not(Py_LIMITED_API), Py_3_4))]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyObject_GetArenaAllocator(allocator: *mut PyObjectArenaAllocator)
-> ();
pub fn PyObject_SetArenaAllocator(allocator: *mut PyObjectArenaAllocator)
@ -68,7 +68,7 @@ pub unsafe fn PyObject_IS_GC(o : *mut PyObject) -> c_int {
}) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn _PyObject_GC_Resize(arg1: *mut PyVarObject, arg2: Py_ssize_t)
-> *mut PyVarObject;

View File

@ -1,6 +1,6 @@
// This header is new in Python 3.6
use object::PyObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyOS_FSPath(path: *mut PyObject) -> *mut PyObject;
}

View File

@ -1,7 +1,7 @@
use libc::{c_void, c_char, c_int};
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyCapsule_Type: PyTypeObject;
}
@ -12,7 +12,7 @@ pub unsafe fn PyCapsule_CheckExact(ob: *mut PyObject) -> c_int {
(Py_TYPE(ob) == &mut PyCapsule_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyCapsule_New(pointer: *mut c_void,
name: *const c_char,
destructor: Option<PyCapsule_Destructor>) -> *mut PyObject;

View File

@ -1,7 +1,7 @@
use libc::c_int;
#[cfg(not(Py_LIMITED_API))]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut Py_DebugFlag: c_int;
pub static mut Py_VerboseFlag: c_int;
pub static mut Py_QuietFlag: c_int;

View File

@ -2,7 +2,7 @@ use libc::{c_char, c_int};
use pyport::Py_ssize_t;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyErr_SetNone(arg1: *mut PyObject) -> ();
pub fn PyErr_SetObject(arg1: *mut PyObject, arg2: *mut PyObject) -> ();
pub fn PyErr_SetString(exception: *mut PyObject,
@ -52,7 +52,7 @@ pub unsafe fn PyExceptionInstance_Class(x: *mut PyObject) -> *mut PyObject {
(*x).ob_type as *mut PyObject
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyExc_BaseException: *mut PyObject;
pub static mut PyExc_Exception: *mut PyObject;
pub static mut PyExc_StopIteration: *mut PyObject;

View File

@ -18,7 +18,7 @@ impl Default for PyHash_FuncDef {
#[inline] fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyHash_GetFuncDef() -> *mut PyHash_FuncDef;
}

View File

@ -2,7 +2,7 @@ use libc::{c_void, size_t};
#[cfg(Py_3_4)]
#[cfg(not(Py_LIMITED_API))]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyMem_RawMalloc(size: size_t) -> *mut c_void;
#[cfg(Py_3_5)]
pub fn PyMem_RawCalloc(nelem: size_t, elsize: size_t)
@ -12,7 +12,7 @@ extern "C" {
pub fn PyMem_RawFree(ptr: *mut c_void) -> ();
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyMem_Malloc(size: size_t) -> *mut c_void;
#[cfg(Py_3_5)]
pub fn PyMem_Calloc(nelem: size_t, elsize: size_t) -> *mut c_void;
@ -71,7 +71,7 @@ pub struct PyMemAllocatorEx {
#[cfg(Py_3_4)]
#[cfg(not(Py_LIMITED_API))]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
#[cfg(not(Py_3_5))]
pub fn PyMem_GetAllocator(domain: PyMemAllocatorDomain,
allocator: *mut PyMemAllocator) -> ();

View File

@ -8,7 +8,7 @@ pub const MAX_CO_EXTRA_USERS: c_int = 255;
pub enum PyInterpreterState { }
pub enum PyThreadState { }
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyInterpreterState_New() -> *mut PyInterpreterState;
pub fn PyInterpreterState_Clear(arg1: *mut PyInterpreterState) -> ();
pub fn PyInterpreterState_Delete(arg1: *mut PyInterpreterState) -> ();
@ -38,7 +38,7 @@ pub enum PyGILState_STATE {
PyGILState_UNLOCKED
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyGILState_Ensure() -> PyGILState_STATE;
pub fn PyGILState_Release(arg1: PyGILState_STATE) -> ();
pub fn PyGILState_GetThisThreadState() -> *mut PyThreadState;

View File

@ -1,7 +1,7 @@
use libc::{c_char, c_int, c_double};
use object::PyObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyOS_string_to_double(str: *const c_char,
endptr: *mut *mut c_char,
overflow_exception: *mut PyObject)

View File

@ -7,7 +7,7 @@ use pyarena::PyArena;
// TODO: PyCF_MASK etc. constants
extern "C" { // TODO: these moved to pylifecycle.h
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" { // TODO: these moved to pylifecycle.h
pub fn Py_SetProgramName(arg1: *mut wchar_t) -> ();
pub fn Py_GetProgramName() -> *mut wchar_t;
pub fn Py_SetPythonHome(arg1: *mut wchar_t) -> ();
@ -31,7 +31,7 @@ pub struct PyCompilerFlags {
pub enum _mod {}
#[cfg(not(Py_LIMITED_API))]
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyRun_SimpleStringFlags(arg1: *const c_char,
arg2: *mut PyCompilerFlags)
-> c_int;
@ -105,7 +105,7 @@ pub unsafe fn PyParser_SimpleParseFile(fp: *mut FILE, s: *const c_char, b: c_int
PyParser_SimpleParseFileFlags(fp, s, b, 0)
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyParser_SimpleParseStringFlags(arg1: *const c_char,
arg2: c_int,
arg3: c_int)
@ -147,7 +147,7 @@ pub unsafe fn Py_CompileString(string: *const c_char, p: *const c_char, s: c_int
pub unsafe fn Py_CompileStringFlags(string: *const c_char, p: *const c_char, s: c_int, f: *mut PyCompilerFlags) -> *mut PyObject {
Py_CompileStringExFlags(string, p, s, f, -1)
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
#[cfg(not(Py_LIMITED_API))]
pub fn Py_CompileStringExFlags(str: *const c_char,
filename: *const c_char,

View File

@ -1,7 +1,7 @@
use libc::c_int;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyRange_Type: PyTypeObject;
pub static mut PyRangeIter_Type: PyTypeObject;
pub static mut PyLongRangeIter_Type: PyTypeObject;

View File

@ -2,7 +2,7 @@ use libc::c_int;
use pyport::Py_ssize_t;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PySet_Type: PyTypeObject;
pub static mut PyFrozenSet_Type: PyTypeObject;
pub static mut PySetIter_Type: PyTypeObject;
@ -35,7 +35,7 @@ pub unsafe fn PyFrozenSet_Check(ob : *mut PyObject) -> c_int {
(Py_TYPE(ob) == &mut PyFrozenSet_Type || PyType_IsSubtype(Py_TYPE(ob), &mut PyFrozenSet_Type) != 0) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PySet_New(arg1: *mut PyObject) -> *mut PyObject;
pub fn PyFrozenSet_New(arg1: *mut PyObject) -> *mut PyObject;
pub fn PySet_Size(anyset: *mut PyObject) -> Py_ssize_t;

View File

@ -2,7 +2,7 @@ use libc::c_int;
use pyport::Py_ssize_t;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
static mut _Py_EllipsisObject: PyObject;
}
@ -11,7 +11,7 @@ pub unsafe fn Py_Ellipsis() -> *mut PyObject {
&mut _Py_EllipsisObject
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PySlice_Type: PyTypeObject;
pub static mut PyEllipsis_Type: PyTypeObject;
}
@ -21,7 +21,7 @@ pub unsafe fn PySlice_Check(op: *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PySlice_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PySlice_New(start: *mut PyObject, stop: *mut PyObject,
step: *mut PyObject) -> *mut PyObject;
pub fn PySlice_GetIndices(r: *mut PyObject, length: Py_ssize_t,

View File

@ -51,7 +51,7 @@ pub const READ_RESTRICTED : c_int = 2;
pub const PY_WRITE_RESTRICTED : c_int = 4;
pub const RESTRICTED : c_int = (READ_RESTRICTED | PY_WRITE_RESTRICTED);
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyMember_GetOne(addr: *const c_char, l: *mut PyMemberDef) -> *mut PyObject;
pub fn PyMember_SetOne(addr: *mut c_char, l: *mut PyMemberDef, value: *mut PyObject) -> c_int;
}

View File

@ -24,7 +24,7 @@ impl Clone for PyStructSequence_Desc {
#[inline] fn clone(&self) -> PyStructSequence_Desc { *self }
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyStructSequence_NewType(desc: *mut PyStructSequence_Desc)
-> *mut PyTypeObject;
pub fn PyStructSequence_New(_type: *mut PyTypeObject) -> *mut PyObject;

View File

@ -1,7 +1,7 @@
use libc::{c_char, c_int, wchar_t};
use object::PyObject;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PySys_GetObject(arg1: *const c_char) -> *mut PyObject;
pub fn PySys_SetObject(arg1: *const c_char, arg2: *mut PyObject)
-> c_int;

View File

@ -1,7 +1,7 @@
use libc::c_int;
use object::*;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyTraceBack_Here(arg1: *mut ::PyFrameObject) -> c_int;
pub fn PyTraceBack_Print(arg1: *mut PyObject, arg2: *mut PyObject)
-> c_int;

View File

@ -9,7 +9,7 @@ pub struct PyTupleObject {
pub ob_item: [*mut PyObject; 1],
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyTuple_Type: PyTypeObject;
pub static mut PyTupleIter_Type: PyTypeObject;
}
@ -24,7 +24,7 @@ pub unsafe fn PyTuple_CheckExact(op : *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyTuple_Type) as c_int
}
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub fn PyTuple_New(size: Py_ssize_t) -> *mut PyObject;
pub fn PyTuple_Size(arg1: *mut PyObject) -> Py_ssize_t;
pub fn PyTuple_GetItem(arg1: *mut PyObject, arg2: Py_ssize_t)

View File

@ -9,7 +9,7 @@ pub type Py_UCS4 = u32;
pub type Py_UCS2 = u16;
pub type Py_UCS1 = u8;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
pub static mut PyUnicode_Type: PyTypeObject;
pub static mut PyUnicodeIter_Type: PyTypeObject;
}
@ -26,7 +26,7 @@ pub unsafe fn PyUnicode_CheckExact(op : *mut PyObject) -> c_int {
pub const Py_UNICODE_REPLACEMENT_CHARACTER : Py_UCS4 = 0xFFFD;
extern "C" {
#[cfg_attr(windows, link(name="pythonXY"))] extern "C" {
#[cfg(not(Py_LIMITED_API))]
pub fn PyUnicode_New(size: Py_ssize_t, maxchar: Py_UCS4) -> *mut PyObject;

Some files were not shown because too many files have changed in this diff Show More