[Bf-blender-cvs] [07db110add1] master: Fix T82493: PyDoc generation throws exception on exit
Campbell Barton
noreply at git.blender.org
Fri Nov 20 09:01:04 CET 2020
Commit: 07db110add161c50b48cb7bc8e1c77f2b12b2c76
Author: Campbell Barton
Date: Fri Nov 20 18:53:27 2020 +1100
Branches: master
https://developer.blender.org/rB07db110add161c50b48cb7bc8e1c77f2b12b2c76
Fix T82493: PyDoc generation throws exception on exit
Since add-ons now unregister on exit
(as of fa566157a5c351775d082b05b180c630665b4afc)
clearing functions in `bpy.app.handlers` caused an error on exit.
Resolve by restoring handlers before exiting.
===================================================================
M doc/python_api/sphinx_doc_gen.py
===================================================================
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 3b5d16f2233..b148f4c6a46 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -2188,9 +2188,20 @@ def setup_blender():
# Remove handlers since the functions get included
# in the doc-string and don't have meaningful names.
- for ls in bpy.app.handlers:
- if isinstance(ls, list):
- ls.clear()
+ lists_to_restore = []
+ for var in bpy.app.handlers:
+ if isinstance(var, list):
+ lists_to_restore.append((var[:], var))
+ var.clear()
+
+ return {
+ "lists_to_restore": lists_to_restore,
+ }
+
+
+def teardown_blender(setup_data):
+ for var_src, var_dst in setup_data["lists_to_restore"]:
+ var_dst[:] = var_src
def main():
@@ -2199,7 +2210,7 @@ def main():
setup_monkey_patch()
# Perform changes to Blender it's self.
- setup_blender()
+ setup_data = setup_blender()
# eventually, create the dirs
for dir_path in [ARGS.output_dir, SPHINX_IN]:
@@ -2305,6 +2316,8 @@ def main():
shutil.copy(os.path.join(SPHINX_OUT_PDF, "contents.pdf"),
os.path.join(REFERENCE_PATH, BLENDER_PDF_FILENAME))
+ teardown_blender(setup_data)
+
sys.exit()
More information about the Bf-blender-cvs
mailing list