MINGW-packages/mingw-w64-boost/boost-1.63.0-python-test-PyImport_AppendInittab.patch
J. Peter Mugaas 8962c8f1b1 mingw-w64-boost - Update to 1.63.0 (#2058)
* mingw-w64-boost - Update to 1.63.0
mingw-w64-sqlite - update to 3.16.0
mingw-w64-nghttp2 - Update to 1.18.0 and add c-ares dependency
mingw-w64-libuv -  Update to 0.9.7
mingw-w64-libtiff - Update to 4.0.7
mingw-w64-jemalloc - Update to 4.4.0, dependency on doxbook-xsl, rekey patch
mingw-w64-imagemagick - Update to 7.0.4 - Update to latest version, fix pkgconfig file, rekey patches and remove one that is no longer applicable
mingw-w64-harfbuzz - Update to 1.3.4
mingw-w64-freetype - Update to 2.7.1
mingw-w64-cairo - Update to 1.15.4
mingw-w64-c-ares - Update to 1.12.0

* mingw-w64-fossil - rebuild for libreadline 7.0
mingw-w64-sqlite-analyzer - Update to 3.16.1
mingw-w64-sqlite3 - Update to 3,16,1

* mingw-w64-gdk-pixbuf2 - Update to 2.36.3 - latest version and drop 0001-windows-Remove-old-codepage-ABI-compat-code.patch.  It's in the new version of the source-code.
2017-01-12 07:11:59 +03:00

95 lines
2.3 KiB
Diff

diff -aup boost_1_63_0/libs/python/test/exec.cpp.orig boost_1_63_0/libs/python/test/exec.cpp
--- boost_1_63_0/libs/python/test/exec.cpp.orig 2017-01-02 05:05:18.000000000 -0500
+++ boost_1_63_0/libs/python/test/exec.cpp 2017-01-02 08:36:49.421564200 -0500
@@ -56,8 +56,23 @@
BOOST_TEST(value == "ABCDEFG");
}
+struct PyCtx
+{
+ PyCtx() {
+ Py_Initialize();
+ }
+
+ ~PyCtx() {
+ // N.B. certain problems may arise when Py_Finalize is called when
+ // using Boost.Python. However in this test suite it all seems to
+ // work fine.
+ Py_Finalize();
+ }
+};
+
void exec_test()
{
+ PyCtx ctx;
// Retrieve the main module
python::object main = python::import("__main__");
@@ -137,6 +152,19 @@
"there was no exception handler registered.");
}
}
+
+template <class Cb>
+bool
+run_and_handle_exception(Cb cb, bool pyerr_expected = false)
+{
+ PyCtx ctx;
+ if (python::handle_exception(cb)) {
+ check_pyerr(pyerr_expected);
+ return true;
+ } else {
+ return false;
+ }
+}
int main(int argc, char **argv)
{
@@ -156,37 +184,27 @@
"builtin modules");
}
- // Initialize the interpreter
- Py_Initialize();
-
- if (python::handle_exception(eval_test)) {
- check_pyerr();
- }
- else if(python::handle_exception(exec_test)) {
- check_pyerr();
- }
- else if (python::handle_exception(boost::bind(exec_file_test, script))) {
- check_pyerr();
- }
-
- if (python::handle_exception(exec_test_error))
- {
+ // N.B. exec_test mustn't be called through run_and_handle_exception
+ // as it needs to handles the python context by itself.
+ if (run_and_handle_exception(eval_test)
+ || python::handle_exception(exec_test))
check_pyerr(/*pyerr_expected*/ true);
- }
else
+ run_and_handle_exception(boost::bind(exec_file_test, script));
+
+ if (!run_and_handle_exception(exec_test_error, true))
{
BOOST_ERROR("Python exception expected, but not seen.");
}
if (argc > 2) {
+ PyCtx ctx;
// The main purpose is to test compilation. Since this test generates
// a file and I (rwgk) am uncertain about the side-effects, run it only
// if explicitly requested.
exercise_embedding_html();
}
- // Boost.Python doesn't support Py_Finalize yet.
- // Py_Finalize();
return boost::report_errors();
}
Diff finished. Fri Jan 9 21:31:13 2015