(
&self,
encoding: &str,
generic_func: &str,
vm: &VirtualMachine,
)
| 269 | } |
| 270 | |
| 271 | fn _lookup_text_encoding( |
| 272 | &self, |
| 273 | encoding: &str, |
| 274 | generic_func: &str, |
| 275 | vm: &VirtualMachine, |
| 276 | ) -> PyResult<PyCodec> { |
| 277 | let codec = self.lookup(encoding, vm)?; |
| 278 | if codec.is_text_codec(vm)? { |
| 279 | Ok(codec) |
| 280 | } else { |
| 281 | Err(vm.new_lookup_error(format!( |
| 282 | "'{encoding}' is not a text encoding; use {generic_func} to handle arbitrary codecs" |
| 283 | ))) |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | pub fn forget(&self, encoding: &str) -> Option<PyCodec> { |
| 288 | let encoding = normalize_encoding_name(encoding); |
no test coverage detected