From 03f1aa87fa1b29628b81e5730adb7763718f83a0 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Wed, 12 Jun 2024 17:43:45 +0100 Subject: [PATCH] remove some dead PyPy-specific code (#1329) --- src/input/input_python.rs | 54 --------------------------------------- 1 file changed, 54 deletions(-) diff --git a/src/input/input_python.rs b/src/input/input_python.rs index b2284efb5..2a06228e1 100644 --- a/src/input/input_python.rs +++ b/src/input/input_python.rs @@ -653,60 +653,6 @@ fn maybe_as_enum<'py>(v: &Bound<'py, PyAny>) -> Option> { } } -#[cfg(PyPy)] -static DICT_KEYS_TYPE: pyo3::sync::GILOnceCell> = pyo3::sync::GILOnceCell::new(); - -#[cfg(PyPy)] -fn is_dict_keys_type(v: &Bound<'_, PyAny>) -> bool { - let py = v.py(); - let keys_type = DICT_KEYS_TYPE - .get_or_init(py, || { - py.eval("type({}.keys())", None, None) - .unwrap() - .downcast::() - .unwrap() - .into() - }) - .bind(py); - v.is_instance(keys_type).unwrap_or(false) -} - -#[cfg(PyPy)] -static DICT_VALUES_TYPE: pyo3::sync::GILOnceCell> = pyo3::sync::GILOnceCell::new(); - -#[cfg(PyPy)] -fn is_dict_values_type(v: &Bound<'_, PyAny>) -> bool { - let py = v.py(); - let values_type = DICT_VALUES_TYPE - .get_or_init(py, || { - py.eval("type({}.values())", None, None) - .unwrap() - .downcast::() - .unwrap() - .into() - }) - .bind(py); - v.is_instance(values_type).unwrap_or(false) -} - -#[cfg(PyPy)] -static DICT_ITEMS_TYPE: pyo3::sync::GILOnceCell> = pyo3::sync::GILOnceCell::new(); - -#[cfg(PyPy)] -fn is_dict_items_type(v: &Bound<'_, PyAny>) -> bool { - let py = v.py(); - let items_type = DICT_ITEMS_TYPE - .get_or_init(py, || { - py.eval("type({}.items())", None, None) - .unwrap() - .downcast::() - .unwrap() - .into() - }) - .bind(py); - v.is_instance(items_type).unwrap_or(false) -} - #[cfg_attr(debug_assertions, derive(Debug))] pub struct PyArgs<'py> { pub args: Option>,