diff options
author | Mathew Robinson <chasinglogic@gmail.com> | 2019-04-12 11:13:32 -0400 |
---|---|---|
committer | Mathew Robinson <chasinglogic@gmail.com> | 2019-04-19 16:05:34 -0400 |
commit | b8d3c0f4845092c4a52844f05153f38035fd96aa (patch) | |
tree | 1474f786f082a5cd991ec8c510e6d31b4c553309 /buildscripts | |
parent | 31a06923330de5a8f20a91075fbc7e6a8c20bdb9 (diff) | |
download | mongo-b8d3c0f4845092c4a52844f05153f38035fd96aa.tar.gz |
SERVER-39923 Mongo gdb extensions should error when loaded into gdb compiled against python2
Diffstat (limited to 'buildscripts')
-rw-r--r-- | buildscripts/gdb/mongo.py | 2 | ||||
-rw-r--r-- | buildscripts/gdb/mongo_lock.py | 3 | ||||
-rw-r--r-- | buildscripts/gdb/mongo_printers.py | 3 |
3 files changed, 8 insertions, 0 deletions
diff --git a/buildscripts/gdb/mongo.py b/buildscripts/gdb/mongo.py index 9a82fa6abb0..9a7db2e8a9f 100644 --- a/buildscripts/gdb/mongo.py +++ b/buildscripts/gdb/mongo.py @@ -21,6 +21,8 @@ except Exception as e: print("Failed to load the libstdc++ pretty printers: " + str(e)) # pylint: enable=invalid-name,wildcard-import +if sys.version_info[0] < 3: + raise gdb.GdbError("MongoDB gdb extensions only support Python 3. Your GDB was compiled against Python 2") def get_process_name(): """Return the main binary we are attached to.""" diff --git a/buildscripts/gdb/mongo_lock.py b/buildscripts/gdb/mongo_lock.py index 382d5718e44..9591357f1c7 100644 --- a/buildscripts/gdb/mongo_lock.py +++ b/buildscripts/gdb/mongo_lock.py @@ -6,6 +6,9 @@ import sys import gdb import gdb.printing +if sys.version_info[0] < 3: + raise gdb.GdbError("MongoDB gdb extensions only support Python 3. Your GDB was compiled against Python 2") + class NonExecutingThread(object): """NonExecutingThread class. diff --git a/buildscripts/gdb/mongo_printers.py b/buildscripts/gdb/mongo_printers.py index bc9506eff85..6b73cd84751 100644 --- a/buildscripts/gdb/mongo_printers.py +++ b/buildscripts/gdb/mongo_printers.py @@ -17,6 +17,9 @@ except ImportError as err: print("Check with the pip command if pymongo 3.x is installed.") bson = None +if sys.version_info[0] < 3: + raise gdb.GdbError("MongoDB gdb extensions only support Python 3. Your GDB was compiled against Python 2") + def get_unique_ptr(obj): """Read the value of a libstdc++ std::unique_ptr.""" |