Fix compiling error when missing gdbm version macros (GH-7823)

This commit is contained in:
Xiang Zhang 2018-06-20 21:23:30 +08:00 committed by GitHub
parent 16eb3bcdb2
commit b248e957a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -12,9 +12,8 @@ class TestGdbm(unittest.TestCase):
def setUpClass():
if support.verbose:
try:
import _gdbm
version = _gdbm._GDBM_VERSION
except (ImportError, AttributeError):
from _gdbm import _GDBM_VERSION as version
except ImportError:
pass
else:
print(f"gdbm version: {version}")