mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
pytest:segfault: do not assume PLEASE_NO_GDB_BACKTRACE var is unset
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Andrew Bartlett
parent
5ceecd3f73
commit
c17ff0a335
@ -58,11 +58,15 @@ def segfault_detector(f):
|
|||||||
def no_gdb_backtrace(f):
|
def no_gdb_backtrace(f):
|
||||||
from os import environ
|
from os import environ
|
||||||
def w(*args, **kwargs):
|
def w(*args, **kwargs):
|
||||||
environ['PLEASE_NO_GDB_BACKTRACE'] = '1'
|
old = environ.get('PLEASE_NO_GDB_BACKTRACE')
|
||||||
|
environ['PLEASE_NO_GDB_BACKTRACE'] = '1'
|
||||||
try:
|
try:
|
||||||
f(*args, **kwargs)
|
f(*args, **kwargs)
|
||||||
finally:
|
finally:
|
||||||
del environ['PLEASE_NO_GDB_BACKTRACE']
|
if old is not None:
|
||||||
|
environ['PLEASE_NO_GDB_BACKTRACE'] = old
|
||||||
|
else:
|
||||||
|
del environ['PLEASE_NO_GDB_BACKTRACE']
|
||||||
|
|
||||||
return w
|
return w
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user