You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-commits@lucene.apache.org by va...@apache.org on 2013/01/23 22:50:00 UTC

svn commit: r1437761 - in /lucene/pylucene/trunk/jcc: CHANGES jcc/sources/functions.cpp

Author: vajda
Date: Wed Jan 23 21:49:59 2013
New Revision: 1437761

URL: http://svn.apache.org/viewvc?rev=1437761&view=rev
Log:
 - improved parseArgs() to let nested arrays pass through

Modified:
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=1437761&r1=1437760&r2=1437761&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Wed Jan 23 21:49:59 2013
@@ -1,6 +1,11 @@
+Version 2.15 ->
+--------------------
+ - improved parseArgs() to let nested arrays pass through
+ - 
+
 Version 2.14 -> 2.15
 --------------------
- - improved JCC build on Linux by mokey patching setuptools (Caleb Burns)
+ - improved JCC build on Linux by monkey patching setuptools (Caleb Burns)
  - fixed bug with wrapping arrays coming out of generic iterators
  - added support for wrapping non-public methods by listing them as class:method
  - fixed bug with wrapping wrong clone() method in python extensions classes

Modified: lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp?rev=1437761&r1=1437760&r2=1437761&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp Wed Jan 23 21:49:59 2013
@@ -360,12 +360,17 @@ int _parseArgs(PyObject **args, unsigned
 
     for (unsigned int a = 0; a < count; a++, pos++) {
         PyObject *arg = args[a];
+        char tc = types[pos];
 
-        switch (types[pos]) {
+        if (array > 1 && tc != '[')
+          tc = 'o';
+
+        switch (tc) {
           case '[':
           {
-              if (++array > 1)
-                  return -1;
+              if (++array > 1 &&
+                  !PyObject_TypeCheck(arg, PY_TYPE(JArrayObject)))
+                return -1;
 
               a -= 1;
               break;
@@ -754,7 +759,7 @@ int _parseArgs(PyObject **args, unsigned
             return -1;
         }
 
-        if (types[pos] != '[')
+        if (tc != '[')
             array = 0;
     }
 
@@ -768,14 +773,17 @@ int _parseArgs(PyObject **args, unsigned
 
     for (unsigned int a = 0; a < count; a++, pos++) {
         PyObject *arg = args[a];
-        
-        switch (types[pos]) {
+        char tc = types[pos];
+
+        if (array > 1 && tc != '[')
+            tc = 'o';
+
+        switch (tc) {
           case '[':
           {
-              if (++array > 1)
-                  return -1;
-
+              array += 1;
               a -= 1;
+
               break;
           }
 
@@ -1136,7 +1144,7 @@ int _parseArgs(PyObject **args, unsigned
             return -1;
         }
 
-        if (types[pos] != '[')
+        if (tc != '[')
             array = 0;
     }