Merged changes in the trunk up to revision 51985.
This commit is contained in:
@@ -520,7 +520,7 @@ static PyObject *Buffer_subscript(Buffer *self, PyObject *item)
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
|
||||
return NULL;
|
||||
|
||||
if (slicelength <= 0) {
|
||||
@@ -556,7 +556,7 @@ static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value)
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
|
||||
return -1;
|
||||
|
||||
if (step == 1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -56,6 +56,7 @@ static ListBase bpy_import_main_list;
|
||||
|
||||
static PyMethodDef bpy_import_meth;
|
||||
static PyMethodDef bpy_reload_meth;
|
||||
static PyObject *imp_reload_orig = NULL;
|
||||
|
||||
/* 'builtins' is most likely PyEval_GetBuiltins() */
|
||||
void bpy_import_init(PyObject *builtins)
|
||||
@@ -69,7 +70,13 @@ void bpy_import_init(PyObject *builtins)
|
||||
* XXX, use import hooks */
|
||||
mod = PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
|
||||
if (mod) {
|
||||
PyDict_SetItemString(PyModule_GetDict(mod), "reload", item = PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
|
||||
PyObject *mod_dict = PyModule_GetDict(mod);
|
||||
|
||||
/* blender owns the function */
|
||||
imp_reload_orig = PyDict_GetItemString(mod_dict, "reload");
|
||||
Py_INCREF(imp_reload_orig);
|
||||
|
||||
PyDict_SetItemString(mod_dict, "reload", item = PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
|
||||
Py_DECREF(mod);
|
||||
}
|
||||
else {
|
||||
@@ -309,7 +316,12 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
|
||||
int found = 0;
|
||||
|
||||
/* try reimporting from file */
|
||||
newmodule = PyImport_ReloadModule(module);
|
||||
|
||||
/* in Py3.3 this just calls imp.reload() which we overwrite, causing recursive calls */
|
||||
//newmodule = PyImport_ReloadModule(module);
|
||||
|
||||
newmodule = PyObject_CallFunctionObjArgs(imp_reload_orig, module, NULL);
|
||||
|
||||
if (newmodule)
|
||||
return newmodule;
|
||||
|
||||
|
||||
@@ -1187,7 +1187,7 @@ static PyObject *BPy_IDArray_subscript(BPy_IDArray *self, PyObject *item)
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
|
||||
return NULL;
|
||||
|
||||
if (slicelength <= 0) {
|
||||
@@ -1222,7 +1222,7 @@ static int BPy_IDArray_ass_subscript(BPy_IDArray *self, PyObject *item, PyObject
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
|
||||
return -1;
|
||||
|
||||
if (step == 1)
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#include "RNA_types.h"
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "bpy.h"
|
||||
#include "bpy_util.h"
|
||||
#include "bpy_rna.h"
|
||||
@@ -49,8 +52,6 @@
|
||||
#include "BKE_global.h" /* XXX, G.main only */
|
||||
#include "BKE_blender.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
/* external util modules */
|
||||
|
||||
@@ -2612,7 +2612,7 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
|
||||
int len = pyrna_prop_array_length(self);
|
||||
Py_ssize_t start, stop, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)key, len, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(key, len, &start, &stop, &step, &slicelength) < 0)
|
||||
return NULL;
|
||||
|
||||
if (slicelength <= 0) {
|
||||
@@ -2780,7 +2780,7 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
|
||||
int len = RNA_property_array_length(&self->ptr, self->prop);
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)key, len, &start, &stop, &step, &slicelength) < 0) {
|
||||
if (PySlice_GetIndicesEx(key, len, &start, &stop, &step, &slicelength) < 0) {
|
||||
ret = -1;
|
||||
}
|
||||
else if (slicelength <= 0) {
|
||||
|
||||
@@ -24,15 +24,20 @@
|
||||
* \ingroup pythonintern
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __BPY_UTIL_H__
|
||||
#define __BPY_UTIL_H__
|
||||
|
||||
#if PY_VERSION_HEX < 0x03020000
|
||||
#error "Python 3.2 or greater is required, you'll need to update your python."
|
||||
# error "Python 3.2 or greater is required, you'll need to update your python."
|
||||
#endif
|
||||
|
||||
#include "RNA_types.h" /* for EnumPropertyItem only */
|
||||
#if PY_VERSION_HEX < 0x03030000
|
||||
# ifdef _MSC_VER
|
||||
# pragma message("Python 3.2 will be deprecated soon, upgrade to Python 3.3.")
|
||||
# else
|
||||
# warning "Python 3.2 will be deprecated soon, upgrade to Python 3.3."
|
||||
# endif
|
||||
#endif
|
||||
|
||||
struct EnumPropertyItem;
|
||||
struct ReportList;
|
||||
@@ -51,4 +56,5 @@ void BPy_SetContext(struct bContext *C);
|
||||
|
||||
extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate);
|
||||
extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate);
|
||||
#endif
|
||||
|
||||
#endif /* __BPY_UTIL_H__ */
|
||||
|
||||
@@ -306,7 +306,7 @@ static PyObject *Color_subscript(ColorObject *self, PyObject *item)
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
return NULL;
|
||||
|
||||
if (slicelength <= 0) {
|
||||
@@ -342,7 +342,7 @@ static int Color_ass_subscript(ColorObject *self, PyObject *item, PyObject *valu
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
return -1;
|
||||
|
||||
if (step == 1)
|
||||
|
||||
@@ -497,7 +497,7 @@ static PyObject *Euler_subscript(EulerObject *self, PyObject *item)
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
return NULL;
|
||||
|
||||
if (slicelength <= 0) {
|
||||
@@ -534,7 +534,7 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
return -1;
|
||||
|
||||
if (step == 1)
|
||||
|
||||
@@ -2087,7 +2087,7 @@ static PyObject *Matrix_subscript(MatrixObject *self, PyObject *item)
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, self->num_row, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, self->num_row, &start, &stop, &step, &slicelength) < 0)
|
||||
return NULL;
|
||||
|
||||
if (slicelength <= 0) {
|
||||
@@ -2123,7 +2123,7 @@ static int Matrix_ass_subscript(MatrixObject *self, PyObject *item, PyObject *va
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, self->num_row, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, self->num_row, &start, &stop, &step, &slicelength) < 0)
|
||||
return -1;
|
||||
|
||||
if (step == 1)
|
||||
@@ -2626,7 +2626,7 @@ static PyObject *MatrixAccess_subscript(MatrixAccessObject *self, PyObject *item
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, MatrixAccess_len(self), &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, MatrixAccess_len(self), &start, &stop, &step, &slicelength) < 0)
|
||||
return NULL;
|
||||
|
||||
if (slicelength <= 0) {
|
||||
|
||||
@@ -670,7 +670,7 @@ static PyObject *Quaternion_subscript(QuaternionObject *self, PyObject *item)
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
return NULL;
|
||||
|
||||
if (slicelength <= 0) {
|
||||
@@ -707,7 +707,7 @@ static int Quaternion_ass_subscript(QuaternionObject *self, PyObject *item, PyOb
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
|
||||
return -1;
|
||||
|
||||
if (step == 1)
|
||||
|
||||
@@ -1976,7 +1976,7 @@ static PyObject *Vector_subscript(VectorObject *self, PyObject *item)
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, self->size, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, self->size, &start, &stop, &step, &slicelength) < 0)
|
||||
return NULL;
|
||||
|
||||
if (slicelength <= 0) {
|
||||
@@ -2012,7 +2012,7 @@ static int Vector_ass_subscript(VectorObject *self, PyObject *item, PyObject *va
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx((void *)item, self->size, &start, &stop, &step, &slicelength) < 0)
|
||||
if (PySlice_GetIndicesEx(item, self->size, &start, &stop, &step, &slicelength) < 0)
|
||||
return -1;
|
||||
|
||||
if (step == 1)
|
||||
|
||||
Reference in New Issue
Block a user