<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.38
+# Version 1.3.39
 #
 # Do not make changes to this file unless you know what you are doing--modify
 # the SWIG interface file instead.
@@ -13,12 +13,18 @@ if version_info &gt;= (2,6,0):
     def swig_import_helper():
         from os.path import dirname
         import imp
+        fp = None
         try:
             fp, pathname, description = imp.find_module('_tst', [dirname(__file__)])
-            _mod = imp.load_module('_tst', fp, pathname, description)
-        finally:
-            if fp is not None: fp.close()
-        return _mod
+        except ImportError:
+            import _tst
+            return _tst
+        if fp is not None:
+            try:
+                _mod = imp.load_module('_tst', fp, pathname, description)
+            finally:
+                fp.close()
+                return _mod
     _tst = swig_import_helper()
     del swig_import_helper
 else:</diff>
      <filename>python/tst.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.38
+ * Version 1.3.39
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -772,17 +772,35 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
 #  define SWIG_Python_str_FromFormat PyString_FromFormat
 #endif
 
+
+/* Warning: This function will allocate a new string in Python 3,
+ * so please call SWIG_Python_str_DelForPy3(x) to free the space.
+ */
 SWIGINTERN char*
 SWIG_Python_str_AsChar(PyObject *str)
 {
 #if PY_VERSION_HEX &gt;= 0x03000000
+  char *cstr;
+  char *newstr;
+  int len;
   str = PyUnicode_AsUTF8String(str);
-  return PyBytes_AsString(str);
+  PyBytes_AsStringAndSize(str, &amp;cstr, &amp;len);
+  newstr = (char *) malloc(len+1);
+  memcpy(newstr, cstr, len+1);
+  Py_XDECREF(str);
+  return newstr;
 #else
   return PyString_AsString(str);
 #endif
 }
 
