You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by bh...@apache.org on 2012/07/12 19:24:07 UTC

svn commit: r1360823 - /uima/uimacpp/trunk/scriptators/uima.i

Author: bhavani
Date: Thu Jul 12 17:24:07 2012
New Revision: 1360823

URL: http://svn.apache.org/viewvc?rev=1360823&view=rev
Log:
UIMA-2433 Updated for newer version of python

Modified:
    uima/uimacpp/trunk/scriptators/uima.i

Modified: uima/uimacpp/trunk/scriptators/uima.i
URL: http://svn.apache.org/viewvc/uima/uimacpp/trunk/scriptators/uima.i?rev=1360823&r1=1360822&r2=1360823&view=diff
==============================================================================
--- uima/uimacpp/trunk/scriptators/uima.i (original)
+++ uima/uimacpp/trunk/scriptators/uima.i Thu Jul 12 17:24:07 2012
@@ -68,8 +68,18 @@ static bool PyUnicodeConvert(PyObject *o
 static bool PyStringConvert(PyObject *obj, UnicodeString &rv) {
   char *src;
   int len;
-  //Py_ssize_t len;
-  PyString_AsStringAndSize(obj, &src, &len);
+  #ifdef PY_VERSION_HEX
+  #if (PY_VERSION_HEX >= 0x02050000)
+    /* Python version was greater than 2.5 */
+     PyString_AsStringAndSize(obj, &src,  ( Py_ssize_t*)&len);
+  #else
+    /* Python version was less than 2.5 */
+     PyString_AsStringAndSize(obj, &src, &len);
+  #endif
+  #else
+    /* Could not determine version */ 
+    PyString_AsStringAndSize(obj, &src, &len);
+  #endif
   rv = UnicodeString((const char *) src, (int32_t) len);
   return true;
 }