Skip to content

Commit d91e645

Browse files
Disable automatic garbage collection in notebooks, as it can interfere with tracing
1 parent e3a507f commit d91e645

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

notebooks/ReleaseNotes.ipynb

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
"## Current Version (in progress)\n",
2424
"\n",
2525
"This is the version we are preparing for the next release (e.g. what you get when you check out the latest version from [the GitHub repo](__GITHUB_HTML__)).\n",
26-
"Major changes will show up here as we make them."
26+
"Major changes will show up here as we make them.\n",
27+
"\n",
28+
"* In notebooks under Python 3.12, automatic garbage collection would cause a method `_clean_thread_parent_frames()` to be executed with certain functions, interfering with tracing and dynamic analysis. This is now disabled."
2729
]
2830
},
2931
{

notebooks/shared/bookutils/setup.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
#!/usr/bin/env python
2+
# Special setup code for fuzzingbook and debuggingbook notebooks
23

3-
# We set a fixed seed for all notebooks and examples,
4-
# such that creation is more predictable.
5-
4+
# We set a fixed seed for all notebooks and examples, such that creation
5+
# is more predictable.
66
# Interacting with a notebook (in particular executing cells again and again)
77
# will still yield new results every time.
88

99
FIXED_SEED = 2001
1010

1111
import random
12-
random.seed(FIXED_SEED)
12+
random.seed(FIXED_SEED)
13+
14+
15+
# We disable automatic garbage collection for notebooks.
16+
# As of Python 3.12, automatic gc in iPython may invoke a method
17+
# _clean_thread_parent_frames(), interfering with tracing.
18+
19+
import gc
20+
gc.disable()

0 commit comments

Comments
 (0)