-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Flesh out the core dump tutorial
The example I originally suggested for the core dump tutorial is a bit too trivial to make an interesting example. Instead, Pablo helped me come up with an example of a known way to crash the interpreter where the root cause is not so obvious, which makes a far more engaging example for readers to dig into and try to make sense of. Signed-off-by: Matt Wozniski <[email protected]>
- Loading branch information
Showing
5 changed files
with
308 additions
and
180 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import gc | ||
|
||
|
||
def types_found_in_tuples(): | ||
elem_types = set() | ||
|
||
for obj in gc.get_objects(): | ||
if isinstance(obj, tuple): | ||
elem_types.update(map(type, obj)) | ||
|
||
for elem_type in elem_types: | ||
yield elem_type | ||
|
||
|
||
print("Printing with multiple calls to print():") | ||
for t in types_found_in_tuples(): | ||
print(t) | ||
|
||
print("Printing with one call to print():") | ||
print(*types_found_in_tuples(), sep="\n") |
Oops, something went wrong.