MCPcopy Create free account
hub / github.com/mhammond/pywin32 / SetPythonObject

Method SetPythonObject

Pythonwin/win32context.cpp:29–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28#define TEMPLATE_ATTR "template"
29void PythonCreateContext::SetPythonObject(PyObject *ob)
30{
31 ASSERT(ob);
32 m_PythonObject = ob;
33 Py_INCREF(m_PythonObject);
34 // now try and get the template object.
35
36 if (ob!=Py_None) {
37 PyObject *pTempl = PyObject_GetAttrString(ob, TEMPLATE_ATTR);
38 if (pTempl==NULL)
39 PyErr_SetString(ui_module_error, "Warning - CreateContext object has no " TEMPLATE_ATTR " attribute");
40 else {
41 m_pNewDocTemplate = PyCDocTemplate::GetTemplate(pTempl);
42 }
43 }
44 if (PyErr_Occurred())
45 gui_print_error();
46}
47void PythonCreateContext::ReleasePythonObject()
48{
49 Py_XDECREF(m_PythonObject);

Callers 4

ui_window_create_windowFunction · 0.80
PyCFrameWnd_CreateWindowFunction · 0.80
ui_frame_load_frameFunction · 0.80

Calls 1

gui_print_errorFunction · 0.85

Tested by

no test coverage detected