Update of /cvsroot/boost/boost/libs/python/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27002/libs/python/test
Modified Files:
Jamfile.v2
Added Files:
import_.cpp import_.py
Log Message:
Fix boost::python::import.
--- NEW FILE: import_.cpp ---
// Copyright Stefan Seefeld 2007.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <iostream>
namespace bpl = boost::python;
void import_test()
{
// Retrieve the main module
bpl::object import_ = bpl::import("import_");
int value = bpl::extract<int>(import_.attr("value")) BOOST_EXTRACT_WORKAROUND;
std::cout << value << std::endl;
BOOST_TEST(value == 42);
}
int main(int argc, char **argv)
{
// Initialize the interpreter
Py_Initialize();
if (bpl::handle_exception(import_test))
{
if (PyErr_Occurred())
{
BOOST_ERROR("Python Error detected");
PyErr_Print();
}
else
{
BOOST_ERROR("A C++ exception was thrown for which "
"there was no exception handler registered.");
}
}
// Boost.Python doesn't support Py_Finalize yet.
// Py_Finalize();
return boost::report_errors();
}
// Including this file makes sure
// that on Windows, any crashes (e.g. null pointer dereferences) invoke
// the debugger immediately, rather than being translated into structured
// exceptions that can interfere with debugging.
#include "module_tail.cpp"
--- NEW FILE: import_.py ---
value = 42
Index: Jamfile.v2
===================================================================
RCS file: /cvsroot/boost/boost/libs/python/test/Jamfile.v2,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- Jamfile.v2 13 Oct 2006 21:33:37 -0000 1.22
+++ Jamfile.v2 1 Mar 2007 15:17:29 -0000 1.23
@@ -151,6 +151,7 @@
/boost/python//boost_python ]
[ bpl-test
map_indexing_suite : map_indexing_suite.py map_indexing_suite_ext ]
+[ py-run import_.cpp ]
# if $(TEST_BIENSTMAN_NON_BUGS)
# {
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs