(obj: &PyObject)
| 2032 | const PAYLOAD_TYPE_ID: core::any::TypeId = core::any::TypeId::of::<PyStr>(); |
| 2033 | |
| 2034 | unsafe fn validate_downcastable_from(obj: &PyObject) -> bool { |
| 2035 | // SAFETY: we know the object is a PyStr in this context |
| 2036 | let wtf8 = unsafe { obj.downcast_unchecked_ref::<PyStr>() }; |
| 2037 | wtf8.is_utf8() |
| 2038 | } |
| 2039 | |
| 2040 | fn try_downcast_from(obj: &PyObject, vm: &VirtualMachine) -> PyResult<()> { |
| 2041 | let str = obj.try_downcast_ref::<PyStr>(vm)?; |