id summary reporter owner description type status milestone component version severity resolution keywords cc 184 raw_function with no keywords calls Py_INCREF on NULL conanbrink david_abrahams "{{{ In the 1.30.0 release, as well as in the latest CVS, the following code (using the very example presented in the documentation for raw_function.hpp) results in a segfault: C++: #include #include #include #include #include using namespace boost::python; tuple raw(tuple args, dict kw) { return make_tuple(args, kw); } BOOST_PYTHON_MODULE(raw_test) { def(""raw"", raw_function(raw)); } Python: >>> from raw_test import * >>> def pyraw(*args, **kw): ... return (args, kw) ... >>> pyraw(3, 4, foo = 'bar', baz = 42) ((3, 4), {'foo': 'bar', 'baz': 42}) >>> raw(3, 4, foo = 'bar', baz = 42) ((3, 4), {'foo': 'bar', 'baz': 42}) >>> pyraw(3,4) ((3, 4), {}) >>> raw(3, 4) Segmentation fault The problem is that the ""keywords"" parameter passed to boost::python::detail::raw_dispatcher's operator() is NULL. This NULL pointer then gets wrapped in a borrowed_reference and passed to dict's constructor, which proceeds to make an attempt to Py_INCREF it. do_call() from Python/eval.c passes a NULL pointer for the keyword dictionary in Python releases 2.2.2, 2.2.3, and 2.3b2. I can't vouch for earlier releases. Note that the Python version of this function (pyraw, defined above) receives an empty dict for its keywords when no keywords are passed, and I would expect the Boost Python Library to give me the same. }}}" Bugs closed python USE GITHUB None Fixed