forked from microsoft/debugpy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't crash if running under CPython debug build. Fixes microsoft#152
- Loading branch information
Showing
4 changed files
with
88 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/debugpy/_vendored/pydevd/.travis/install_and_run_debug_py.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Build the cython extensions (to check that we don't crash when they're there in debug mode). | ||
python setup_cython.py build_ext --inplace | ||
|
||
curl -L https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz -o Python-3.8.3.tgz | ||
tar -xzf Python-3.8.3.tgz | ||
cd Python-3.8.3 | ||
mkdir debug | ||
cd debug | ||
../configure --with-pydebug | ||
make | ||
|
||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | ||
./python get-pip.py | ||
|
||
./python -m pip install "pytest" | ||
./python -m pip install "psutil" | ||
./python -m pip install "untangle" | ||
|
||
# Check that it worked. | ||
./python -c "import pytest" | ||
./python -c "import psutil" | ||
./python -c "import untangle" | ||
|
||
cd .. | ||
cd .. | ||
ls -la | ||
|
||
./Python-3.8.3/debug/python -c "import sys;assert hasattr(sys,'gettotalrefcount')" | ||
|
||
cd tests_python | ||
|
||
# Although we compiled cython, all we're checking is that we don't crash (since it was built for the release env). | ||
../Python-3.8.3/debug/python -m pytest test_debugger_json.py -k "test_case_json_change_breaks or test_remote_debugger_basic" | ||
export PYTHONPATH=.. | ||
../Python-3.8.3/debug/python -c "import check_debug_python;check_debug_python.check() " | ||
|
||
# pip install "cython" | ||
# pip install trio | ||
# pip install gevent | ||
# | ||
# # Note: track the latest web framework versions. | ||
# pip install "django" | ||
# pip install "cherrypy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/debugpy/_vendored/pydevd/tests_python/check_debug_python.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import sys | ||
import threading | ||
from _pydev_bundle import pydev_log | ||
|
||
|
||
def check(): | ||
with pydev_log.log_context(3, sys.stderr): | ||
assert hasattr(sys, 'gettotalrefcount') | ||
import pydevd_tracing | ||
|
||
proceed1 = threading.Event() | ||
proceed2 = threading.Event() | ||
|
||
class SomeThread(threading.Thread): | ||
|
||
def run(self): | ||
proceed1.set() | ||
proceed2.wait() | ||
|
||
t = SomeThread() | ||
t.start() | ||
proceed1.wait() | ||
|
||
def some_func(frame, event, arg): | ||
return some_func | ||
|
||
pydevd_tracing.set_trace_to_threads(some_func) | ||
|
||
proceed2.set() | ||
lib = pydevd_tracing.load_python_helper_lib() | ||
assert lib is None | ||
print('Finished OK') | ||
|
||
|
||
if __name__ == '__main__': | ||
check() |