Skip to content

Instantly share code, notes, and snippets.

View ngoldbaum's full-sized avatar

Nathan Goldbaum ngoldbaum

View GitHub Profile
import time
import threading
import multiprocessing
import numpy as np
import sys
import os
import argparse
import matplotlib.pyplot as plt
diff --git a/setup.py b/setup.py
index 4029e9e..c855180 100644
--- a/setup.py
+++ b/setup.py
@@ -3,6 +3,9 @@ import os
import sys
from setuptools import Extension, setup
+from Cython.Build import cythonize
+from Cython.Compiler.Version import version as cython_version
#define _CFFI_NO_LIMITED_API
#define _CFFI_
/* We try to define Py_LIMITED_API before including Python.h.
Mess: we can only define it if Py_DEBUG, Py_TRACE_REFS and
Py_REF_DEBUG are not defined. This is a best-effort approximation:
we can learn about Py_DEBUG from pyconfig.h, but it is unclear if
the same works for the other two macros. Py_DEBUG implies them,
but not the other way around.
goldbaum at Nathans-MBP in ~/Documents/pyo3 on fix-freelist
± nox -s tests
python(51961,0x1f8d0c840) malloc: nano zone abandoned due to inability to reserve vm space.
nox > Error while collecting sessions.
nox > Sessions not found: tests
goldbaum at Nathans-MBP in ~/Documents/pyo3 on fix-freelist
± nox -s test
python(52493,0x1f8d0c840) malloc: nano zone abandoned due to inability to reserve vm space.
nox > Running session test
Checking cryptography-rust v0.1.0 (/Users/goldbaum/Documents/cryptography/src/rust)
warning: use of deprecated trait `pyo3::ToPyObject`: `ToPyObject` is going to be replaced by `IntoPyObject`. See the migration guide (https://pyo3.rs/v0.23/migration) for more information.
--> src/rust/src/asn1.rs:9:11
|
9 | use pyo3::ToPyObject;
| ^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated type alias `pyo3::types::PyLong`: use `PyInt` instead
diff --git a/pyo3-build-config/src/impl_.rs b/pyo3-build-config/src/impl_.rs
index a473f888..e57204f2 100644
--- a/pyo3-build-config/src/impl_.rs
+++ b/pyo3-build-config/src/impl_.rs
@@ -386,13 +386,7 @@ print("gil_disabled", get_config_var("Py_GIL_DISABLED"))
};
let lib_dir = get_key!(sysconfigdata, "LIBDIR").ok().map(str::to_string);
let gil_disabled = match sysconfigdata.get_value("Py_GIL_DISABLED") {
- Some(value) => {
- if value == "1" {
Fatal Python error: PyInterpreterState_Get: the function must be called with the GIL held, after Python initialization and before Python finalization, but the GIL is released (the current Python thread state is NULL)
Python runtime state: unknown
diff --git a/pyo3-macros-backend/src/pyclass.rs b/pyo3-macros-backend/src/pyclass.rs
index 96bfbb9e..ae3082e3 100644
--- a/pyo3-macros-backend/src/pyclass.rs
+++ b/pyo3-macros-backend/src/pyclass.rs
@@ -2317,7 +2317,7 @@ impl<'a> PyClassImplsBuilder<'a> {
cls.span() =>
const _: () = {
use #pyo3_path::impl_::pyclass::*;
- assert_pyclass_sync::<#cls, { IsSync::<#cls>::VALUE }>();
+ assert_pyclass_sync::<#cls>();
pub fn with_critical_section<F, R>(object: &Bound<'_, PyAny>, f: F) -> R
where
F: FnOnce() -> R,
{
#[cfg(Py_GIL_DISABLED)]
{
struct Guard(crate::ffi::PyCriticalSection);
impl Drop for Guard {
fn drop(&mut self) {
This file has been truncated, but you can view the full file.
thread #1, name = 'main', queue = 'com.apple.main-thread'
frame #0: 0x0000000193b60d88 libsystem_kernel.dylib`semaphore_timedwait_trap + 8
frame #1: 0x00000001939f1a00 libdispatch.dylib`_dispatch_sema4_timedwait + 64
frame #2: 0x00000001939f1ffc libdispatch.dylib`_dispatch_semaphore_wait_slow + 76
frame #3: 0x000000010030417c pyo3-97f8571082c6d82b`std::thread::park_timeout::h3094a03c38ba3b52 [inlined] std::sys::sync::thread_parking::darwin::Parker::park_timeout::h96aa039ec5b0172e at darwin.rs:95:23 [opt]
frame #4: 0x0000000100304128 pyo3-97f8571082c6d82b`std::thread::park_timeout::h3094a03c38ba3b52 at mod.rs:1193:9 [opt]
frame #5: 0x000000010026dee0 pyo3-97f8571082c6d82b`std::sync::mpmc::list::Channel$LT$T$GT$::recv::_$u7b$$u7b$closure$u7d$$u7d$::hc33f0b5eb0ca8722 [inlined] std::sync::mpmc::context::Context::wait_until::hcdc22f8b88ad8315 at context.rs:130:21 [opt]