[Python-checkins] r81176 - in python/branches/py3k-jit: Makefile.pre.in Unittests/pytest_main.cc

jeffrey.yasskin python-checkins at python.org
Fri May 14 22:49:36 CEST 2010


Author: jeffrey.yasskin
Date: Fri May 14 22:49:36 2010
New Revision: 81176

Log:
Fix `make ctest` under 64-bit valgrind.  We were hacking the conversion from
char* to wchar_t*, and we had ssize_t-cleanliness wrong.


Modified:
   python/branches/py3k-jit/Makefile.pre.in
   python/branches/py3k-jit/Unittests/pytest_main.cc

Modified: python/branches/py3k-jit/Makefile.pre.in
==============================================================================
--- python/branches/py3k-jit/Makefile.pre.in	(original)
+++ python/branches/py3k-jit/Makefile.pre.in	Fri May 14 22:49:36 2010
@@ -767,7 +767,8 @@
 # gcc's TR1 <tuple> header depends on RTTI, so force googletest to use
 # its own tuple implementation.
 AllUnitTests: $(UNITTEST_SRCS) $(srcdir)/Unittests/*.h build_all python-config
-	-$(CXX) $(CPPFLAGS) -I$(srcdir)/Unittests/googletest/include -o $@ \
+	-$(CXX) $(CPPFLAGS) -DPY_SSIZE_T_CLEAN \
+		-I$(srcdir)/Unittests/googletest/include -o $@ \
 	 	$(UNITTEST_SRCS) -L. $(LDFLAGS) \
 		-DGTEST_HAS_RTTI=0 -DGTEST_HAS_TR1_TUPLE=0 \
 		`$(RUNSHARED) ./$(BUILDPYTHON) ./python-config --cflags --ldflags`

Modified: python/branches/py3k-jit/Unittests/pytest_main.cc
==============================================================================
--- python/branches/py3k-jit/Unittests/pytest_main.cc	(original)
+++ python/branches/py3k-jit/Unittests/pytest_main.cc	Fri May 14 22:49:36 2010
@@ -30,6 +30,7 @@
 // Modified for Python to pass the name of this program.
 
 #include <iostream>
+#include <string>
 
 #include <gtest/gtest.h>
 
@@ -38,8 +39,11 @@
 int main(int argc, char **argv) {
   std::cout << "Running main() from gtest_main.cc\n";
 
-  Py_SetProgramName((wchar_t *)argv[0]);
+  wchar_t *argv0_copy = _Py_char2wchar(argv[0]);
+  Py_SetProgramName(argv0_copy);
 
   testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
+  int result = RUN_ALL_TESTS();
+  PyMem_Free(argv0_copy);
+  return result;
 }


More information about the Python-checkins mailing list