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

Warn about duplicate to-python converters and show the name of the

offending type.


[SVN r20023]
This commit is contained in:
Dave Abrahams
2003-09-11 15:09:11 +00:00
parent 3b74aab818
commit 8b97caae46
2 changed files with 18 additions and 3 deletions

View File

@@ -29,6 +29,12 @@
<hr>
<dl class="page-index">
<dt>11 Sept 2003</dt>
<dd>Changed the response to multiple to-python converters being
registered for the same type from a hard error into warning;
Boost.Python now reports the offending type in the message.
<dt>9 Sept 2003</dt>
<dd>Added new <code><a
@@ -164,7 +170,7 @@ BOOST_PYTHON_MODULE(test)
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
1 August 2003 <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
11 September 2003 <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<p><i>&copy; Copyright <a href="../../../people/dave_abrahams.htm">Dave

View File

@@ -9,6 +9,7 @@
#include <set>
#include <stdexcept>
#include <boost/lexical_cast.hpp>
#if defined(__APPLE__) && defined(__MACH__) && defined(__GNUC__) \
&& __GNUC__ == 3 && __GNUC_MINOR__ == 3 && !defined(__APPLE_CC__)
@@ -161,8 +162,16 @@ namespace registry
assert(slot == 0); // we have a problem otherwise
if (slot != 0)
{
throw std::runtime_error(
"trying to register to_python_converter for a type which already has a registered to_python_converter");
std::string msg(
"to-Python converter for "
+ lexical_cast<std::string>(source_t)
+ " already registered; second conversion method ignored."
);
if ( ::PyErr_Warn( NULL, const_cast<char*>(msg.c_str()) ) )
{
throw_error_already_set();
}
}
slot = f;
}