enable python3.7 builds
This commit is contained in:
parent
5b9696945f
commit
d50d1fb7ea
|
@ -1,8 +1,13 @@
|
|||
language: python
|
||||
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.5"
|
||||
- "3.6"
|
||||
- "3.7-dev"
|
||||
|
||||
allow_failures:
|
||||
- python: "3.7-dev"
|
||||
|
||||
env:
|
||||
global:
|
||||
|
|
|
@ -56,6 +56,7 @@ pub fn py3_init(fnname: &syn::Ident, name: &String, doc: syn::Lit) -> Tokens {
|
|||
// so we'll do it here in the module initialization:
|
||||
MODULE_DEF.m_name = concat!(stringify!(#m_name), "\0").as_ptr() as *const _;
|
||||
|
||||
#[cfg(py_sys_config = "WITH_THREAD")]
|
||||
pyo3::ffi::PyEval_InitThreads();
|
||||
|
||||
let _module = pyo3::ffi::PyModule_Create(&mut MODULE_DEF);
|
||||
|
|
|
@ -39,14 +39,20 @@ pub fn prepare_freethreaded_python() {
|
|||
if ffi::Py_IsInitialized() != 0 {
|
||||
// If Python is already initialized, we expect Python threading to also be initialized,
|
||||
// as we can't make the existing Python main thread acquire the GIL.
|
||||
#[cfg(py_sys_config = "WITH_THREAD")]
|
||||
assert_ne!(ffi::PyEval_ThreadsInitialized(), 0);
|
||||
} else {
|
||||
// If Python isn't initialized yet, we expect that Python threading
|
||||
// isn't initialized either.
|
||||
#[cfg(py_sys_config = "WITH_THREAD")]
|
||||
assert_eq!(ffi::PyEval_ThreadsInitialized(), 0);
|
||||
// Initialize Python.
|
||||
// We use Py_InitializeEx() with initsigs=0 to disable Python signal handling.
|
||||
// Signal handling depends on the notion of a 'main thread', which doesn't exist in this case.
|
||||
// Note that the 'main thread' notion in Python isn't documented properly;
|
||||
// and running Python without one is not officially supported.
|
||||
ffi::Py_InitializeEx(0);
|
||||
#[cfg(py_sys_config = "WITH_THREAD")]
|
||||
ffi::PyEval_InitThreads();
|
||||
// PyEval_InitThreads() will acquire the GIL,
|
||||
// but we don't want to hold it at this point
|
||||
|
@ -61,6 +67,7 @@ pub fn prepare_freethreaded_python() {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn prepare_pyo3_library() {
|
||||
START_PYO3.call_once(|| unsafe {
|
||||
|
|
Loading…
Reference in New Issue