Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-11-20 10:53:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-20 10:59:59 +0300
commit07db110add161c50b48cb7bc8e1c77f2b12b2c76 (patch)
treeaac63ac383234f4cfe4b1f4b96c113afd5d54ce9
parent056c9de30dad332d57eee7878f818f622d9802a1 (diff)
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.
-rw-r--r--doc/python_api/sphinx_doc_gen.py21
1 files changed, 17 insertions, 4 deletions
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()