(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine)
| 494 | type Args = ContextVarOptions; |
| 495 | |
| 496 | fn slot_new(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult { |
| 497 | let args: Self::Args = args.bind(vm)?; |
| 498 | let var = Self { |
| 499 | name: args.name.to_string(), |
| 500 | default: args.default.into_option(), |
| 501 | cached_id: 0.into(), |
| 502 | cached: AtomicCell::new(None), |
| 503 | hash: UnsafeCell::new(0), |
| 504 | }; |
| 505 | let py_var = var.into_ref_with_type(vm, cls)?; |
| 506 | |
| 507 | unsafe { |
| 508 | // SAFETY: py_var is not exposed to python memory model yet |
| 509 | *py_var.hash.get() = Self::generate_hash(&py_var, vm) |
| 510 | }; |
| 511 | Ok(py_var.into()) |
| 512 | } |
| 513 | |
| 514 | fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> { |
| 515 | unimplemented!("use slot_new") |
nothing calls this directly
no test coverage detected