这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tuplex/python/src/PythonContext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ namespace tuplex {
size_t numBytesSerialized = 0;
for(unsigned i = 0; i < numElements; ++i) {
auto obj = PyList_GET_ITEM(listObj, i);
Py_XINCREF(obj);

// check capacity and realloc if necessary get a new partition
if(partition->capacity() < numBytesSerialized + sizeof(double)) {
Expand Down Expand Up @@ -124,6 +125,7 @@ namespace tuplex {
size_t numBytesSerialized = 0;
for(unsigned i = 0; i < numElements; ++i) {
auto obj = PyList_GET_ITEM(listObj, i);
Py_XINCREF(obj);

// check capacity and realloc if necessary get a new partition
if(partition->capacity() < numBytesSerialized + sizeof(int64_t)) {
Expand Down Expand Up @@ -201,6 +203,7 @@ namespace tuplex {
size_t numBytesSerialized = 0;
for(unsigned i = 0; i < numElements; ++i) {
auto obj = PyList_GET_ITEM(listObj, i);
Py_XINCREF(obj);

// needs to be tuple with correct size
bool check = PyTuple_Check(obj);
Expand All @@ -214,7 +217,7 @@ namespace tuplex {
bool nonConforming = false;
for(int j = 0; j < numTupleElements; ++j) {
if (typeStr[j] == 's') {
auto tupleItem = PyTuple_GetItem(obj, j);
auto tupleItem = PyTuple_GET_ITEM(obj, j);
if (PyUnicode_Check(tupleItem)) {
requiredBytes += PyUnicode_GET_SIZE(tupleItem) + 1; // +1 for '\0'
} else {
Expand Down Expand Up @@ -353,7 +356,7 @@ namespace tuplex {
size_t numBytesSerialized = 0;
for(unsigned i = 0; i < numElements; ++i) {
auto obj = PyList_GET_ITEM(listObj, i);

Py_XINCREF(obj);

// check capacity and realloc if necessary get a new partition
if(partition->capacity() < numBytesSerialized + sizeof(int64_t)) {
Expand Down Expand Up @@ -406,6 +409,7 @@ namespace tuplex {
size_t numBytesSerialized = 0;
for(unsigned i = 0; i < numElements; ++i) {
auto obj = PyList_GET_ITEM(listObj, i);
Py_XINCREF(obj);

// serialization code here is a little bit more complicated
// 3 fields need to be serialized:
Expand Down Expand Up @@ -559,6 +563,7 @@ namespace tuplex {
size_t numBytesSerialized = 0;
for(unsigned i = 0; i < numElements; ++i) {
auto obj = PyList_GET_ITEM(listObj, i);
Py_XINCREF(obj);

// check that it is a dict!
if(PyDict_Check(obj)) {
Expand Down Expand Up @@ -981,6 +986,8 @@ namespace tuplex {
PyObject *item = nullptr;
for(int i = 0; i < PyList_Size(listObj); ++i) {
item = PyList_GET_ITEM(listObj, i);
Py_XINCREF(item);

if(PyDict_Check(item)) {

// check that keys are all strings
Expand All @@ -1004,6 +1011,8 @@ namespace tuplex {
assert(PyList_Check(items));
for(int j = 0; j < PyList_Size(items); ++j) {
auto keyval = PyList_GET_ITEM(items, j);
Py_XINCREF(keyval);

assert(PyTuple_Check(keyval));
assert(PyTuple_Size(keyval) == 2);
// just use directly the type...
Expand Down