Skip to content

Commit 0c78e29

Browse files
wbolsterbehackett
authored andcommitted
Use _use_c variable in bson.has_c() function
Don't needlessly retry to import _cbson each time the (public) bson.has_c() function is called. The internal _use_c variable that is set when the module is loaded already contains the needed information.
1 parent bfbe701 commit 0c78e29

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

bson/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,4 @@ def has_c():
553553
554554
.. versionadded:: 1.9
555555
"""
556-
try:
557-
from bson import _cbson
558-
return True
559-
except ImportError:
560-
return False
556+
return _use_c

0 commit comments

Comments
 (0)