Merge pull request #8685 from 120EE0980/replace-assert

quickfix :  borg exits when assertions are disabled with Python optimizations
This commit is contained in:
TW 2025-03-10 22:55:28 +01:00 committed by GitHub
commit d892bca8b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,6 +3,15 @@
import sys
import traceback
# quickfix to disallow running borg with assertions switched off
try:
assert False
except AssertionError:
pass # OK
else:
print("Borg requires working assertions. Please run Python without -O and/or unset PYTHONOPTIMIZE.", file=sys.stderr)
sys.exit(2) # == EXIT_ERROR
try:
import argparse
import collections