Skip to content

Commit

Permalink
remove some dead PyPy-specific code (#1329)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt authored Jun 12, 2024
1 parent 4d20a1d commit 03f1aa8
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions src/input/input_python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,60 +653,6 @@ fn maybe_as_enum<'py>(v: &Bound<'py, PyAny>) -> Option<Bound<'py, PyAny>> {
}
}

#[cfg(PyPy)]
static DICT_KEYS_TYPE: pyo3::sync::GILOnceCell<Py<PyType>> = 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::<PyType>()
.unwrap()
.into()
})
.bind(py);
v.is_instance(keys_type).unwrap_or(false)
}

#[cfg(PyPy)]
static DICT_VALUES_TYPE: pyo3::sync::GILOnceCell<Py<PyType>> = 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::<PyType>()
.unwrap()
.into()
})
.bind(py);
v.is_instance(values_type).unwrap_or(false)
}

#[cfg(PyPy)]
static DICT_ITEMS_TYPE: pyo3::sync::GILOnceCell<Py<PyType>> = 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::<PyType>()
.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<PyPosArgs<'py>>,
Expand Down

0 comments on commit 03f1aa8

Please sign in to comment.