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 2010/06/29 13:06:26 UTC

svn commit: r958922 - in /lucene/pylucene/trunk/jcc: CHANGES jcc/python.py jcc/sources/JCCEnv.cpp

Author: vajda
Date: Tue Jun 29 11:06:25 2010
New Revision: 958922

URL: http://svn.apache.org/viewvc?rev=958922&view=rev
Log:
   - fixed bug with JCC_VER not being defined without shared mode
   - fixed bug with python error reporting in extension without shared mode

Modified:
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/jcc/python.py
    lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=958922&r1=958921&r2=958922&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Tue Jun 29 11:06:25 2010
@@ -1,5 +1,5 @@
 
-Version 2.5 ->
+Version 2.5 -> 2.6
 ------------------
  - added freebsd7 settings to setup.py (Sujan Shakya)
  - added support for unix-specific --home distutils install parameter
@@ -22,7 +22,6 @@ Version 2.5 ->
  - added read-only env.classpath property
  - config.py now written only during build or when missing (Christian Heimes)
  - fixed bug with not enforcing Iterable for iterator method detection
- - 
 
 Version 2.4 -> 2.5
 ------------------

Modified: lucene/pylucene/trunk/jcc/jcc/python.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/python.py?rev=958922&r1=958921&r2=958922&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/python.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/python.py Tue Jun 29 11:06:25 2010
@@ -20,7 +20,8 @@ from cpp import cppname, cppnames, typen
 from cpp import line, signature, find_method, split_pkg, sort
 from cpp import Modifier, Class, Method
 from _jcc import findClass
-from config import INCLUDES, CFLAGS, DEBUG_CFLAGS, LFLAGS, IMPLIB_LFLAGS, SHARED
+from config import INCLUDES, CFLAGS, DEBUG_CFLAGS, LFLAGS, IMPLIB_LFLAGS, \
+    SHARED, VERSION as JCC_VER
 
 try:
     from cpp import ParameterizedType, TypeVariable
@@ -1722,15 +1723,17 @@ def compile(env, jccPath, output, module
     includes[0:0] = INCLUDES
     compile_args = CFLAGS
     link_args = LFLAGS
-    defines=['PYTHON']
+
+    defines=[('PYTHON', None),
+             ('JCC_VER', '"%s"' %(JCC_VER))]
+    if shared:
+        defines.append(('_jcc_shared', None))
+    if generics:
+        defines.append(('_java_generics', None))
 
     if compiler:
         script_args.append('--compiler=%s' %(compiler))
 
-    if shared:
-        defines.append('_jcc_shared')
-    script_args.append('--define=%s' %(','.join(defines)))
-
     if debug:
         script_args.append('--debug')
         compile_args += DEBUG_CFLAGS
@@ -1765,12 +1768,9 @@ def compile(env, jccPath, output, module
         'extra_link_args': link_args,
         'include_dirs': includes,
         'sources': sources,
-        'define_macros': []
+        'define_macros': defines
     }
 
-    if generics:
-        args['define_macros'] += [('_java_generics', None)]
-
     if shared:
         shlibdir = os.path.dirname(os.path.dirname(_jcc.__file__))
         if sys.platform == 'darwin':   # distutils no good with -R

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp?rev=958922&r1=958921&r2=958922&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp Tue Jun 29 11:06:25 2010
@@ -425,7 +425,18 @@ void JCCEnv::reportException() const
             jobject cls = (jobject) vm_env->GetObjectClass(throwable);
 
             if (vm_env->IsSameObject(cls, _thr))
+            {
+#ifndef _jcc_lib
+                /* PythonException class is not available without shared mode.
+                 * Python exception information thus gets lost and exception
+                 * is reported via plain Java RuntimeException.
+                 */
+                PyErr_Clear();
+                throw _EXC_JAVA;
+#else
                 throw _EXC_PYTHON;
+#endif
+            }
         }
 #endif