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:
Diffstat (limited to 'source/blender/python/intern/bpy_library.c')
-rw-r--r--source/blender/python/intern/bpy_library.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index 382a513f40a..b91948cc0b8 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -22,6 +22,13 @@
/** \file blender/python/intern/bpy_library.c
* \ingroup pythonintern
+ *
+ * This file exposed blend file library appending/linking to python, typically
+ * this would be done via RNA api but in this case a hand written python api
+ * allows us to use pythons context manager (__enter__ and __exit__).
+ *
+ * Everything here is exposed via bpy.data.libraries.load(...) which returns
+ * a context manager.
*/
/* nifty feature. swap out strings for RNA data */
@@ -71,8 +78,8 @@ static PyObject *bpy_lib_dir(BPy_Library *self);
static PyMethodDef bpy_lib_methods[]= {
{"__enter__", (PyCFunction)bpy_lib_enter, METH_NOARGS},
- {"__exit__", (PyCFunction)bpy_lib_exit, METH_VARARGS},
- {"__dir__", (PyCFunction)bpy_lib_dir, METH_NOARGS},
+ {"__exit__", (PyCFunction)bpy_lib_exit, METH_VARARGS},
+ {"__dir__", (PyCFunction)bpy_lib_dir, METH_NOARGS},
{NULL} /* sentinel */
};
@@ -283,7 +290,7 @@ static void bpy_lib_exit_warn_idname(BPy_Library *self, const char *name_plural,
PyObject *exc, *val, *tb;
PyErr_Fetch(&exc, &val, &tb);
if (PyErr_WarnFormat(PyExc_UserWarning, 1,
- "load: '%s' does not contain %s[\"%s\"]",
+ "load: '%s' does not contain %s[\"%s\"]",
self->abspath, name_plural, idname)) {
/* Spurious errors can appear at shutdown */
if (PyErr_ExceptionMatches(PyExc_Warning)) {
@@ -298,7 +305,7 @@ static void bpy_lib_exit_warn_type(BPy_Library *self, PyObject *item)
PyObject *exc, *val, *tb;
PyErr_Fetch(&exc, &val, &tb);
if (PyErr_WarnFormat(PyExc_UserWarning, 1,
- "load: '%s' expected a string type, not a %.200s",
+ "load: '%s' expected a string type, not a %.200s",
self->abspath, Py_TYPE(item)->tp_name)) {
/* Spurious errors can appear at shutdown */
if (PyErr_ExceptionMatches(PyExc_Warning)) {