2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-22 05:22:45 +00:00

Add staticmethod support from Nikolay Mladenov <nickm-at-sitius.com>

[SVN r16946]
This commit is contained in:
Dave Abrahams
2003-01-19 19:12:30 +00:00
parent 571790097a
commit 399cf70b92
10 changed files with 233 additions and 38 deletions

View File

@@ -12,6 +12,7 @@
#include <boost/python/object_attributes.hpp>
#include <boost/python/args.hpp>
#include <boost/python/refcount.hpp>
#include <boost/python/extract.hpp>
#include <algorithm>
#include <cstring>
@@ -261,7 +262,22 @@ void function::add_to_namespace(
if (existing)
{
if (existing->ob_type == &function_type)
{
new_func->add_overload(existing);
}
else if (existing->ob_type == &PyStaticMethod_Type)
{
char const* name_space_name = extract<char const*>(name_space.attr("__name__"));
::PyErr_Format(
PyExc_RuntimeError
, "Boost.Python - All overloads must be exported "
"before calling \'class_<...>(\"%s\").staticmethod(\"%s\")\'"
, name_space_name
, name_
);
throw_error_already_set();
}
}
else if (is_binary_operator(name_))
{