GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python/src/module.cpp at c12ffa21dab0af0cfbcd1d948fd8a21a0f867815 · mborgerding/python Expand file tree/ Copy pathmodule.cppMore file actions 62 lines (49 loc) · 1.69 KB / Copy pathmodule.cppFile metadata and controls62 lines (49 loc) · 1.69 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 // (C) Copyright David Abrahams 2000. Permission to copy, use, modify, sell and // distribute this software is granted provided this copyright notice appears // in all copies. This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // // The author gratefully acknowleges the support of Dragon Systems, Inc., in // producing this work. #include <boost/python/detail/module_base.hpp> #include <boost/python/object/function.hpp> #include <boost/python/cast.hpp> namespace boost { namespace python { namespace detail { module_base::module_base(const char* name) : m_module( python::borrowed(Py_InitModule(const_cast<char*>(name), initial_methods)) ) { } module_base::~module_base() { } void module_base::setattr(const char* name, PyObject* x) { setattr(name, handle<>(x)); } void module_base::setattr(char const* name, handle<> const& x) { // Use function::add_to_namespace to achieve overloading if // appropriate. objects::function::add_to_namespace(m_module, name, x); } void module_base::add(type_handle const& x) { this->setattr(x->tp_name, x); } void module_base::add_class(type_handle const& class_obj) { this->add(class_obj); handle<> module_name( PyObject_GetAttrString( m_module.get(), const_cast<char*>("__name__")) ); int status = PyObject_SetAttrString( python::upcast<PyObject>(class_obj.get()) , const_cast<char*>("__module__"), module_name.get()); if (status == -1) throw_error_already_set(); } PyMethodDef module_base::initial_methods[] = { { 0, 0, 0, 0 } }; }}} // namespace boost::python::detail |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |