Changeset 54644


Ignore:
Timestamp:
Jul 4, 2009, 4:00:06 PM (9 years ago)
Author:
Haoyu Bai
Message:

several fix for the exec test case to make it runs under py3k

Location:
sandbox-branches/bhy/py3k/libs/python/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sandbox-branches/bhy/py3k/libs/python/test/exec.cpp

    r41521 r54644  
    6060{
    6161  // Register the module with the interpreter
    62   if (PyImport_AppendInittab(const_cast<char*>("embedded_hello"), initembedded_hello) == -1)
     62  if (PyImport_AppendInittab(const_cast<char*>("embedded_hello"),
     63#if PY_VERSION_HEX >= 0x03000000
     64              PyInit_embedded_hello
     65#else
     66              initembedded_hello
     67#endif
     68              ) == -1)
    6369    throw std::runtime_error("Failed to add embedded_hello to the interpreter's "
    6470                 "builtin modules");
     
    106112  // Execute a statement that raises a python exception.
    107113  python::dict global;
    108   python::object result = python::exec("print unknown \n", global, global);
     114  python::object result = python::exec("print(unknown) \n", global, global);
    109115}
    110116
     
    116122  Py_Initialize();
    117123
    118   if (python::handle_exception(eval_test) ||
    119       python::handle_exception(exec_test) ||
    120       python::handle_exception(boost::bind(exec_file_test, script)))
     124  if (python::handle_exception(eval_test)
     125      || python::handle_exception(exec_test)
     126      || python::handle_exception(boost::bind(exec_file_test, script))
     127      )
    121128  {
    122129    if (PyErr_Occurred())
     
    150157 
    151158  // Boost.Python doesn't support Py_Finalize yet.
    152   // Py_Finalize();
     159  //Py_Finalize();
    153160  return boost::report_errors();
    154161}
  • sandbox-branches/bhy/py3k/libs/python/test/exec.py

    r35236 r54644  
    33# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
    44
    5 print 'Hello World !'
    6 number = 42
     5if True:
     6    number = 42
Note: See TracChangeset for help on using the changeset viewer.