aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-07-02 16:33:49 -0400
committerGitHub <noreply@github.com>2017-07-02 16:33:49 -0400
commit917e12e4e722e0c946dc4750d4d100e3b9a41bf1 (patch)
tree90f8486bc7ff8c0f2916e4b2f11e164b9f072de2 /mesonbuild/mesonlib.py
parent304841d1c7fb2e6dfbe8134e16acbeaeb338914b (diff)
parentf5b95dfa06389a1fae21d998ef65af5c4d6958b6 (diff)
downloadmeson-917e12e4e722e0c946dc4750d4d100e3b9a41bf1.zip
meson-917e12e4e722e0c946dc4750d4d100e3b9a41bf1.tar.gz
meson-917e12e4e722e0c946dc4750d4d100e3b9a41bf1.tar.bz2
Merge pull request #2017 from mesonbuild/fix2012
Do not pickle interpreter objects by accident
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index 415bc50..4760e04 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -21,6 +21,11 @@ import collections
from glob import glob
+# Put this in objects that should not get dumped to pickle files
+# by accident.
+import threading
+an_unpicklable_object = threading.Lock()
+
class MesonException(Exception):
'''Exceptions thrown by Meson'''
@@ -704,6 +709,14 @@ def windows_proof_rmtree(f):
# Try one last time and throw if it fails.
shutil.rmtree(f)
+def unholder_array(entries):
+ result = []
+ for e in entries:
+ if hasattr(e, 'held_object'):
+ e = e.held_object
+ result.append(e)
+ return result
+
class OrderedSet(collections.MutableSet):
"""A set that preserves the order in which items are added, by first
insertion.