MCPcopy Create free account
hub / github.com/pybind/pybind11 / weakref

Class weakref

include/pybind11/pytypes.h:1983–1998  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1981};
1982
1983class weakref : public object {
1984public:
1985 PYBIND11_OBJECT_CVT_DEFAULT(weakref, object, PyWeakref_Check, raw_weakref)
1986 explicit weakref(handle obj, handle callback = {})
1987 : object(PyWeakref_NewRef(obj.ptr(), callback.ptr()), stolen_t{}) {
1988 if (!m_ptr) {
1989 if (PyErr_Occurred()) {
1990 throw error_already_set();
1991 }
1992 pybind11_fail("Could not allocate weak reference!");
1993 }
1994 }
1995
1996private:
1997 static PyObject *raw_weakref(PyObject *o) { return PyWeakref_NewRef(o, nullptr); }
1998};
1999
2000class slice : public object {
2001public:

Callers 5

TEST_SUBMODULEFunction · 0.85
class_Class · 0.85
all_type_info_get_cacheFunction · 0.85

Calls

no outgoing calls

Tested by 2

TEST_SUBMODULEFunction · 0.68