mirror of
https://github.com/emmett-framework/granian.git
synced 2025-08-04 17:08:02 +00:00
PyO3 freelist
is unsound with GIL disabled
This commit is contained in:
parent
21616d6db1
commit
cde2400fa3
2 changed files with 14 additions and 4 deletions
|
@ -284,7 +284,7 @@ impl CallbackScheduler {
|
|||
}
|
||||
}
|
||||
|
||||
#[pyclass(frozen, freelist = 1024, module = "granian._granian")]
|
||||
#[pyclass(frozen, module = "granian._granian")]
|
||||
pub(crate) struct CallbackSchedulerState {
|
||||
sched: Py<CallbackScheduler>,
|
||||
coro: PyObject,
|
||||
|
@ -353,7 +353,12 @@ impl CallbackSchedulerState {
|
|||
}
|
||||
}
|
||||
|
||||
#[pyclass(frozen, module = "granian._granian")]
|
||||
// see https://github.com/PyO3/pyo3/issues/4894 - freelist is currently unsound with GIL disabled
|
||||
#[cfg_attr(
|
||||
not(Py_GIL_DISABLED),
|
||||
pyclass(frozen, freelist = 64, module = "granian._granian")
|
||||
)]
|
||||
#[cfg_attr(Py_GIL_DISABLED, pyclass(frozen, module = "granian._granian"))]
|
||||
pub(crate) struct PyEmptyAwaitable;
|
||||
|
||||
#[pymethods]
|
||||
|
|
|
@ -21,6 +21,7 @@ async def _server(interface, port, threading_mode, tls=False, task_impl='asyncio
|
|||
kwargs = {
|
||||
'interface': interface,
|
||||
'port': port,
|
||||
'loop': 'asyncio',
|
||||
'blocking_threads': 1,
|
||||
'threading_mode': threading_mode,
|
||||
'task_impl': task_impl,
|
||||
|
@ -53,7 +54,9 @@ async def _server(interface, port, threading_mode, tls=False, task_impl='asyncio
|
|||
break
|
||||
|
||||
proc.terminate()
|
||||
proc.join()
|
||||
proc.join(timeout=2)
|
||||
if proc.is_alive():
|
||||
proc.kill()
|
||||
spawn_failures += 1
|
||||
|
||||
if not succeeded:
|
||||
|
@ -63,7 +66,9 @@ async def _server(interface, port, threading_mode, tls=False, task_impl='asyncio
|
|||
yield port
|
||||
finally:
|
||||
proc.terminate()
|
||||
proc.join()
|
||||
proc.join(timeout=2)
|
||||
if proc.is_alive():
|
||||
proc.kill()
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue