This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When a thread is created, notify about it as soon as possible. (#430)
Fixes #106 * When a thread is created, notify about it as soon as possible. * Properly mark internal threads as pydevd daemon threads. Also fix tests to consider that the event related to thread creation is given as the thread starts to run. * Fix test flakiness and improve error message when messages are not equal.
- Loading branch information
1 parent
df207c6
commit 4add62e
Showing
16 changed files
with
347 additions
and
161 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
25 changes: 11 additions & 14 deletions
25
ptvsd/_vendored/pydevd/_pydev_bundle/pydev_is_thread_alive.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 |
---|---|---|
@@ -1,23 +1,20 @@ | ||
from _pydev_imps._pydev_saved_modules import threading | ||
|
||
# Hack for https://sw-brainwy.rhcloud.com/tracker/PyDev/363 (i.e.: calling isAlive() can throw AssertionError under some circumstances) | ||
# Hack for https://www.brainwy.com/tracker/PyDev/363 (i.e.: calling isAlive() can throw AssertionError under some | ||
# circumstances). | ||
# It is required to debug threads started by start_new_thread in Python 3.4 | ||
_temp = threading.Thread() | ||
if hasattr(_temp, '_is_stopped'): # Python 3.4 has this | ||
if hasattr(_temp, '_is_stopped'): # Python 3.x has this | ||
def is_thread_alive(t): | ||
try: | ||
return not t._is_stopped | ||
except: | ||
return t.isAlive() | ||
return not t._is_stopped | ||
|
||
elif hasattr(_temp, '_Thread__stopped'): # Python 2.7 has this | ||
elif hasattr(_temp, '_Thread__stopped'): # Python 2.x has this | ||
def is_thread_alive(t): | ||
try: | ||
return not t._Thread__stopped | ||
except: | ||
return t.isAlive() | ||
return not t._Thread__stopped | ||
|
||
else: | ||
# Make it an error: we want to detect only stops (so, isAlive() can't be used because it may return True before the | ||
# thread is actually running). | ||
raise AssertionError('Check how to detect that a thread has been stopped.') | ||
|
||
else: # Haven't checked all other versions, so, let's use the regular isAlive call in this case. | ||
def is_thread_alive(t): | ||
return t.isAlive() | ||
del _temp |
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
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
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
Oops, something went wrong.