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>2011-03-07 14:53:40 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-07 14:53:40 +0300
commitcfd9d6d190dc8fc35920714d252f6c93bd3d96f6 (patch)
tree360fc879522be7068bbfc1c8eeb6ee9443997abb /source/blender/python/generic/bpy_internal_import.c
parentdaff7a447e75a7901b7f3d782839c5a15c16efc1 (diff)
Drop support for python 3.1.
for building py3.2 on *nix see: http://wiki.blender.org/index.php?title=Dev:2.5/Doc/Building_Blender/Linux/Troubleshooting#Python also fixed possible buffer overrun with getting the fake filepath for a blender textblock.
Diffstat (limited to 'source/blender/python/generic/bpy_internal_import.c')
-rw-r--r--source/blender/python/generic/bpy_internal_import.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 533225b1135..e0af6e085eb 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -74,16 +74,9 @@ void bpy_import_main_set(struct Main *maggie)
}
/* returns a dummy filename for a textblock so we can tell what file a text block comes from */
-void bpy_text_filename_get(char *fn, Text *text)
+void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
{
-#if PY_VERSION_HEX >= 0x03020000
- sprintf(fn, "%s%c%s", text->id.lib ? text->id.lib->filepath : G.main->name, SEP, text->id.name+2);
-#else
- /* this is a bug in python's Py_CompileString()!, fixed for python 3.2.
- the string encoding should not be required to be utf-8
- reported: http://bugs.python.org/msg115202 */
- strcpy(fn, text->id.name+2);
-#endif
+ BLI_snprintf(fn, fn_len, "%s%c%s", text->id.lib ? text->id.lib->filepath : G.main->name, SEP, text->id.name+2);
}
PyObject *bpy_text_import(Text *text)
@@ -94,7 +87,7 @@ PyObject *bpy_text_import(Text *text)
if( !text->compiled ) {
char fn_dummy[256];
- bpy_text_filename_get(fn_dummy, text);
+ bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
buf = txt_to_buf( text );
text->compiled = Py_CompileString( buf, fn_dummy, Py_file_input );