Commit 7919aad8 authored by Mark Florisson's avatar Mark Florisson

Fix two failing with gil tests in py24

parent 1f787515
...@@ -140,8 +140,10 @@ def get_openmp_compiler_flags(language): ...@@ -140,8 +140,10 @@ def get_openmp_compiler_flags(language):
if compiler_version and compiler_version.split('.') >= ['4', '2']: if compiler_version and compiler_version.split('.') >= ['4', '2']:
return '-fopenmp', '-fopenmp' return '-fopenmp', '-fopenmp'
try:
locale.setlocale(locale.LC_ALL, '') locale.setlocale(locale.LC_ALL, '')
except locale.Error:
pass
OPENMP_C_COMPILER_FLAGS = get_openmp_compiler_flags('c') OPENMP_C_COMPILER_FLAGS = get_openmp_compiler_flags('c')
OPENMP_CPP_COMPILER_FLAGS = get_openmp_compiler_flags('cpp') OPENMP_CPP_COMPILER_FLAGS = get_openmp_compiler_flags('cpp')
......
...@@ -24,6 +24,15 @@ cdef void puts(char *string) with gil: ...@@ -24,6 +24,15 @@ cdef void puts(char *string) with gil:
""" """
print string.decode('ascii') print string.decode('ascii')
class ExceptionWithMsg(Exception):
"""
In python2.4 Exception is formatted as <exceptions.Exception
instance at 0x1b8f948> when swallowed.
"""
def __repr__(self):
return "ExceptionWithMsg(%r)" % self.args
# Start with some normal Python functions # Start with some normal Python functions
...@@ -251,7 +260,7 @@ cpdef test_cpdef(): ...@@ -251,7 +260,7 @@ cpdef test_cpdef():
cdef void void_nogil_ignore_exception() nogil: cdef void void_nogil_ignore_exception() nogil:
with gil: with gil:
raise Exception("This is swallowed") raise ExceptionWithMsg("This is swallowed")
puts("unreachable") puts("unreachable")
with gil: with gil:
...@@ -263,16 +272,16 @@ cdef void void_nogil_nested_gil() nogil: ...@@ -263,16 +272,16 @@ cdef void void_nogil_nested_gil() nogil:
with gil: with gil:
print 'Inner gil section' print 'Inner gil section'
puts("nogil section") puts("nogil section")
raise Exception("Swallow this") raise ExceptionWithMsg("Swallow this")
puts("Don't print this") puts("Don't print this")
def test_nogil_void_funcs_with_gil(): def test_nogil_void_funcs_with_gil():
""" """
>>> redirect_stderr(test_nogil_void_funcs_with_gil) >>> redirect_stderr(test_nogil_void_funcs_with_gil)
Exception Exception: Exception('This is swallowed',) in 'with_gil.void_nogil_ignore_exception' ignored Exception with_gil.ExceptionWithMsg: ExceptionWithMsg('This is swallowed') in 'with_gil.void_nogil_ignore_exception' ignored
Inner gil section Inner gil section
nogil section nogil section
Exception Exception: Exception('Swallow this',) in 'with_gil.void_nogil_nested_gil' ignored Exception with_gil.ExceptionWithMsg: ExceptionWithMsg('Swallow this') in 'with_gil.void_nogil_nested_gil' ignored
""" """
void_nogil_ignore_exception() void_nogil_ignore_exception()
void_nogil_nested_gil() void_nogil_nested_gil()
...@@ -280,10 +289,10 @@ def test_nogil_void_funcs_with_gil(): ...@@ -280,10 +289,10 @@ def test_nogil_void_funcs_with_gil():
def test_nogil_void_funcs_with_nogil(): def test_nogil_void_funcs_with_nogil():
""" """
>>> redirect_stderr(test_nogil_void_funcs_with_nogil) >>> redirect_stderr(test_nogil_void_funcs_with_nogil)
Exception Exception: Exception('This is swallowed',) in 'with_gil.void_nogil_ignore_exception' ignored Exception with_gil.ExceptionWithMsg: ExceptionWithMsg('This is swallowed') in 'with_gil.void_nogil_ignore_exception' ignored
Inner gil section Inner gil section
nogil section nogil section
Exception Exception: Exception('Swallow this',) in 'with_gil.void_nogil_nested_gil' ignored Exception with_gil.ExceptionWithMsg: ExceptionWithMsg('Swallow this') in 'with_gil.void_nogil_nested_gil' ignored
""" """
with nogil: with nogil:
void_nogil_ignore_exception() void_nogil_ignore_exception()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment