Skip to content

Commit

Permalink
Fix the doctest runner not maintaining the namespace across different…
Browse files Browse the repository at this point in the history
… blocks
  • Loading branch information
asmeurer committed Jan 4, 2024
1 parent 7ce945e commit 4d114ff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion papyri/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,10 +1327,12 @@ def debugprint(*args):
block, doctest_runner.globs, obj.__name__, filename, lineno
)
if config.exec and doctests.examples:
doctest_runner.run(doctests, out=debugprint)
doctest_runner.run(doctests, out=debugprint, clear_globs=False)
doctest_runner.globs.update(doctests.globs)
example_section_data.extend(doctest_runner.example_section_data)
else:
example_section_data.append(MText(block))

# TODO fix this if plt.close not called and still a lingering figure.
fig_managers = _pylab_helpers.Gcf.get_all_fig_managers()
if len(fig_managers) != 0:
Expand Down

0 comments on commit 4d114ff

Please sign in to comment.