[Chapel Merge] Fix problem: dictionary changed size during iterat

Branch: refs/heads/master
Revision: 09672fb
Author: mppf
Log Message:

Merge pull request #45 from mppf/fix-sphinx-incremental-build-issue

Fix problem: dictionary changed size during iteration

The issue comes up when using sphinx to do an incremental
docs build (see https://github.com/chapel-lang/chapel/pull/16835 )

I encountered an error along these lines:

Exception occurred:
  File "CHPL_HOME/third-party/chpl-venv/install/chpldeps/sphinxcontrib/chapeldomain/__init__.py", line 810, in clear_doc
    for fullname, (fn, x) in self.data['objects'].items():
RuntimeError: dictionary changed size during iteration
The full traceback has been saved in /var/folders/b6/1lwlz22n5d53878_x52vp3kr0007pg/T/sphinx-err-xabz0j9_.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

To fix, this PR adjusts clear_doc to save the keys to remove in a list and then remove them.

Reviewed by @lydia-duncan - thanks!

Modified Files:
M sphinxcontrib/chapeldomain/init.py

Compare: https://github.com/chapel-lang/sphinxcontrib-chapeldomain/compare/7386d43cd4a3...09672fb5996e