File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -205,9 +205,9 @@ cxoVarType *cxoVarType_fromPythonType(PyTypeObject *type)
205
205
static Py_ssize_t cxoVarType_calculateSize (PyObject * value ,
206
206
cxoTransformNum transformNum )
207
207
{
208
+ Py_ssize_t size = 0 ;
208
209
#if PY_MAJOR_VERSION < 3
209
210
const void * ptr ;
210
- Py_ssize_t size = 0 ;
211
211
#endif
212
212
213
213
switch (transformNum ) {
@@ -221,13 +221,15 @@ static Py_ssize_t cxoVarType_calculateSize(PyObject *value,
221
221
return size ;
222
222
#endif
223
223
case CXO_TRANSFORM_NSTRING :
224
- return PyUnicode_GET_SIZE (value );
224
+ size = PyUnicode_GET_SIZE (value );
225
+ return (size == 0 ) ? 1 : size ;
225
226
case CXO_TRANSFORM_STRING :
226
227
#if PY_MAJOR_VERSION >= 3
227
- return PyUnicode_GET_SIZE (value );
228
+ size = PyUnicode_GET_SIZE (value );
228
229
#else
229
- return PyString_GET_SIZE (value );
230
+ size = PyString_GET_SIZE (value );
230
231
#endif
232
+ return (size == 0 ) ? 1 : size ;
231
233
default :
232
234
break ;
233
235
}
You can’t perform that action at this time.
0 commit comments