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')
-rw-r--r--source/blender/python/intern/bpy_app.c18
-rw-r--r--source/blender/python/intern/bpy_interface.c13
2 files changed, 9 insertions, 22 deletions
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 8354e220b09..4b182bf1aa5 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -82,6 +82,7 @@ static PyTypeObject BlenderAppType;
static PyStructSequence_Field app_info_fields[] = {
{"version", "The Blender version as a tuple of 3 numbers. eg. (2, 83, 1)"},
+ {"version_file", "The blend file version, compatible with ``bpy.data.version``"},
{"version_string", "The Blender version formatted as a string"},
{"version_cycle", "The release status of this build alpha/beta/rc/release"},
{"version_char", "Deprecated, always an empty string"},
@@ -151,6 +152,8 @@ static PyObject *make_app_info(void)
SetObjItem(
PyC_Tuple_Pack_I32(BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH));
+ SetObjItem(PyC_Tuple_Pack_I32(
+ BLENDER_FILE_VERSION / 100, BLENDER_FILE_VERSION % 100, BLENDER_FILE_SUBVERSION));
SetStrItem(BKE_blender_version_string());
SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE));
@@ -292,15 +295,6 @@ static int bpy_app_global_flag_set__only_disable(PyObject *UNUSED(self),
return bpy_app_global_flag_set(NULL, value, closure);
}
-PyDoc_STRVAR(bpy_app_binary_path_python_doc,
- "String, the path to the python executable (read-only). "
- "Deprecated! Use ``sys.executable`` instead.");
-static PyObject *bpy_app_binary_path_python_get(PyObject *UNUSED(self), void *UNUSED(closure))
-{
- PyErr_Warn(PyExc_RuntimeWarning, "Use 'sys.executable' instead of 'binary_path_python'!");
- return Py_INCREF_RET(PySys_GetObject("executable"));
-}
-
PyDoc_STRVAR(bpy_app_debug_value_doc,
"Short, number which can be set to non-zero values for testing purposes");
static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(closure))
@@ -440,12 +434,6 @@ static PyGetSetDef bpy_app_getsets[] = {
bpy_app_global_flag_doc,
(void *)G_FLAG_USERPREF_NO_SAVE_ON_EXIT},
- {"binary_path_python",
- bpy_app_binary_path_python_get,
- NULL,
- bpy_app_binary_path_python_doc,
- NULL},
-
{"debug_value",
bpy_app_debug_value_get,
bpy_app_debug_value_set,
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index d72c2ccfcff..d343b4fff10 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -343,17 +343,16 @@ void BPY_python_start(bContext *C, int argc, const char **argv)
/* Initialize Python (also acquires lock). */
Py_Initialize();
- // PySys_SetArgv(argc, argv); /* broken in py3, not a huge deal */
- /* sigh, why do python guys not have a (char **) version anymore? */
+ /* We could convert to #wchar_t then pass to #PySys_SetArgv (or use #PyConfig in Python 3.8+).
+ * However this risks introducing subtle changes in encoding that are hard to track down.
+ *
+ * So rely on #PyC_UnicodeFromByte since it's a tried & true way of getting paths
+ * that include non `utf-8` compatible characters, see: T20021. */
{
- int i;
PyObject *py_argv = PyList_New(argc);
- for (i = 0; i < argc; i++) {
- /* should fix bug T20021 - utf path name problems, by replacing
- * PyUnicode_FromString, with this one */
+ for (int i = 0; i < argc; i++) {
PyList_SET_ITEM(py_argv, i, PyC_UnicodeFromByte(argv[i]));
}
-
PySys_SetObject("argv", py_argv);
Py_DECREF(py_argv);
}