Compare commits
6 Commits
boost-1.44
...
boost-1.46
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d023b86831 | ||
|
|
ba213663b6 | ||
|
|
736ba48c2b | ||
|
|
6066ffef9a | ||
|
|
f759e9eb0e | ||
|
|
846c5d9914 |
0
doc/PyConDC_2003/bpl.html
Executable file → Normal file
0
doc/PyConDC_2003/bpl.pdf
Executable file → Normal file
0
doc/PyConDC_2003/python_cpp_mix.jpg
Executable file → Normal file
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
0
doc/PyConDC_2003/python_cpp_mix.png
Executable file → Normal file
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
0
doc/internals.html
Executable file → Normal file
0
doc/internals.rst
Executable file → Normal file
0
doc/tutorial/doc/html/images/alert.png
Executable file → Normal file
|
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 603 B |
0
doc/tutorial/doc/html/images/home.png
Executable file → Normal file
|
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 358 B |
0
doc/tutorial/doc/html/images/next.png
Executable file → Normal file
|
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
0
doc/tutorial/doc/html/images/note.png
Executable file → Normal file
|
Before Width: | Height: | Size: 658 B After Width: | Height: | Size: 658 B |
0
doc/tutorial/doc/html/images/prev.png
Executable file → Normal file
|
Before Width: | Height: | Size: 334 B After Width: | Height: | Size: 334 B |
0
doc/tutorial/doc/html/images/tip.png
Executable file → Normal file
|
Before Width: | Height: | Size: 640 B After Width: | Height: | Size: 640 B |
0
doc/tutorial/doc/html/images/up.png
Executable file → Normal file
|
Before Width: | Height: | Size: 370 B After Width: | Height: | Size: 370 B |
0
doc/v2/instance_holder.html
Executable file → Normal file
0
doc/v2/lvalue_from_pytype.html
Executable file → Normal file
0
doc/v2/operators.html
Executable file → Normal file
0
doc/v2/raw_function.html
Executable file → Normal file
0
doc/v2/return_arg.html
Executable file → Normal file
0
doc/v2/stl_iterator.html
Executable file → Normal file
0
doc/v2/type_id.html
Executable file → Normal file
0
doc/v2/wrapper.html
Executable file → Normal file
0
example/Jamroot
Executable file → Normal file
0
example/boost-build.jam
Executable file → Normal file
0
example/quickstart/Jamroot
Executable file → Normal file
@@ -26,6 +26,14 @@ project
|
||||
# source files after the colon separated by spaces.
|
||||
python-extension hello_ext : hello.cpp ;
|
||||
|
||||
# Put the extension and Boost.Python DLL in the current directory, so
|
||||
# that running script by hand works.
|
||||
install convenient_copy
|
||||
: hello_ext
|
||||
: <install-dependencies>on <install-type>SHARED_LIB <install-type>PYTHON_EXTENSION
|
||||
<location>.
|
||||
;
|
||||
|
||||
# A little "rule" (function) to clean up the syntax of declaring tests
|
||||
# of these extension modules.
|
||||
local rule run-test ( test-name : sources + )
|
||||
|
||||
0
include/boost/python/arg_from_python.hpp
Executable file → Normal file
0
include/boost/python/base_type_traits.hpp
Executable file → Normal file
0
include/boost/python/borrowed.hpp
Executable file → Normal file
0
include/boost/python/cast.hpp
Executable file → Normal file
0
include/boost/python/converter/arg_from_python.hpp
Executable file → Normal file
0
include/boost/python/converter/arg_to_python.hpp
Executable file → Normal file
0
include/boost/python/converter/arg_to_python_base.hpp
Executable file → Normal file
@@ -122,7 +122,7 @@ BOOST_PYTHON_TO_INT(short)
|
||||
BOOST_PYTHON_TO_INT(int)
|
||||
BOOST_PYTHON_TO_INT(long)
|
||||
|
||||
# if defined(_MSC_VER) && defined(_WIN64)
|
||||
# if defined(_MSC_VER) && defined(_WIN64) && PY_VERSION_HEX < 0x03000000
|
||||
/* Under 64-bit Windows std::size_t is "unsigned long long". To avoid
|
||||
getting a Python long for each std::size_t the value is checked before
|
||||
the conversion. A std::size_t is converted to a simple Python int
|
||||
|
||||
0
include/boost/python/converter/context_result_converter.hpp
Executable file → Normal file
0
include/boost/python/converter/object_manager.hpp
Executable file → Normal file
0
include/boost/python/converter/pytype_function.hpp
Executable file → Normal file
0
include/boost/python/converter/return_from_python.hpp
Executable file → Normal file
0
include/boost/python/def_visitor.hpp
Executable file → Normal file
0
include/boost/python/detail/borrowed_ptr.hpp
Executable file → Normal file
0
include/boost/python/detail/convertible.hpp
Executable file → Normal file
0
include/boost/python/detail/copy_ctor_mutates_rhs.hpp
Executable file → Normal file
0
include/boost/python/detail/def_helper_fwd.hpp
Executable file → Normal file
0
include/boost/python/detail/enable_if.hpp
Executable file → Normal file
0
include/boost/python/detail/force_instantiate.hpp
Executable file → Normal file
0
include/boost/python/detail/is_shared_ptr.hpp
Executable file → Normal file
0
include/boost/python/detail/is_wrapper.hpp
Executable file → Normal file
0
include/boost/python/detail/nullary_function_adaptor.hpp
Executable file → Normal file
@@ -53,6 +53,9 @@ enum operator_id
|
||||
op_nonzero,
|
||||
#endif
|
||||
op_repr
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
,op_truediv
|
||||
#endif
|
||||
};
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
0
include/boost/python/detail/prefix.hpp
Executable file → Normal file
0
include/boost/python/detail/python_type.hpp
Executable file → Normal file
0
include/boost/python/detail/sfinae.hpp
Executable file → Normal file
0
include/boost/python/detail/unwind_type.hpp
Executable file → Normal file
0
include/boost/python/detail/unwrap_type_id.hpp
Executable file → Normal file
0
include/boost/python/detail/unwrap_wrapper.hpp
Executable file → Normal file
0
include/boost/python/detail/value_arg.hpp
Executable file → Normal file
0
include/boost/python/detail/wrapper_base.hpp
Executable file → Normal file
0
include/boost/python/docstring_options.hpp
Executable file → Normal file
0
include/boost/python/handle.hpp
Executable file → Normal file
0
include/boost/python/handle_fwd.hpp
Executable file → Normal file
0
include/boost/python/instance_holder.hpp
Executable file → Normal file
@@ -13,27 +13,54 @@
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
# if PY_VERSION_HEX >= 0x03000000
|
||||
|
||||
BOOST_PYTHON_DECL PyObject* init_module(PyModuleDef&, void(*)());
|
||||
|
||||
#else
|
||||
|
||||
BOOST_PYTHON_DECL PyObject* init_module(char const* name, void(*)());
|
||||
|
||||
#endif
|
||||
|
||||
}}}
|
||||
|
||||
# if PY_VERSION_HEX >= 0x03000000
|
||||
|
||||
# define _BOOST_PYTHON_MODULE_INIT(name) \
|
||||
PyObject* BOOST_PP_CAT (PyInit_,name)() \
|
||||
{ \
|
||||
return boost::python::detail::init_module( \
|
||||
BOOST_PP_STRINGIZE(name),&BOOST_PP_CAT(init_module_,name)); \
|
||||
} \
|
||||
void BOOST_PP_CAT(init_module_,name)()
|
||||
# define _BOOST_PYTHON_MODULE_INIT(name) \
|
||||
PyObject* BOOST_PP_CAT(PyInit_, name)() \
|
||||
{ \
|
||||
static PyModuleDef_Base initial_m_base = { \
|
||||
PyObject_HEAD_INIT(NULL) \
|
||||
0, /* m_init */ \
|
||||
0, /* m_index */ \
|
||||
0 /* m_copy */ }; \
|
||||
static PyMethodDef initial_methods[] = { { 0, 0, 0, 0 } }; \
|
||||
\
|
||||
static struct PyModuleDef moduledef = { \
|
||||
initial_m_base, \
|
||||
BOOST_PP_STRINGIZE(name), \
|
||||
0, /* m_doc */ \
|
||||
-1, /* m_size */ \
|
||||
initial_methods, \
|
||||
0, /* m_reload */ \
|
||||
0, /* m_traverse */ \
|
||||
0, /* m_clear */ \
|
||||
0, /* m_free */ \
|
||||
}; \
|
||||
\
|
||||
return boost::python::detail::init_module( \
|
||||
moduledef, BOOST_PP_CAT(init_module_, name) ); \
|
||||
} \
|
||||
void BOOST_PP_CAT(init_module_, name)()
|
||||
|
||||
# else
|
||||
|
||||
# define _BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void BOOST_PP_CAT(init,name)() \
|
||||
void BOOST_PP_CAT(init,name)() \
|
||||
{ \
|
||||
boost::python::detail::init_module( \
|
||||
BOOST_PP_STRINGIZE(name),&BOOST_PP_CAT(init_module_,name)); \
|
||||
BOOST_PP_STRINGIZE(name),&BOOST_PP_CAT(init_module_,name)); \
|
||||
} \
|
||||
void BOOST_PP_CAT(init_module_,name)()
|
||||
|
||||
@@ -42,23 +69,23 @@ BOOST_PYTHON_DECL PyObject* init_module(char const* name, void(*)());
|
||||
# if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(BOOST_PYTHON_STATIC_MODULE)
|
||||
|
||||
# define BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void BOOST_PP_CAT(init_module_,name)(); \
|
||||
void BOOST_PP_CAT(init_module_,name)(); \
|
||||
extern "C" __declspec(dllexport) _BOOST_PYTHON_MODULE_INIT(name)
|
||||
|
||||
# elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
|
||||
|
||||
# define BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void BOOST_PP_CAT(init_module_,name)(); \
|
||||
void BOOST_PP_CAT(init_module_,name)(); \
|
||||
extern "C" __attribute__ ((visibility("default"))) _BOOST_PYTHON_MODULE_INIT(name)
|
||||
|
||||
# else
|
||||
|
||||
# define BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void BOOST_PP_CAT(init_module_,name)(); \
|
||||
void BOOST_PP_CAT(init_module_,name)(); \
|
||||
extern "C" _BOOST_PYTHON_MODULE_INIT(name)
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif // MODULE_INIT_DWA20020722_HPP
|
||||
|
||||
0
include/boost/python/object.hpp
Executable file → Normal file
@@ -39,6 +39,8 @@ struct BOOST_PYTHON_DECL function : PyObject
|
||||
void doc(object const& x);
|
||||
|
||||
object const& name() const;
|
||||
|
||||
object const& get_namespace() const { return m_namespace; }
|
||||
|
||||
private: // helper functions
|
||||
object signature(bool show_return_type=false) const;
|
||||
|
||||
0
include/boost/python/object/function_doc_signature.hpp
Executable file → Normal file
0
include/boost/python/object/inheritance_query.hpp
Executable file → Normal file
@@ -10,6 +10,8 @@
|
||||
# include <boost/python/converter/registered.hpp>
|
||||
# include <boost/python/detail/decref_guard.hpp>
|
||||
# include <boost/python/detail/none.hpp>
|
||||
# include <boost/mpl/assert.hpp>
|
||||
# include <boost/mpl/or.hpp>
|
||||
# include <boost/type_traits/is_union.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
0
include/boost/python/object/stl_iterator_core.hpp
Executable file → Normal file
0
include/boost/python/object_items.hpp
Executable file → Normal file
0
include/boost/python/object_protocol_core.hpp
Executable file → Normal file
@@ -212,7 +212,11 @@ namespace self_ns \
|
||||
BOOST_PYTHON_BINARY_OPERATOR(add, radd, +)
|
||||
BOOST_PYTHON_BINARY_OPERATOR(sub, rsub, -)
|
||||
BOOST_PYTHON_BINARY_OPERATOR(mul, rmul, *)
|
||||
BOOST_PYTHON_BINARY_OPERATOR(div, rdiv, /)
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
BOOST_PYTHON_BINARY_OPERATOR(truediv, rtruediv, /)
|
||||
#else
|
||||
BOOST_PYTHON_BINARY_OPERATOR(div, rdiv, /)
|
||||
#endif
|
||||
BOOST_PYTHON_BINARY_OPERATOR(mod, rmod, %)
|
||||
BOOST_PYTHON_BINARY_OPERATOR(lshift, rlshift, <<)
|
||||
BOOST_PYTHON_BINARY_OPERATOR(rshift, rrshift, >>)
|
||||
|
||||
0
include/boost/python/other.hpp
Executable file → Normal file
0
include/boost/python/override.hpp
Executable file → Normal file
0
include/boost/python/proxy.hpp
Executable file → Normal file
0
include/boost/python/pure_virtual.hpp
Executable file → Normal file
0
include/boost/python/raw_function.hpp
Executable file → Normal file
0
include/boost/python/refcount.hpp
Executable file → Normal file
0
include/boost/python/return_arg.hpp
Executable file → Normal file
0
include/boost/python/self.hpp
Executable file → Normal file
0
include/boost/python/stl_iterator.hpp
Executable file → Normal file
0
include/boost/python/wrapper.hpp
Executable file → Normal file
@@ -11,6 +11,23 @@
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
namespace
|
||||
{
|
||||
PyObject* init_module_in_scope(PyObject* m, void(*init_function)())
|
||||
{
|
||||
if (m != 0)
|
||||
{
|
||||
// Create the current module scope
|
||||
object m_obj(((borrowed_reference_t*)m));
|
||||
scope current_module(m_obj);
|
||||
|
||||
handle_exception(init_function);
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_PYTHON_DECL void scope_setattr_doc(char const* name, object const& x, char const* doc)
|
||||
{
|
||||
// Use function::add_to_namespace to achieve overloading if
|
||||
@@ -19,42 +36,31 @@ BOOST_PYTHON_DECL void scope_setattr_doc(char const* name, object const& x, char
|
||||
objects::add_to_namespace(current, name, x, doc);
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
|
||||
PyObject* init_module(PyModuleDef& moduledef, void(*init_function)())
|
||||
{
|
||||
return init_module_in_scope(
|
||||
PyModule_Create(&moduledef),
|
||||
init_function);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
namespace
|
||||
{
|
||||
PyMethodDef initial_methods[] = { { 0, 0, 0, 0 } };
|
||||
PyMethodDef initial_methods[] = { { 0, 0, 0, 0 } };
|
||||
}
|
||||
|
||||
BOOST_PYTHON_DECL PyObject* init_module(char const* name, void(*init_function)())
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
static struct PyModuleDef moduledef = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
name,
|
||||
0, /* m_doc */
|
||||
-1, /* m_size */
|
||||
initial_methods,
|
||||
0, /* m_reload */
|
||||
0, /* m_traverse */
|
||||
0, /* m_clear */
|
||||
0, /* m_free */
|
||||
};
|
||||
PyObject* m = PyModule_Create(&moduledef);
|
||||
#else
|
||||
PyObject* m
|
||||
= Py_InitModule(const_cast<char*>(name), initial_methods);
|
||||
#endif
|
||||
|
||||
if (m != 0)
|
||||
{
|
||||
// Create the current module scope
|
||||
object m_obj(((borrowed_reference_t*)m));
|
||||
scope current_module(m_obj);
|
||||
|
||||
handle_exception(init_function);
|
||||
}
|
||||
return m;
|
||||
return init_module_in_scope(
|
||||
Py_InitModule(const_cast<char*>(name), initial_methods),
|
||||
init_function);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -670,11 +670,26 @@ extern "C"
|
||||
{
|
||||
return python::incref(upcast<PyObject>(&PyCFunction_Type));
|
||||
}
|
||||
|
||||
static PyObject* function_get_module(PyObject* op, void*)
|
||||
{
|
||||
function* f = downcast<function>(op);
|
||||
object const& ns = f->get_namespace();
|
||||
if (!ns.is_none()) {
|
||||
return python::incref(ns.ptr());
|
||||
}
|
||||
PyErr_SetString(
|
||||
PyExc_AttributeError, const_cast<char*>(
|
||||
"Boost.Python function __module__ unknown."));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static PyGetSetDef function_getsetlist[] = {
|
||||
{const_cast<char*>("__name__"), (getter)function_get_name, 0, 0, 0 },
|
||||
{const_cast<char*>("func_name"), (getter)function_get_name, 0, 0, 0 },
|
||||
{const_cast<char*>("__module__"), (getter)function_get_module, 0, 0, 0 },
|
||||
{const_cast<char*>("func_module"), (getter)function_get_module, 0, 0, 0 },
|
||||
{const_cast<char*>("__class__"), (getter)function_get_class, 0, 0, 0 }, // see note above
|
||||
{const_cast<char*>("__doc__"), (getter)function_get_doc, (setter)function_set_doc, 0, 0},
|
||||
{const_cast<char*>("func_doc"), (getter)function_get_doc, (setter)function_set_doc, 0, 0},
|
||||
|
||||
0
src/wrapper.cpp
Executable file → Normal file
0
test/borrowed.cpp
Executable file → Normal file
0
test/cltree.cpp
Executable file → Normal file
0
test/copy_ctor_mutates_rhs.cpp
Executable file → Normal file
0
test/crossmod_exception_a.cpp
Executable file → Normal file
0
test/crossmod_exception_b.cpp
Executable file → Normal file
0
test/injected.cpp
Executable file → Normal file
0
test/int_map_indexing_suite.cpp
Executable file → Normal file
0
test/keywords.cpp
Executable file → Normal file
0
test/object_fail1.cpp
Executable file → Normal file
0
test/object_manager.cpp
Executable file → Normal file
0
test/operators.cpp
Executable file → Normal file
0
test/polymorphism2.cpp
Executable file → Normal file
0
test/polymorphism2_auto_ptr.cpp
Executable file → Normal file
0
test/properties.cpp
Executable file → Normal file
@@ -7,6 +7,11 @@
|
||||
>>> print func.__doc__.splitlines()[1]
|
||||
func( (A)arg1) -> A :
|
||||
|
||||
>>> print func.__module__
|
||||
pytype_function_ext
|
||||
|
||||
>>> print func.__name__
|
||||
func
|
||||
"""
|
||||
def run(args = None):
|
||||
import sys
|
||||
|
||||