$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r54644 - sandbox-branches/bhy/py3k/libs/python/test
From: divinekid_at_[hidden]
Date: 2009-07-04 12:00:07
Author: bhy
Date: 2009-07-04 12:00:06 EDT (Sat, 04 Jul 2009)
New Revision: 54644
URL: http://svn.boost.org/trac/boost/changeset/54644
Log:
several fix for the exec test case to make it runs under py3k
Text files modified: 
   sandbox-branches/bhy/py3k/libs/python/test/exec.cpp |    19 +++++++++++++------                     
   sandbox-branches/bhy/py3k/libs/python/test/exec.py  |     4 ++--                                    
   2 files changed, 15 insertions(+), 8 deletions(-)
Modified: sandbox-branches/bhy/py3k/libs/python/test/exec.cpp
==============================================================================
--- sandbox-branches/bhy/py3k/libs/python/test/exec.cpp	(original)
+++ sandbox-branches/bhy/py3k/libs/python/test/exec.cpp	2009-07-04 12:00:06 EDT (Sat, 04 Jul 2009)
@@ -59,7 +59,13 @@
 void exec_test()
 {
   // Register the module with the interpreter
-  if (PyImport_AppendInittab(const_cast<char*>("embedded_hello"), initembedded_hello) == -1)
+  if (PyImport_AppendInittab(const_cast<char*>("embedded_hello"), 
+#if PY_VERSION_HEX >= 0x03000000
+              PyInit_embedded_hello
+#else
+              initembedded_hello
+#endif
+              ) == -1)
     throw std::runtime_error("Failed to add embedded_hello to the interpreter's "
                  "builtin modules");
   // Retrieve the main module
@@ -105,7 +111,7 @@
 {
   // Execute a statement that raises a python exception.
   python::dict global;
-  python::object result = python::exec("print unknown \n", global, global);
+  python::object result = python::exec("print(unknown) \n", global, global);
 }
 
 int main(int argc, char **argv)
@@ -115,9 +121,10 @@
   // Initialize the interpreter
   Py_Initialize();
 
-  if (python::handle_exception(eval_test) ||
-      python::handle_exception(exec_test) ||
-      python::handle_exception(boost::bind(exec_file_test, script)))
+  if (python::handle_exception(eval_test)
+      || python::handle_exception(exec_test)
+      || python::handle_exception(boost::bind(exec_file_test, script))
+      )
   {
     if (PyErr_Occurred())
     {
@@ -149,7 +156,7 @@
   }
   
   // Boost.Python doesn't support Py_Finalize yet.
-  // Py_Finalize();
+  //Py_Finalize();
   return boost::report_errors();
 }
 
Modified: sandbox-branches/bhy/py3k/libs/python/test/exec.py
==============================================================================
--- sandbox-branches/bhy/py3k/libs/python/test/exec.py	(original)
+++ sandbox-branches/bhy/py3k/libs/python/test/exec.py	2009-07-04 12:00:06 EDT (Sat, 04 Jul 2009)
@@ -2,5 +2,5 @@
 # Software License, Version 1.0. (See accompanying
 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-print 'Hello World !'
-number = 42
+if True:
+    number = 42