[Jython-checkins] jython: Move ctypes invoker invalidation sequence into a method.

wayne.meissner jython-checkins at python.org
Sun Sep 4 03:55:25 CEST 2011


http://hg.python.org/jython/rev/2e7c700ddaf7
changeset:   6235:2e7c700ddaf7
user:        Wayne Meissner <wmeissner at gmail.com>
date:        Fri Jun 17 10:55:12 2011 +1000
summary:
  Move ctypes invoker invalidation sequence into a method.

files:
  src/org/python/modules/jffi/Function.java |  11 ++++++++---
  1 files changed, 8 insertions(+), 3 deletions(-)


diff --git a/src/org/python/modules/jffi/Function.java b/src/org/python/modules/jffi/Function.java
--- a/src/org/python/modules/jffi/Function.java
+++ b/src/org/python/modules/jffi/Function.java
@@ -110,7 +110,7 @@
 
     @ExposedSet(name = "restype")
     public void setResultType(PyObject restype) {
-        this.invoker = null; // invalidate old invoker
+        invalidateInvoker();
         this.restype = restype;
     }
 
@@ -121,7 +121,7 @@
 
     @ExposedSet(name = "argtypes")
     public void setArgTypes(PyObject parameterTypes) {
-        this.invoker = null; // invalidate old invoker
+        invalidateInvoker();
 
         // Removing the parameter types defaults back to varargs
         if (parameterTypes == Py.None) {
@@ -142,7 +142,7 @@
 
     @ExposedSet(name = "errcheck")
     public void errcheck(PyObject errcheck) {
-        this.invoker = null; // invalidate old invoker
+        invalidateInvoker();
         this.errcheck = errcheck;
     }
     @Override
@@ -157,6 +157,11 @@
         return createInvoker();
     }
 
+    private synchronized void invalidateInvoker() {
+        // null out the invoker - it will be regenerated on next invocation
+        this.invoker = null;
+    }
+
     private synchronized final Invoker createInvoker() {
         if (argtypes == null) {
             throw Py.NotImplementedError("variadic functions not supported yet;  specify a parameter list");

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list