PyMODINIT_FUNC init_lsprof(void) { PyObject *module, *d; module = Py_InitModule3("_lsprof", moduleMethods, "Fast profiler"); if (module == NULL) return; d = PyModule_GetDict(module); if (PyType_Ready(&PyProfiler_Type) < 0) return; PyDict_SetItemString(d, "Profiler", (PyObject *)&PyProfiler_Type); if (!initialized) { PyStructSequence_InitType(&StatsEntryType, &profiler_entry_desc); PyStructSequence_InitType(&StatsSubEntryType, &profiler_subentry_desc); } Py_INCREF((PyObject*) &StatsEntryType); Py_INCREF((PyObject*) &StatsSubEntryType); PyModule_AddObject(module, "profiler_entry", (PyObject*) &StatsEntryType); PyModule_AddObject(module, "profiler_subentry", (PyObject*) &StatsSubEntryType); empty_tuple = PyTuple_New(0); initialized = 1; }
PyObject * init_util(void) { PyObject *module; #ifdef PYUV_PYTHON3 module = PyModule_Create(&pyuv_util_module); #else module = Py_InitModule("pyuv.util", Util_methods); #endif if (module == NULL) { return NULL; } /* initialize PyStructSequence types */ if (CPUInfoResultType.tp_name == 0) PyStructSequence_InitType(&CPUInfoResultType, &cpu_info_result_desc); if (CPUInfoTimesResultType.tp_name == 0) PyStructSequence_InitType(&CPUInfoTimesResultType, &cpu_info_times_result_desc); if (InterfaceAddressesResultType.tp_name == 0) PyStructSequence_InitType(&InterfaceAddressesResultType, &interface_addresses_result_desc); if (RusageResultType.tp_name == 0) PyStructSequence_InitType(&RusageResultType, &rusage_result_desc); SignalCheckerType.tp_base = &HandleType; PyUVModule_AddType(module, "SignalChecker", &SignalCheckerType); return module; }
PyObject * init_util(void) { PyObject *module; #ifdef PYUV_PYTHON3 module = PyModule_Create(&pyuv_util_module); #else module = Py_InitModule("pyuv.util", Util_methods); #endif if (module == NULL) { return NULL; } /* initialize PyStructSequence types */ if (AddrinfoResultType.tp_name == 0) PyStructSequence_InitType(&AddrinfoResultType, &addrinfo_result_desc); if (CPUInfoResultType.tp_name == 0) PyStructSequence_InitType(&CPUInfoResultType, &cpu_info_result_desc); if (CPUInfoTimesResultType.tp_name == 0) PyStructSequence_InitType(&CPUInfoTimesResultType, &cpu_info_times_result_desc); if (InterfaceAddressesResultType.tp_name == 0) PyStructSequence_InitType(&InterfaceAddressesResultType, &interface_addresses_result_desc); return module; }
void setupSysEnd() { std::vector<Box*, StlCompatAllocator<Box*>> builtin_module_names; for (const auto& p : *sys_modules_dict) { builtin_module_names.push_back(p.first); } std::sort<decltype(builtin_module_names)::iterator, PyLt>(builtin_module_names.begin(), builtin_module_names.end(), PyLt()); sys_module->giveAttr("builtin_module_names", BoxedTuple::create(builtin_module_names.size(), &builtin_module_names[0])); sys_flags_cls->finishInitialization(); /* version_info */ if (VersionInfoType.tp_name == 0) PyStructSequence_InitType((PyTypeObject*)&VersionInfoType, &version_info_desc); /* prevent user from creating new instances */ VersionInfoType.tp_init = NULL; VersionInfoType.tp_new = NULL; SET_SYS_FROM_STRING("version_info", make_version_info()); /* float_info */ if (FloatInfoType.tp_name == 0) PyStructSequence_InitType((PyTypeObject*)&FloatInfoType, &float_info_desc); /* prevent user from creating new instances */ FloatInfoType.tp_init = NULL; FloatInfoType.tp_new = NULL; SET_SYS_FROM_STRING("float_info", PyFloat_GetInfo()); }
void setupSysEnd() { std::vector<Box*> builtin_module_names; for (int i = 0; PyImport_Inittab[i].name != NULL; i++) builtin_module_names.push_back(boxString(PyImport_Inittab[i].name)); std::sort<decltype(builtin_module_names)::iterator, PyLt>(builtin_module_names.begin(), builtin_module_names.end(), PyLt()); sys_module->giveAttr("builtin_module_names", BoxedTuple::create(builtin_module_names.size(), &builtin_module_names[0])); for (Box* b : builtin_module_names) Py_DECREF(b); #ifndef NDEBUG for (const auto& p : *sys_modules_dict) { assert(PyString_Check(p.first)); bool found = false; for (int i = 0; PyImport_Inittab[i].name != NULL; i++) { if (((BoxedString*)p.first)->s() == PyImport_Inittab[i].name) { found = true; } } if (!found) assert(0 && "found a module which is inside sys.modules but not listed inside PyImport_Inittab!"); } #endif /* version_info */ if (VersionInfoType.tp_name == 0) PyStructSequence_InitType((PyTypeObject*)&VersionInfoType, &version_info_desc); /* prevent user from creating new instances */ VersionInfoType.tp_init = NULL; VersionInfoType.tp_new = NULL; SET_SYS_FROM_STRING("version_info", make_version_info()); /* float_info */ if (FloatInfoType.tp_name == 0) PyStructSequence_InitType((PyTypeObject*)&FloatInfoType, &float_info_desc); /* flags */ if (FlagsType.tp_name == 0) PyStructSequence_InitType((PyTypeObject*)&FlagsType, &flags_desc); SET_SYS_FROM_STRING("flags", make_flags()); /* prevent user from creating new instances */ FlagsType.tp_init = NULL; FlagsType.tp_new = NULL; /* prevent user from creating new instances */ FloatInfoType.tp_init = NULL; FloatInfoType.tp_new = NULL; SET_SYS_FROM_STRING("float_info", PyFloat_GetInfo()); }
/** * Simple utility function to initialize #PyStructSequence_Desc */ static PyObject *py_structseq_from_strings( PyTypeObject *py_type, PyStructSequence_Desc *py_sseq_desc, const char **str_items) { PyObject *py_struct_seq; int pos = 0; const char **str_iter; PyStructSequence_Field *desc; /* initialize array */ /* We really populate the contexts' fields here! */ for (str_iter = str_items, desc = py_sseq_desc->fields; *str_iter; str_iter++, desc++) { desc->name = (char *)*str_iter; desc->doc = NULL; } /* end sentinel */ desc->name = desc->doc = NULL; PyStructSequence_InitType(py_type, py_sseq_desc); /* initialize pytype */ py_struct_seq = PyStructSequence_New(py_type); BLI_assert(py_struct_seq != NULL); for (str_iter = str_items; *str_iter; str_iter++) { PyStructSequence_SET_ITEM(py_struct_seq, pos++, PyUnicode_FromString((*str_iter))); } return py_struct_seq; }
PyObject *BPY_app_translations_struct(void) { PyObject *ret; /* Let's finalize our contexts structseq definition! */ { BLT_i18n_contexts_descriptor *ctxt; PyStructSequence_Field *desc; /* We really populate the contexts' fields here! */ for (ctxt = _contexts, desc = app_translations_contexts_desc.fields; ctxt->c_id; ctxt++, desc++) { desc->name = (char *)ctxt->py_id; desc->doc = NULL; } desc->name = desc->doc = NULL; /* End sentinel! */ PyStructSequence_InitType(&BlenderAppTranslationsContextsType, &app_translations_contexts_desc); } if (PyType_Ready(&BlenderAppTranslationsType) < 0) return NULL; ret = PyObject_CallObject((PyObject *)&BlenderAppTranslationsType, NULL); /* prevent user from creating new instances */ BlenderAppTranslationsType.tp_new = NULL; /* without this we can't do set(sys.modules) [#29635] */ BlenderAppTranslationsType.tp_hash = (hashfunc)_Py_HashPointer; return ret; }
PyTypeObject* PyStructSequence_NewType(PyStructSequence_Desc *desc) { PyTypeObject *result = (PyTypeObject*)PyType_GenericAlloc(&PyType_Type, 0); PyStructSequence_InitType(result, desc); return result; }
PyObject *BPY_app_handlers_struct(void) { PyObject *ret; PyStructSequence_InitType(&BlenderAppCbType, &app_cb_info_desc); ret= make_app_cb_info(); /* prevent user from creating new instances */ BlenderAppCbType.tp_init= NULL; BlenderAppCbType.tp_new= NULL; /* assign the C callbacks */ if(ret) { static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{NULL}}; bCallbackFuncStore *funcstore; int pos= 0; for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) { funcstore= &funcstore_array[pos]; funcstore->func= bpy_app_generic_callback; funcstore->alloc= 0; funcstore->arg= SET_INT_IN_POINTER(pos); BLI_add_cb(funcstore, pos); } } return ret; }
static PyObject * pwd_getpwall(PyObject *self) { PyObject *d; struct passwd *p; if ((d = PyList_New(0)) == NULL) return NULL; #if defined(PYOS_OS2) && defined(PYCC_GCC) if ((p = getpwuid(0)) != NULL) { #else setpwent(); while ((p = getpwent()) != NULL) { #endif PyObject *v = mkpwent(p); if (v == NULL || PyList_Append(d, v) != 0) { Py_XDECREF(v); Py_DECREF(d); endpwent(); return NULL; } Py_DECREF(v); } endpwent(); return d; } #endif static PyMethodDef pwd_methods[] = { {"getpwuid", pwd_getpwuid, METH_VARARGS, pwd_getpwuid__doc__}, {"getpwnam", pwd_getpwnam, METH_VARARGS, pwd_getpwnam__doc__}, #ifdef HAVE_GETPWENT {"getpwall", (PyCFunction)pwd_getpwall, METH_NOARGS, pwd_getpwall__doc__}, #endif {NULL, NULL} /* sentinel */ }; PyMODINIT_FUNC initpwd(void) { PyObject *m; m = Py_InitModule3("pwd", pwd_methods, pwd__doc__); if (m == NULL) return; if (!initialized) PyStructSequence_InitType(&StructPwdType, &struct_pwd_type_desc); Py_INCREF((PyObject *) &StructPwdType); PyModule_AddObject(m, "struct_passwd", (PyObject *) &StructPwdType); /* And for b/w compatibility (this was defined by mistake): */ Py_INCREF((PyObject *) &StructPwdType); PyModule_AddObject(m, "struct_pwent", (PyObject *) &StructPwdType); initialized = 1; }
void init_stat(void) { stat_result_desc.name = (char *) "utp" ".stat_result"; stat_result_desc.fields[7].name = PyStructSequence_UnnamedField; stat_result_desc.fields[8].name = PyStructSequence_UnnamedField; stat_result_desc.fields[9].name = PyStructSequence_UnnamedField; PyStructSequence_InitType(&StatResultType, &stat_result_desc); structseq_new = StatResultType.tp_new; StatResultType.tp_new = statresult_new; }
PyMODINIT_FUNC initspwd(void) { PyObject *m; m=Py_InitModule3("spwd", spwd_methods, spwd__doc__); if (m == NULL) return; if (!initialized) PyStructSequence_InitType(&StructSpwdType, &struct_spwd_type_desc); Py_INCREF((PyObject *) &StructSpwdType); PyModule_AddObject(m, "struct_spwd", (PyObject *) &StructSpwdType); initialized = 1; }
PyObject *BPY_app_oiio_struct(void) { PyObject *ret; PyStructSequence_InitType(&BlenderAppOIIOType, &app_oiio_info_desc); ret = make_oiio_info(); /* prevent user from creating new instances */ BlenderAppOIIOType.tp_init = NULL; BlenderAppOIIOType.tp_new = NULL; BlenderAppOIIOType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */ return ret; }
PyMODINIT_FUNC PyInit_spwd(void) { PyObject *m; m=PyModule_Create(&spwdmodule); if (m == NULL) return NULL; if (!initialized) PyStructSequence_InitType(&StructSpwdType, &struct_spwd_type_desc); Py_INCREF((PyObject *) &StructSpwdType); PyModule_AddObject(m, "struct_spwd", (PyObject *) &StructSpwdType); initialized = 1; return m; }
PyObject *BPY_app_struct(void) { PyObject *ret; PyStructSequence_InitType(&BlenderAppType, &app_info_desc); ret= make_app_info(); /* prevent user from creating new instances */ BlenderAppType.tp_init= NULL; BlenderAppType.tp_new= NULL; /* kindof a hack ontop of PyStructSequence */ py_struct_seq_getset_init(); return ret; }
PyObject *BPY_app_struct(void) { PyObject *ret; PyStructSequence_InitType(&BlenderAppType, &app_info_desc); ret = make_app_info(); /* prevent user from creating new instances */ BlenderAppType.tp_init = NULL; BlenderAppType.tp_new = NULL; BlenderAppType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */ /* kindof a hack ontop of PyStructSequence */ py_struct_seq_getset_init(); return ret; }
PyObject *BPY_app_handlers_struct(void) { PyObject *ret; #if defined(_MSC_VER) || defined(FREE_WINDOWS) BPyPersistent_Type.ob_base.ob_base.ob_type = &PyType_Type; #endif if (PyType_Ready(&BPyPersistent_Type) < 0) { BLI_assert(!"error initializing 'bpy.app.handlers.persistent'"); } PyStructSequence_InitType(&BlenderAppCbType, &app_cb_info_desc); ret = make_app_cb_info(); /* prevent user from creating new instances */ BlenderAppCbType.tp_init = NULL; BlenderAppCbType.tp_new = NULL; BlenderAppCbType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */ /* assign the C callbacks */ if (ret) { static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT] = {{NULL}}; bCallbackFuncStore *funcstore; int pos = 0; for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) { funcstore = &funcstore_array[pos]; funcstore->func = bpy_app_generic_callback; funcstore->alloc = 0; funcstore->arg = SET_INT_IN_POINTER(pos); BLI_callback_add(funcstore, pos); } } return ret; }
/* pyev_module initialization */ PyObject * init_pyev(void) { PyObject *pyev; #ifdef MS_WINDOWS if (pyev_setmaxstdio() || pyev_import_socket()) { return NULL; } #endif /* fill in deferred data addresses */ WatcherType.tp_new = PyType_GenericNew; #if EV_PERIODIC_ENABLE PeriodicBaseType.tp_base = &WatcherType; #endif #if EV_STAT_ENABLE /* init StatdataType */ if (!StatdataType_initialized) { PyStructSequence_InitType(&StatdataType, &Statdata_desc); StatdataType_initialized = 1; } #endif /* pyev */ #if PY_MAJOR_VERSION >= 3 pyev = PyModule_Create(&pyev_module); #else pyev = Py_InitModule3("pyev", pyev_m_methods, pyev_m_doc); #endif if (!pyev) { return NULL; } /* pyev.Error */ Error = PyErr_NewException("pyev.Error", NULL, NULL); if (!Error || PyModule_AddObject(pyev, "Error", Error)) { Py_XDECREF(Error); goto fail; } /* adding types and constants */ if ( /* Loop */ PyModule_AddType(pyev, "Loop", &LoopType) || PyModule_AddUnsignedIntMacro(pyev, EVFLAG_AUTO) || PyModule_AddUnsignedIntMacro(pyev, EVFLAG_NOENV) || PyModule_AddUnsignedIntMacro(pyev, EVFLAG_FORKCHECK) || PyModule_AddUnsignedIntMacro(pyev, EVFLAG_NOINOTIFY) || PyModule_AddUnsignedIntMacro(pyev, EVFLAG_SIGNALFD) || PyModule_AddUnsignedIntMacro(pyev, EVFLAG_NOSIGMASK) || PyModule_AddUnsignedIntMacro(pyev, EVBACKEND_SELECT) || PyModule_AddUnsignedIntMacro(pyev, EVBACKEND_POLL) || PyModule_AddUnsignedIntMacro(pyev, EVBACKEND_EPOLL) || PyModule_AddUnsignedIntMacro(pyev, EVBACKEND_KQUEUE) || PyModule_AddUnsignedIntMacro(pyev, EVBACKEND_DEVPOLL) || PyModule_AddUnsignedIntMacro(pyev, EVBACKEND_PORT) || PyModule_AddUnsignedIntMacro(pyev, EVBACKEND_ALL) || PyModule_AddUnsignedIntMacro(pyev, EVBACKEND_MASK) || PyModule_AddIntMacro(pyev, EVRUN_NOWAIT) || PyModule_AddIntMacro(pyev, EVRUN_ONCE) || PyModule_AddIntMacro(pyev, EVBREAK_ONE) || PyModule_AddIntMacro(pyev, EVBREAK_ALL) || /* watchers */ PyType_Ready(&WatcherType) || PyModule_AddWatcher(pyev, "Io", &IoType, NULL) || PyModule_AddIntMacro(pyev, EV_IO) || PyModule_AddIntMacro(pyev, EV_READ) || PyModule_AddIntMacro(pyev, EV_WRITE) || PyModule_AddWatcher(pyev, "Timer", &TimerType, NULL) || PyModule_AddIntMacro(pyev, EV_TIMER) || #if EV_PERIODIC_ENABLE PyType_Ready(&PeriodicBaseType) || PyModule_AddWatcher(pyev, "Periodic", &PeriodicType, &PeriodicBaseType) || PyModule_AddIntMacro(pyev, EV_PERIODIC) || #if EV_PREPARE_ENABLE PyModule_AddWatcher(pyev, "Scheduler", &SchedulerType, &PeriodicBaseType) || #endif #endif #if EV_SIGNAL_ENABLE PyModule_AddWatcher(pyev, "Signal", &SignalType, NULL) || PyModule_AddIntMacro(pyev, EV_SIGNAL) || #endif #if EV_CHILD_ENABLE PyModule_AddWatcher(pyev, "Child", &ChildType, NULL) || PyModule_AddIntMacro(pyev, EV_CHILD) || #endif #if EV_STAT_ENABLE PyModule_AddWatcher(pyev, "Stat", &StatType, NULL) || PyModule_AddIntMacro(pyev, EV_STAT) || #endif #if EV_IDLE_ENABLE PyModule_AddWatcher(pyev, "Idle", &IdleType, NULL) || PyModule_AddIntMacro(pyev, EV_IDLE) || #endif #if EV_PREPARE_ENABLE PyModule_AddWatcher(pyev, "Prepare", &PrepareType, NULL) || PyModule_AddIntMacro(pyev, EV_PREPARE) || #endif #if EV_CHECK_ENABLE PyModule_AddWatcher(pyev, "Check", &CheckType, NULL) || PyModule_AddIntMacro(pyev, EV_CHECK) || #endif #if EV_EMBED_ENABLE PyModule_AddWatcher(pyev, "Embed", &EmbedType, NULL) || PyModule_AddIntMacro(pyev, EV_EMBED) || #endif #if EV_FORK_ENABLE PyModule_AddWatcher(pyev, "Fork", &ForkType, NULL) || PyModule_AddIntMacro(pyev, EV_FORK) || #endif #if EV_ASYNC_ENABLE PyModule_AddWatcher(pyev, "Async", &AsyncType, NULL) || PyModule_AddIntMacro(pyev, EV_ASYNC) || #endif /* additional events */ PyModule_AddIntMacro(pyev, EV_CUSTOM) || PyModule_AddIntMacro(pyev, EV_ERROR) || /* priorities */ PyModule_AddIntMacro(pyev, EV_MINPRI) || PyModule_AddIntMacro(pyev, EV_MAXPRI) ) { goto fail; } /* setup libev */ ev_set_allocator(pyev_allocator); ev_set_syserr_cb(pyev_syserr_cb); return pyev; fail: #if PY_MAJOR_VERSION >= 3 Py_DECREF(pyev); #endif return NULL; }
PyMODINIT_FUNC PyInit_resource(void) { PyObject *m, *v; /* Create the module and add the functions */ m = PyModule_Create(&resourcemodule); if (m == NULL) return NULL; /* Add some symbolic constants to the module */ if (ResourceError == NULL) { ResourceError = PyErr_NewException("resource.error", NULL, NULL); } Py_INCREF(ResourceError); PyModule_AddObject(m, "error", ResourceError); if (!initialized) PyStructSequence_InitType(&StructRUsageType, &struct_rusage_desc); Py_INCREF(&StructRUsageType); PyModule_AddObject(m, "struct_rusage", (PyObject*) &StructRUsageType); /* insert constants */ #ifdef RLIMIT_CPU PyModule_AddIntConstant(m, "RLIMIT_CPU", RLIMIT_CPU); #endif #ifdef RLIMIT_FSIZE PyModule_AddIntConstant(m, "RLIMIT_FSIZE", RLIMIT_FSIZE); #endif #ifdef RLIMIT_DATA PyModule_AddIntConstant(m, "RLIMIT_DATA", RLIMIT_DATA); #endif #ifdef RLIMIT_STACK PyModule_AddIntConstant(m, "RLIMIT_STACK", RLIMIT_STACK); #endif #ifdef RLIMIT_CORE PyModule_AddIntConstant(m, "RLIMIT_CORE", RLIMIT_CORE); #endif #ifdef RLIMIT_NOFILE PyModule_AddIntConstant(m, "RLIMIT_NOFILE", RLIMIT_NOFILE); #endif #ifdef RLIMIT_OFILE PyModule_AddIntConstant(m, "RLIMIT_OFILE", RLIMIT_OFILE); #endif #ifdef RLIMIT_VMEM PyModule_AddIntConstant(m, "RLIMIT_VMEM", RLIMIT_VMEM); #endif #ifdef RLIMIT_AS PyModule_AddIntConstant(m, "RLIMIT_AS", RLIMIT_AS); #endif #ifdef RLIMIT_RSS PyModule_AddIntConstant(m, "RLIMIT_RSS", RLIMIT_RSS); #endif #ifdef RLIMIT_NPROC PyModule_AddIntConstant(m, "RLIMIT_NPROC", RLIMIT_NPROC); #endif #ifdef RLIMIT_MEMLOCK PyModule_AddIntConstant(m, "RLIMIT_MEMLOCK", RLIMIT_MEMLOCK); #endif #ifdef RLIMIT_SBSIZE PyModule_AddIntConstant(m, "RLIMIT_SBSIZE", RLIMIT_SBSIZE); #endif #ifdef RUSAGE_SELF PyModule_AddIntConstant(m, "RUSAGE_SELF", RUSAGE_SELF); #endif #ifdef RUSAGE_CHILDREN PyModule_AddIntConstant(m, "RUSAGE_CHILDREN", RUSAGE_CHILDREN); #endif #ifdef RUSAGE_BOTH PyModule_AddIntConstant(m, "RUSAGE_BOTH", RUSAGE_BOTH); #endif #ifdef RUSAGE_THREAD PyModule_AddIntConstant(m, "RUSAGE_THREAD", RUSAGE_THREAD); #endif #if defined(HAVE_LONG_LONG) if (sizeof(RLIM_INFINITY) > sizeof(long)) { v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY); } else #endif { v = PyLong_FromLong((long) RLIM_INFINITY); } if (v) { PyModule_AddObject(m, "RLIM_INFINITY", v); } initialized = 1; return m; }
static PyObject * pwd_getpwall(PyObject *self) { PyObject *d; struct passwd *p; if ((d = PyList_New(0)) == NULL) return NULL; #if defined(PYOS_OS2) && defined(PYCC_GCC) if ((p = getpwuid(0)) != NULL) { #elif !defined(AMITCP) && !defined(INET225) setpwent(); while ((p = getpwent()) != NULL) { PyObject *v = mkpwent(p); if (v == NULL || PyList_Append(d, v) != 0) { Py_XDECREF(v); Py_DECREF(d); return NULL; } Py_DECREF(v); } return d; #else #ifdef AMITCP setpwent(); #else setpwent(1); /* INET225 wants argument XXX correct? - I.J. */ #endif while ((p = getpwent()) != NULL) { PyObject *v = mkpwent(p); if (v == NULL || PyList_Append(d, v) != 0) { Py_XDECREF(v); Py_DECREF(d); endpwent(); return NULL; } Py_DECREF(v); } endpwent(); return d; #endif /* AMITCP or INET225 */ } #endif static PyMethodDef pwd_methods[] = { {"getpwuid", pwd_getpwuid, METH_VARARGS, pwd_getpwuid__doc__}, {"getpwnam", pwd_getpwnam, METH_VARARGS, pwd_getpwnam__doc__}, #ifdef HAVE_GETPWENT {"getpwall", (PyCFunction)pwd_getpwall, METH_NOARGS, pwd_getpwall__doc__}, #endif {NULL, NULL} /* sentinel */ }; PyMODINIT_FUNC initpwd(void) { PyObject *m; m = Py_InitModule3("pwd", pwd_methods, pwd__doc__); PyStructSequence_InitType(&StructPwdType, &struct_pwd_type_desc); Py_INCREF((PyObject *) &StructPwdType); PyModule_AddObject(m, "struct_pwent", (PyObject *) &StructPwdType); }
void init_localconv(PyObject* module) { PyStructSequence_InitType(&LconvType, &lconv_desc); Py_INCREF((PyObject*)&LconvType); PyModule_AddObject(module, "lconv", (PyObject*)&LconvType); }