MCPcopy Index your code
hub / github.com/RustPython/RustPython / nid2obj

Function nid2obj

crates/stdlib/src/ssl.rs:4809–4822  ·  view source on GitHub ↗
(nid: i32, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

4807
4808 #[pyfunction]
4809 fn nid2obj(nid: i32, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
4810 let entry = oid::find_by_nid(nid)
4811 .ok_or_else(|| vm.new_value_error(format!("unknown NID {nid}")))?;
4812
4813 // Return tuple: (nid, shortname, longname, oid)
4814 Ok(vm
4815 .new_tuple((
4816 vm.ctx.new_int(entry.nid),
4817 vm.ctx.new_str(entry.short_name),
4818 vm.ctx.new_str(entry.long_name),
4819 vm.ctx.new_str(entry.oid_string()),
4820 ))
4821 .into())
4822 }
4823
4824 #[pyfunction]
4825 fn get_default_verify_paths(vm: &VirtualMachine) -> PyResult<PyObjectRef> {

Callers

nothing calls this directly

Calls 6

find_by_nidFunction · 0.85
ok_or_elseMethod · 0.80
oid_stringMethod · 0.80
new_tupleMethod · 0.45
new_intMethod · 0.45
new_strMethod · 0.45

Tested by

no test coverage detected