Boost C++ Libraries: Ticket #2909: [Fix in git] Wrong type signatures? https://svn.boost.org/trac10/ticket/2909 <p> In python/converter/builtin_converters.hpp, I found these lines: </p> <p> BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed BOOST_PYTHON_LONG_LONG, ::PyLong_FromLongLong(x), &amp;PyInt_Type) BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned BOOST_PYTHON_LONG_LONG, ::PyLong_FromUnsignedLongLong(x), &amp;PyInt_Type) </p> <p> and, </p> <p> BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::wstring, ::PyUnicode_FromWideChar(x.data(),implicit_cast&lt;ssize_t&gt;(x.size())), &amp;PyString_Type) </p> <p> Seems it is a typo. Should the PyInt_Type be PyLong_Type, and the PyString_Type be PyUnicode_Type? </p> <p> These macro argument is used for generate the return value of get_pytype(). And seems get_pytype() is only used to generate docstring. So there's accutally no problem caused by these. </p> <p> But, should these be typo? If so, we'd better fix it. </p> <p> Thanks! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2909 Trac 1.4.3 Haoyu Bai Fri, 03 Apr 2009 13:16:59 GMT cc set https://svn.boost.org/trac10/ticket/2909#comment:1 https://svn.boost.org/trac10/ticket/2909#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">divinekid@…</span> added </li> </ul> Ticket Dave Abrahams Mon, 06 Apr 2009 10:03:16 GMT <link>https://svn.boost.org/trac10/ticket/2909#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2909#comment:2</guid> <description> <p> The best way to know if these are bugs that need to be fixed is to produce test cases (a .cpp and a matching .py file—see <a class="ext-link" href="https://svn.boost.org/trac/boost/browser/trunk/libs/python/test"><span class="icon">​</span>this directory</a> for examples) that currently fail and would stop failing if the fixes were made. Can you do that and post an attachment? </p> <p> Thanks! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Haoyu Bai</dc:creator> <pubDate>Wed, 08 Apr 2009 07:50:33 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/2909 https://svn.boost.org/trac10/ticket/2909 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">typetypo.diff</span> </li> </ul> <p> Patch to fix the typo </p> Ticket Haoyu Bai Wed, 08 Apr 2009 07:51:58 GMT attachment set https://svn.boost.org/trac10/ticket/2909 https://svn.boost.org/trac10/ticket/2909 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">typetypo.cpp</span> </li> </ul> <p> Testcase showing the problem. </p> Ticket Haoyu Bai Wed, 08 Apr 2009 07:52:57 GMT attachment set https://svn.boost.org/trac10/ticket/2909 https://svn.boost.org/trac10/ticket/2909 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">typetypo.py</span> </li> </ul> <p> Testcase showing the problem. </p> Ticket Haoyu Bai Wed, 08 Apr 2009 08:08:13 GMT <link>https://svn.boost.org/trac10/ticket/2909#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2909#comment:3</guid> <description> <p> Testcase and patch attached. </p> <p> Without the patch, the test giving the following result: </p> <pre class="wiki">Docstring say: return_longlong() -&gt; int : C++ signature : long long return_longlong() But actually type of return value is: &lt;type 'long'&gt; Docstring say: return_wstring() -&gt; str : C++ signature : std::basic_string&lt;wchar_t, std::char_traits&lt;wchar_t&gt;, std::allocator&lt;wchar_t&gt; &gt; return_wstring() But actually type of return value is: &lt;type 'unicode'&gt; </pre><p> Notice the "return_longlong() -&gt; int" and "return_wstring() -&gt; str". </p> <p> With the patch, the result seems correct: </p> <pre class="wiki">Docstring say: return_longlong() -&gt; long : C++ signature : long long return_longlong() But actually type of return value is: &lt;type 'long'&gt; Docstring say: return_wstring() -&gt; unicode : C++ signature : std::basic_string&lt;wchar_t, std::char_traits&lt;wchar_t&gt;, std::allocator&lt;wchar_t&gt; &gt; return_wstring() But actually type of return value is: &lt;type 'unicode'&gt; </pre><p> Also, this patch don't affect other test cases, as they are all passed. I think it is just related to the docstring and won't touch any other things. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>troy d. straszheim</dc:creator> <pubDate>Mon, 12 Oct 2009 21:37:30 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/2909#comment:4 https://svn.boost.org/trac10/ticket/2909#comment:4 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Dave Abrahams</span> to <span class="trac-author">troy d. straszheim</span> </li> </ul> <p> Looks like the fix made it to the trunk, but not the test, and I notice: </p> <blockquote class="citation"> <blockquote class="citation"> <blockquote class="citation"> <p> print return_string.<span class="underline">doc</span> </p> </blockquote> </blockquote> </blockquote> <p> return_string() -&gt; str : </p> <blockquote> <p> C++ signature : </p> <blockquote> <p> std::string return_string() </p> <blockquote class="citation"> <blockquote class="citation"> <blockquote class="citation"> <p> print return_wstring.<span class="underline">doc</span> </p> </blockquote> </blockquote> </blockquote> </blockquote> </blockquote> <p> return_wstring() -&gt; unicode : </p> <blockquote> <p> C++ signature : </p> <blockquote> <p> std::basic_string&lt;wchar_t, std::char_traits&lt;wchar_t&gt;, std::allocator&lt;wchar_t&gt; &gt; return_wstring() </p> </blockquote> </blockquote> <p> that that basic_string&lt;wchar... should be simplified to std::wstring for readability. Working on it. </p> Ticket troy d. straszheim Mon, 12 Oct 2009 22:44:10 GMT summary changed https://svn.boost.org/trac10/ticket/2909#comment:5 https://svn.boost.org/trac10/ticket/2909#comment:5 <ul> <li><strong>summary</strong> <span class="trac-field-old">Wrong type signatures?</span> → <span class="trac-field-new">[Fix in git] Wrong type signatures?</span> </li> </ul> <p> Fix here: </p> <p> <a class="ext-link" href="http://gitorious.org/~straszheim/boost/straszheim/commit/aeefdf7abca8c33c25a98a5f7fc78e4e888f9c94"><span class="icon">​</span>http://gitorious.org/~straszheim/boost/straszheim/commit/aeefdf7abca8c33c25a98a5f7fc78e4e888f9c94</a> </p> <p> also clean up printing of std::wstring as the gcc demangler was being messy about it. </p> Ticket