summaryrefslogtreecommitdiffstats
path: root/third_party/python/multidict/multidict/_compat.py
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/multidict/multidict/_compat.py')
-rw-r--r--third_party/python/multidict/multidict/_compat.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/third_party/python/multidict/multidict/_compat.py b/third_party/python/multidict/multidict/_compat.py
new file mode 100644
index 0000000000..e659124558
--- /dev/null
+++ b/third_party/python/multidict/multidict/_compat.py
@@ -0,0 +1,14 @@
+import os
+import platform
+
+NO_EXTENSIONS = bool(os.environ.get("MULTIDICT_NO_EXTENSIONS"))
+
+PYPY = platform.python_implementation() == "PyPy"
+
+USE_CYTHON_EXTENSIONS = USE_CYTHON = not NO_EXTENSIONS and not PYPY
+
+if USE_CYTHON_EXTENSIONS:
+ try:
+ from . import _multidict # noqa
+ except ImportError:
+ USE_CYTHON_EXTENSIONS = USE_CYTHON = False