diff --git a/build/Jamfile.v2 b/build/Jamfile.v2
index 959a9b6f..dbb16b09 100644
--- a/build/Jamfile.v2
+++ b/build/Jamfile.v2
@@ -7,8 +7,6 @@ import modules ;
import python ;
-if [ python.configured ] {
-
project boost/python
: source-location ../src
@@ -70,9 +68,3 @@ lib boost_python
static:BOOST_PYTHON_STATIC_LIB
shared:BOOST_PYTHON_DYNAMIC_LIB
;
-}
-else
-{
- ECHO "warning: Python location is not configured" ;
- ECHO "warning: the Boost.Python library won't be built" ;
-}
diff --git a/include/boost/python/detail/def_helper.hpp b/include/boost/python/detail/def_helper.hpp
index 33abf19d..e68ca0cd 100644
--- a/include/boost/python/detail/def_helper.hpp
+++ b/include/boost/python/detail/def_helper.hpp
@@ -155,7 +155,7 @@ namespace detail
, T3 const&
, T4 const&
, default_call_policies
- , keywords<0>
+ , detail::keywords<0>
, char const*
, void(not_specified::*)() // A function pointer type which is never an
// appropriate default implementation
diff --git a/src/object/function.cpp b/src/object/function.cpp
index 360ce13d..dd65e125 100644
--- a/src/object/function.cpp
+++ b/src/object/function.cpp
@@ -543,10 +543,10 @@ void function::add_to_namespace(
if (docstring_options::show_cpp_signatures_)
{
- if(len(_doc))
- _doc += "\n "+str(reinterpret_cast(detail::cpp_signature_tag));
- else
- _doc += " "+str(reinterpret_cast(detail::cpp_signature_tag));
+// if(len(_doc))
+// _doc += "\n"+str(reinterpret_cast(detail::cpp_signature_tag));
+// else
+ _doc += str(reinterpret_cast(detail::cpp_signature_tag));
}
if(_doc)
{
@@ -628,9 +628,9 @@ extern "C"
{
function* f = downcast(op);
list signatures = function_doc_signature_generator::function_doc_signatures(f);
- if(!signatures) return python::detail::none();
+ if(!signatures) return python::detail::none();
signatures.reverse();
- return python::incref( str("\n ").join(signatures).ptr());
+ return python::incref( str("\n").join(signatures).ptr());
}
static int function_set_doc(PyObject* op, PyObject* doc, void*)
diff --git a/src/object/function_doc_signature.cpp b/src/object/function_doc_signature.cpp
index c1ea8acb..49f2c350 100755
--- a/src/object/function_doc_signature.cpp
+++ b/src/object/function_doc_signature.cpp
@@ -264,8 +264,8 @@ namespace boost { namespace python { namespace objects {
}
namespace detail {
- char py_signature_tag[] = "PY signature : ";
- char cpp_signature_tag[] = "C++ signature:";
+ char py_signature_tag[] = "PY signature :";
+ char cpp_signature_tag[] = "C++ signature :";
}
list function_doc_signature_generator::function_doc_signatures( function const * f)
@@ -278,26 +278,53 @@ namespace boost { namespace python { namespace objects {
for (fi=funcs.begin(); fi!=funcs.end(); ++fi)
{
if(*sfi == *fi){
- if((*fi)->doc()){
+ if((*fi)->doc())
+ {
str func_doc = str((*fi)->doc());
- int doc_len = len(func_doc);
- bool show_py_signature = doc_len >=int(sizeof(detail::py_signature_tag)/sizeof(char)-1)
- && str(detail::py_signature_tag)==func_doc.slice(0, int(sizeof(detail::py_signature_tag)/sizeof(char))-1);
- bool show_cpp_signature = doc_len >=int(sizeof(detail::cpp_signature_tag)/sizeof(char))
- && str(detail::cpp_signature_tag)==func_doc.slice(- int(sizeof(detail::cpp_signature_tag)/sizeof(char))+1, _);
- str res;
+ int doc_len = len(func_doc);
+
+ bool show_py_signature = doc_len >= int(sizeof(detail::py_signature_tag)/sizeof(char)-1)
+ && str(detail::py_signature_tag) == func_doc.slice(0, int(sizeof(detail::py_signature_tag)/sizeof(char))-1);
+ if(show_py_signature)
+ {
+ func_doc = str(func_doc.slice(int(sizeof(detail::py_signature_tag)/sizeof(char))-1, _));
+ doc_len = len(func_doc);
+ }
+
+ bool show_cpp_signature = doc_len >= int(sizeof(detail::cpp_signature_tag)/sizeof(char)-1)
+ && str(detail::cpp_signature_tag) == func_doc.slice( 1-int(sizeof(detail::cpp_signature_tag)/sizeof(char)), _);
+
+ if(show_cpp_signature)
+ {
+ func_doc = str(func_doc.slice(_, 1-int(sizeof(detail::cpp_signature_tag)/sizeof(char))));
+ doc_len = len(func_doc);
+ }
+
+ str res="\n";
+ str pad = "\n";
+
if(show_py_signature)
{
str sig = pretty_signature(*fi, n_overloads,false);
res+=sig;
- if(doc_len > int(sizeof(detail::py_signature_tag)/sizeof(char))-1 )
- res+=" : "+func_doc.slice(int(sizeof(detail::py_signature_tag)/sizeof(char))-1,_);
- }else
- res+=func_doc;
+ if(doc_len || show_cpp_signature )res+=" :";
+ pad+= str(" ");
+ }
+
+ if(doc_len)
+ {
+ if(show_py_signature)
+ res+=pad;
+ res+= pad.join(func_doc.split("\n"));
+ }
if( show_cpp_signature)
- res+=str("\n ")+pretty_signature(*fi, n_overloads,true);
+ {
+ if(len(res)>1)
+ res+="\n"+pad;
+ res+=detail::cpp_signature_tag+pad+" "+pretty_signature(*fi, n_overloads,true);
+ }
signatures.append(res);
}
@@ -306,6 +333,7 @@ namespace boost { namespace python { namespace objects {
}else
++n_overloads ;
}
+
return signatures;
}
diff --git a/test/args.py b/test/args.py
index 15be2b97..44a9cd25 100644
--- a/test/args.py
+++ b/test/args.py
@@ -84,24 +84,27 @@
(2, 4.25, 'wow')
>>> q.f1()
(1, 4.25, 'wow')
->>> q.f2.__doc__.splitlines()[-3]
-"f2( (X)self [, (int)x [, (float)y [, (str)z]]]) -> tuple : f2's docstring"
+>>> q.f2.__doc__.splitlines()[1]
+'f2( (X)self [, (int)x [, (float)y [, (str)z]]]) -> tuple :'
->>> X.f.__doc__.splitlines()[:2]
-["f( (X)self, (int)x, (float)y, (str)z) -> tuple : This is X.f's docstring", ' C++ signature:']
+>>> q.f2.__doc__.splitlines()[2]
+" f2's docstring"
+
+>>> X.f.__doc__.splitlines()[1:5]
+['f( (X)self, (int)x, (float)y, (str)z) -> tuple :', " This is X.f's docstring", '', ' C++ signature :']
>>> xfuncs = (X.inner0, X.inner1, X.inner2, X.inner3, X.inner4, X.inner5)
>>> for f in xfuncs:
... print f(q,1).value(),
... print f(q, n = 1).value(),
... print f(q, n = 0).value(),
-... print f.__doc__.splitlines()[:2]
-1 1 0 ['inner0( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
-1 1 0 ['inner1( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
-1 1 0 ['inner2( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
-1 1 0 ['inner3( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
-1 1 0 ['inner4( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
-1 1 0 ['inner5( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
+... print f.__doc__.splitlines()[1:5]
+1 1 0 ['inner0( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
+1 1 0 ['inner1( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
+1 1 0 ['inner2( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
+1 1 0 ['inner3( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
+1 1 0 ['inner4( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
+1 1 0 ['inner5( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
>>> x = X(a1 = 44, a0 = 22)
>>> x.inner0(0).value()
diff --git a/test/auto_ptr.py b/test/auto_ptr.py
index a1e24392..2e4bed61 100644
--- a/test/auto_ptr.py
+++ b/test/auto_ptr.py
@@ -64,23 +64,23 @@
... except TypeError: pass
... else: print 'expected a TypeError exception'
->>> print look.__doc__.splitlines()[0]
-look( (X)arg1) -> int :
+>>> print look.__doc__.splitlines()[1]
+look( (X)arg1) -> int :
->>> print steal.__doc__.splitlines()[0]
-steal( (X)arg1) -> int :
+>>> print steal.__doc__.splitlines()[1]
+steal( (X)arg1) -> int :
->>> print maybe_steal.__doc__.splitlines()[0]
-maybe_steal( (X)arg1, (bool)arg2) -> int :
+>>> print maybe_steal.__doc__.splitlines()[1]
+maybe_steal( (X)arg1, (bool)arg2) -> int :
->>> print make.__doc__.splitlines()[0]
-make() -> X :
+>>> print make.__doc__.splitlines()[1]
+make() -> X :
->>> print callback.__doc__.splitlines()[0]
-callback( (object)arg1) -> X :
+>>> print callback.__doc__.splitlines()[1]
+callback( (object)arg1) -> X :
->>> print extract.__doc__.splitlines()[0]
-extract( (object)arg1) -> X :
+>>> print extract.__doc__.splitlines()[1]
+extract( (object)arg1) -> X :
'''
diff --git a/test/back_reference.py b/test/back_reference.py
index ed595ad0..6705ee7b 100644
--- a/test/back_reference.py
+++ b/test/back_reference.py
@@ -17,8 +17,8 @@
>>> y_equality(y, y)
1
->>> print y_identity.__doc__.splitlines()[0]
-y_identity( (Y)arg1) -> object :
+>>> print y_identity.__doc__.splitlines()[1]
+y_identity( (Y)arg1) -> object :
'''
def run(args = None):
diff --git a/test/defaults.py b/test/defaults.py
index 153f7de1..e68293df 100644
--- a/test/defaults.py
+++ b/test/defaults.py
@@ -113,19 +113,22 @@
... doc = obj.__doc__.splitlines()
... return "\\n".join(["|"+doc[i] for i in args])
->>> print selected_doc(X.__init__, 0, 1, 3, 4)
-|__init__( (object)self [, (int)a [, (str)b [, (str)c [, (float)d]]]]) -> None : doc of init
-| C++ signature:
-| __init__( (object)self, (str)s, (bool)b) -> None :
-| C++ signature:
+>>> print selected_doc(X.__init__, 1, 2, 4, 7, 9)
+|__init__( (object)self [, (int)a [, (str)b [, (str)c [, (float)d]]]]) -> None :
+| doc of init
+| C++ signature :
+|__init__( (object)self, (str)s, (bool)b) -> None :
+| C++ signature :
->>> print selected_doc(Y.__init__, 0, 1)
-|__init__( (object)arg1) -> None : doc of Y init
-| C++ signature:
+>>> print selected_doc(Y.__init__, 1, 2, 4)
+|__init__( (object)arg1) -> None :
+| doc of Y init
+| C++ signature :
->>> print selected_doc(X.bar2, 0, 1)
-|bar2( (X)arg1 [, (int)arg2 [, (str)arg3 [, (str)arg4 [, (float)arg5]]]]) -> Y : doc of X::bar2
-| C++ signature:
+>>> print selected_doc(X.bar2, 1, 2, 4)
+|bar2( (X)arg1 [, (int)arg2 [, (str)arg3 [, (str)arg4 [, (float)arg5]]]]) -> Y :
+| doc of X::bar2
+| C++ signature :
"""
def run(args = None):
diff --git a/test/docstring.py b/test/docstring.py
index 2ad98139..528ce845 100644
--- a/test/docstring.py
+++ b/test/docstring.py
@@ -8,98 +8,113 @@
... doc = obj.__doc__.splitlines()
... return "\\n".join(["|"+doc[i] for i in args])
->>> print selected_doc(X.__init__, 0, 1, 2)
-|__init__( (object)self, (int)value) -> None : this is the __init__ function
-|its documentation has two lines.
-| C++ signature:
+>>> print selected_doc(X.__init__, 1, 2, 3, 4, 5)
+|__init__( (object)self, (int)value) -> None :
+| this is the __init__ function
+| its documentation has two lines.
+|
+| C++ signature :
->>> print selected_doc(X.value, 0, 1, 3, 4)
-|value( (X)self) -> int : gets the value of the object
-| C++ signature:
-| value( (X)self) -> int : also gets the value of the object
-| C++ signature:
+>>> print selected_doc(X.value, 1, 2, 4, 7, 8, 10)
+|value( (X)self) -> int :
+| gets the value of the object
+| C++ signature :
+|value( (X)self) -> int :
+| also gets the value of the object
+| C++ signature :
->>> print selected_doc(create, 0, 1)
-|create( (int)value) -> X : creates a new X object
-| C++ signature:
+>>> print selected_doc(create, 1, 2, 3, 4)
+|create( (int)value) -> X :
+| creates a new X object
+|
+| C++ signature :
->>> print selected_doc(fact, 0, 1)
-|fact( (int)n) -> int : compute the factorial
-| C++ signature:
+>>> print selected_doc(fact, 1, 2, 3, 4)
+|fact( (int)n) -> int :
+| compute the factorial
+|
+| C++ signature :
>>> len(fact_usr_off_1.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_off_1, 0, 1)
-|fact_usr_off_1( (int)n) -> int :
-| C++ signature:
+5
+>>> print selected_doc(fact_usr_off_1, 1, 3)
+|fact_usr_off_1( (int)n) -> int :
+| C++ signature :
>>> len(fact_usr_on_1.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_on_1, 0, 1)
-|fact_usr_on_1( (int)n) -> int : usr on 1
-| C++ signature:
+6
+>>> print selected_doc(fact_usr_on_1, 1, 2, 4)
+|fact_usr_on_1( (int)n) -> int :
+| usr on 1
+| C++ signature :
>>> len(fact_usr_off_2.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_off_2, 0,1)
-|fact_usr_off_2( (int)n) -> int :
-| C++ signature:
+5
+>>> print selected_doc(fact_usr_off_2, 1, 3)
+|fact_usr_off_2( (int)n) -> int :
+| C++ signature :
>>> len(fact_usr_on_2.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_on_2, 0, 1)
-|fact_usr_on_2( (int)n) -> int : usr on 2
-| C++ signature:
+6
+>>> print selected_doc(fact_usr_on_2, 1, 2, 4)
+|fact_usr_on_2( (int)n) -> int :
+| usr on 2
+| C++ signature :
>>> len(fact_sig_off_1.__doc__.splitlines())
-1
->>> print selected_doc(fact_sig_off_1, 0)
+2
+>>> print selected_doc(fact_sig_off_1, 1)
|sig off 1
>>> len(fact_sig_on_1.__doc__.splitlines())
-3
->>> print selected_doc(fact_sig_on_1, 0, 1)
-|fact_sig_on_1( (int)n) -> int : sig on 1
-| C++ signature:
+6
+>>> print selected_doc(fact_sig_on_1, 1, 2, 4)
+|fact_sig_on_1( (int)n) -> int :
+| sig on 1
+| C++ signature :
>>> len(fact_sig_off_2.__doc__.splitlines())
-1
->>> print selected_doc(fact_sig_off_2, 0)
+2
+>>> print selected_doc(fact_sig_off_2, 1)
|sig off 2
>>> len(fact_sig_on_2.__doc__.splitlines())
-3
->>> print selected_doc(fact_sig_on_2, 0, 1)
-|fact_sig_on_2( (int)n) -> int : sig on 2
-| C++ signature:
+6
+>>> print selected_doc(fact_sig_on_2, 1, 2, 4)
+|fact_sig_on_2( (int)n) -> int :
+| sig on 2
+| C++ signature :
>>> print fact_usr_off_sig_off_1.__doc__
None
>>> len(fact_usr_on_sig_on_1.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_on_sig_on_1, 0, 1)
-|fact_usr_on_sig_on_1( (int)n) -> int : usr on sig on 1
-| C++ signature:
+6
+>>> print selected_doc(fact_usr_on_sig_on_1, 1, 2, 4)
+|fact_usr_on_sig_on_1( (int)n) -> int :
+| usr on sig on 1
+| C++ signature :
>>> len(fact_usr_on_sig_off_1.__doc__.splitlines())
-1
->>> print selected_doc(fact_usr_on_sig_off_1, 0)
+2
+>>> print selected_doc(fact_usr_on_sig_off_1, 1)
|usr on sig off 1
>>> len(fact_usr_on_sig_on_2.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_on_sig_on_2, 0, 1)
-|fact_usr_on_sig_on_2( (int)n) -> int : usr on sig on 2
-| C++ signature:
+6
+>>> print selected_doc(fact_usr_on_sig_on_2, 1, 2, 4)
+|fact_usr_on_sig_on_2( (int)n) -> int :
+| usr on sig on 2
+| C++ signature :
->>> print fact_usr_on_psig_on_csig_off_1.__doc__
-fact_usr_on_psig_on_csig_off_1( (int)n) -> int : usr on psig on csig off 1
+>>> print selected_doc(fact_usr_on_psig_on_csig_off_1, 1, 2)
+|fact_usr_on_psig_on_csig_off_1( (int)n) -> int :
+| usr on psig on csig off 1
->>> print selected_doc(fact_usr_on_psig_off_csig_on_1, 0, 1)
+>>> print selected_doc(fact_usr_on_psig_off_csig_on_1, 1, 3)
|usr on psig off csig on 1
-| C++ signature:
+|C++ signature :
->>> print fact_usr_off_psig_on_csig_off_1.__doc__
+>>> print fact_usr_off_psig_on_csig_off_1.__doc__.splitlines()[1]
fact_usr_off_psig_on_csig_off_1( (int)n) -> int
->>> print selected_doc(fact_usr_off_psig_off_csig_on_1,0)
-| C++ signature:
+>>> print selected_doc(fact_usr_off_psig_off_csig_on_1,1)
+|C++ signature :
'''
diff --git a/test/implicit.py b/test/implicit.py
index f99c8d88..ac82d948 100644
--- a/test/implicit.py
+++ b/test/implicit.py
@@ -14,17 +14,17 @@
... except TypeError: pass
... else: print 'no error'
->>> print x_value.__doc__.splitlines()[0]
-x_value( (X)arg1) -> int :
+>>> print x_value.__doc__.splitlines()[1]
+x_value( (X)arg1) -> int :
->>> print make_x.__doc__.splitlines()[0]
-make_x( (object)arg1) -> X :
+>>> print make_x.__doc__.splitlines()[1]
+make_x( (object)arg1) -> X :
->>> print X.value.__doc__.splitlines()[0]
-value( (X)arg1) -> int :
+>>> print X.value.__doc__.splitlines()[1]
+value( (X)arg1) -> int :
->>> print X.set.__doc__.splitlines()[0]
-set( (X)arg1, (object)arg2) -> None :
+>>> print X.set.__doc__.splitlines()[1]
+set( (X)arg1, (object)arg2) -> None :
'''
diff --git a/test/keywords_test.py b/test/keywords_test.py
index 7f5da987..261de0b3 100644
--- a/test/keywords_test.py
+++ b/test/keywords_test.py
@@ -80,8 +80,10 @@
>>> f.set(1,1.0,"1")
>>> f.a(), f.b(), f.n()
(1, 1.0, '1')
->>> f.set2.__doc__.splitlines()[-3]
-"set2( (Bar)arg1 [, (int)arg2 [, (float)arg3 [, (str)arg4]]]) -> None : set2's docstring"
+>>> f.set2.__doc__.splitlines()[1]
+'set2( (Bar)arg1 [, (int)arg2 [, (float)arg3 [, (str)arg4]]]) -> None :'
+>>> f.set2.__doc__.splitlines()[2]
+" set2's docstring"
'''
diff --git a/test/newtest.py b/test/newtest.py
index 23c4298a..1862dcb4 100644
--- a/test/newtest.py
+++ b/test/newtest.py
@@ -183,8 +183,8 @@ are a complicated constructor and member function, respectively.
>>> dd = take_d(d_as_a)
>>> dd.name()
'D'
->>> print g.__doc__.splitlines()[0]
-g( (Simple)arg1) -> Simple :
+>>> print g.__doc__.splitlines()[1]
+g( (Simple)arg1) -> Simple :
"""
diff --git a/test/pytype_function.py b/test/pytype_function.py
index d2f46c9f..7927629b 100755
--- a/test/pytype_function.py
+++ b/test/pytype_function.py
@@ -4,8 +4,8 @@
"""
>>> from pytype_function_ext import *
->>> print (' ').join(func.__doc__.splitlines())
-func( (A)arg1) -> A : C++ signature: struct B func(struct B)
+>>> print func.__doc__.splitlines()[1]
+func( (A)arg1) -> A :
"""
def run(args = None):