+#if PY_VERSION_HEX &gt;= 0x03000000
+#  define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
+#else
+#  define SWIG_Python_str_DelForPy3(x) 
+#endif
+
+
 SWIGINTERN PyObject*
 SWIG_Python_str_FromChar(const char *c)
 {
@@ -937,11 +955,13 @@ SWIG_Python_AddErrorMsg(const char* mesg)
 
   if (PyErr_Occurred()) PyErr_Fetch(&amp;type, &amp;value, &amp;traceback);
   if (value) {
+    char *tmp;
     PyObject *old_str = PyObject_Str(value);
     PyErr_Clear();
     Py_XINCREF(type);
 
-    PyErr_Format(type, &quot;%s %s&quot;, SWIG_Python_str_AsChar(old_str), mesg);
+    PyErr_Format(type, &quot;%s %s&quot;, tmp = SWIG_Python_str_AsChar(old_str), mesg);
+    SWIG_Python_str_DelForPy3(tmp);
     Py_DECREF(old_str);
     Py_DECREF(value);
   } else {
@@ -1476,13 +1496,16 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args)
 SWIGRUNTIME int
 SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 {
+  char *str;
 #ifdef METH_NOARGS
   PyObject *repr = SwigPyObject_repr(v);
 #else
   PyObject *repr = SwigPyObject_repr(v, NULL);
 #endif
   if (repr) {
-    fputs(SWIG_Python_str_AsChar(repr), fp);
+    str = SWIG_Python_str_AsChar(repr); 
+    fputs(str, fp);
+    SWIG_Python_str_DelForPy3(str);
     Py_DECREF(repr);
     return 0; 
   } else {
@@ -1729,7 +1752,11 @@ _PySwigObject_type(void) {
     0,   /*nb_coerce*/
 #endif
     (unaryfunc)SwigPyObject_long, /*nb_int*/
+#if PY_VERSION_HEX &lt; 0x03000000
     (unaryfunc)SwigPyObject_long, /*nb_long*/
+#else
+    0, /*nb_reserved*/
+#endif
     (unaryfunc)0,                 /*nb_float*/
 #if PY_VERSION_HEX &lt; 0x03000000
     (unaryfunc)SwigPyObject_oct,  /*nb_oct*/
@@ -1769,7 +1796,11 @@ _PySwigObject_type(void) {
 	(getattrfunc)0,			    /* tp_getattr */ 
 #endif
 	(setattrfunc)0,			    /* tp_setattr */ 
-	(cmpfunc)SwigPyObject_compare,	    /* tp_compare */ 
+#if PY_VERSION_HEX &gt;= 0x03000000
+    0, /* tp_reserved in 3.0.1 */
+#else
+	(cmpfunc)SwigPyObject_compare,	    /* tp_compare */
+#endif
 	(reprfunc)SwigPyObject_repr,	    /* tp_repr */    
 	&amp;SwigPyObject_as_number,	    /* tp_as_number */
 	0,				    /* tp_as_sequence */
@@ -1940,14 +1971,18 @@ _PySwigPacked_type(void) {
 	(printfunc)SwigPyPacked_print,	    /* tp_print */   	
 	(getattrfunc)0,			    /* tp_getattr */ 	
 	(setattrfunc)0,			    /* tp_setattr */ 	
-	(cmpfunc)SwigPyPacked_compare,	    /* tp_compare */ 	
-	(reprfunc)SwigPyPacked_repr,	    /* tp_repr */    	
-	0,	                            /* tp_as_number */	
+#if PY_VERSION_HEX&gt;=0x03000000
+    0, /* tp_reserved in 3.0.1 */
+#else
+    (cmpfunc)SwigPyPacked_compare,	    /* tp_compare */
+#endif
+	(reprfunc)SwigPyPacked_repr,	    /* tp_repr */
+	0,	                            /* tp_as_number */
 	0,				    /* tp_as_sequence */
-	0,				    /* tp_as_mapping */	
-	(hashfunc)0,			    /* tp_hash */	
-	(ternaryfunc)0,			    /* tp_call */	
-	(reprfunc)SwigPyPacked_str,	    /* tp_str */	
+	0,				    /* tp_as_mapping */
+	(hashfunc)0,			    /* tp_hash */
+	(ternaryfunc)0,			    /* tp_call */
+	(reprfunc)SwigPyPacked_str,	    /* tp_str */
 	PyObject_GenericGetAttr,            /* tp_getattro */
 	0,				    /* tp_setattro */
 	0,		                    /* tp_as_buffer */
@@ -2291,7 +2326,6 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
   } else {
 #if PY_VERSION_HEX &gt;= 0x03000000
     inst = PyBaseObject_Type.tp_new((PyTypeObject*) data-&gt;newargs, Py_None, Py_None);
-    Py_INCREF(data-&gt;newargs);
     PyObject_SetAttr(inst, SWIG_This(), swig_this);
     Py_TYPE(inst)-&gt;tp_flags &amp;= ~Py_TPFLAGS_VALID_VERSION_TAG;
 #else
@@ -2532,21 +2566,23 @@ SWIG_Python_TypeQuery(const char *type)
 
 SWIGRUNTIME int
 SWIG_Python_AddErrMesg(const char* mesg, int infront)
-{
+{  
   if (PyErr_Occurred()) {
     PyObject *type = 0;
     PyObject *value = 0;
     PyObject *traceback = 0;
     PyErr_Fetch(&amp;type, &amp;value, &amp;traceback);
     if (value) {
+      char *tmp;
       PyObject *old_str = PyObject_Str(value);
       Py_XINCREF(type);
       PyErr_Clear();
       if (infront) {
-	PyErr_Format(type, &quot;%s %s&quot;, mesg, SWIG_Python_str_AsChar(old_str));
+	PyErr_Format(type, &quot;%s %s&quot;, mesg, tmp = SWIG_Python_str_AsChar(old_str));
       } else {
-	PyErr_Format(type, &quot;%s %s&quot;, SWIG_Python_str_AsChar(old_str), mesg);
+	PyErr_Format(type, &quot;%s %s&quot;, tmp = SWIG_Python_str_AsChar(old_str), mesg);
       }
+      SWIG_Python_str_DelForPy3(tmp);
       Py_DECREF(old_str);
     }
     return 1;
@@ -2598,6 +2634,7 @@ SWIG_Python_TypeError(const char *type, PyObject *obj)
 	if (cstr) {
 	  PyErr_Format(PyExc_TypeError, &quot;a '%s' is expected, '%s(%s)' is received&quot;,
 		       type, otype, cstr);
+          SWIG_Python_str_DelForPy3(cstr);
 	} else {
 	  PyErr_Format(PyExc_TypeError, &quot;a '%s' is expected, '%s' is received&quot;,
 		       type, otype);
@@ -2619,10 +2656,12 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
   void *result;
   if (SWIG_Python_ConvertPtr(obj, &amp;result, ty, flags) == -1) {
     PyErr_Clear();
-    if (flags &amp; SWIG_POINTER_EXCEPTION) {
+#if SWIG_POINTER_EXCEPTION
+    if (flags) {
       SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
       SWIG_Python_ArgFail(argnum);
     }
+#endif
   }
   return result;
 }
@@ -2709,7 +2748,7 @@ static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0};
 #endif
 #define SWIG_name    &quot;_tst&quot;
 
-#define SWIGVERSION 0x010338 
+#define SWIGVERSION 0x010339 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2837,19 +2876,27 @@ SWIGINTERN int
 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
 {
 #if PY_VERSION_HEX&gt;=0x03000000
-  if (PyUnicode_Check(obj)) 
+  if (PyUnicode_Check(obj))
 #else  
-  if (PyString_Check(obj)) 
+  if (PyString_Check(obj))
 #endif
   {
     char *cstr; Py_ssize_t len;
 #if PY_VERSION_HEX&gt;=0x03000000
+    if (!alloc &amp;&amp; cptr) {
+        /* We can't allow converting without allocation, since the internal
+           representation of string in Python 3 is UCS-2/UCS-4 but we require
+           a UTF-8 representation.
+           TODO(bhy) More detailed explanation */
+        return SWIG_RuntimeError;
+    }
     obj = PyUnicode_AsUTF8String(obj);
     PyBytes_AsStringAndSize(obj, &amp;cstr, &amp;len);
+    if(alloc) *alloc = SWIG_NEWOBJ;
 #else
     PyString_AsStringAndSize(obj, &amp;cstr, &amp;len);
 #endif
-    if (cptr) { 
+    if (cptr) {
       if (alloc) {
 	/* 
 	   In python the user should not be able to modify the inner
@@ -2874,10 +2921,16 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
 	  *alloc = SWIG_OLDOBJ;
 	}
       } else {
+        #if PY_VERSION_HEX&gt;=0x03000000
+        assert(0); /* Should never reach here in Python 3 */
+        #endif
 	*cptr = SWIG_Python_str_AsChar(obj);
       }
     }
     if (psize) *psize = len + 1;
+#if PY_VERSION_HEX&gt;=0x03000000
+    Py_XDECREF(obj);
+#endif
     return SWIG_OK;
   } else {
     swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
@@ -7432,9 +7485,11 @@ extern &quot;C&quot; {
   
   SWIGINTERN int
   swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
+    char *tmp;
     PyObject *str = swig_varlink_str(v);
     fprintf(fp,&quot;Swig global variables &quot;);
-    fprintf(fp,&quot;%s\n&quot;, SWIG_Python_str_AsChar(str));
+    fprintf(fp,&quot;%s\n&quot;, tmp = SWIG_Python_str_AsChar(str));
+    SWIG_Python_str_DelForPy3(tmp);
     Py_DECREF(str);
     return 0;
   }
@@ -7670,10 +7725,7 @@ PyObject*
 void
 #endif
 SWIG_init(void) {
-  PyObject *m, *d;
-  
-  /* Fix SwigMethods to carry the callback ptrs when needed */
-  SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
+  PyObject *m, *d;  
 #if PY_VERSION_HEX &gt;= 0x03000000
   static struct PyModuleDef SWIG_module = {
     PyModuleDef_HEAD_INIT,
@@ -7686,7 +7738,12 @@ SWIG_init(void) {
     NULL,
     NULL
   };
+#endif
   
+  /* Fix SwigMethods to carry the callback ptrs when needed */
+  SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
+  
+#if PY_VERSION_HEX &gt;= 0x03000000
   m = PyModule_Create(&amp;SWIG_module);
 #else
   m = Py_InitModule((char *) SWIG_name, SwigMethods);</diff>
      <filename>python/tst_wrap.cxx</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>cfc9059d408118e20d26869743cc09f97affd30c</id>
    </parent>
  </parents>
  <author>
    <name>Nicolas Lehuen</name>
    <email>nicolas@lehuen.com</email>
  </author>
  <url>http://github.com/nlehuen/pytst/commit/b18614340cad1de02eef89b3d5e53f9e02e6855b</url>
  <id>b18614340cad1de02eef89b3d5e53f9e02e6855b</id>
  <committed-date>2009-04-01T14:53:30-07:00</committed-date>
  <authored-date>2009-04-01T14:53:30-07:00</authored-date>
  <message>Upgrade to SWIG version 1.3.39.</message>
  <tree>6c619a4499557a0e5ef84528391581bc5f44fc1e</tree>
  <committer>
    <name>Nicolas Lehuen</name>
    <email>nicolas@lehuen.com</email>
  </committer>
</commit>
