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

Bug fix -- we weren't handling NULL keywords dictionaries in raw_function

[SVN r19359]
This commit is contained in:
Dave Abrahams
2003-07-30 11:34:50 +00:00
parent 81d99c855f
commit a3cdacd088
3 changed files with 14 additions and 1 deletions

View File

@@ -29,7 +29,10 @@ namespace detail
{
return incref(
object(
f(tuple(borrowed_reference(args)), dict(borrowed_reference(keywords)))
f(
tuple(borrowed_reference(args))
, keywords ? dict(borrowed_reference(keywords)) : dict()
)
).ptr()
);
}

View File

@@ -90,3 +90,5 @@ BOOST_PYTHON_MODULE(args_ext)
def("inner", &X::inner, "docstring", args("self", "n"), return_internal_reference<>());
}
#include "module_tail.cpp"

View File

@@ -4,6 +4,14 @@
>>> raw(3, 4, foo = 'bar', baz = 42)
((3, 4), {'foo': 'bar', 'baz': 42})
Prove that we can handle empty keywords and non-keywords
>>> raw(3, 4)
((3, 4), {})
>>> raw(foo = 'bar')
((), {'foo': 'bar'})
>>> f(x= 1, y = 3, z = 'hello')
(1, 3.0, 'hello')