--- /tmp/chemoelectric-pycaml-8614105/pycaml.ml	2011-10-01 02:05:57.000000000 +0200
+++ chemoelectric-pycaml-8614105/pycaml.ml	2012-04-10 20:20:02.518683959 +0200
@@ -326,7 +326,11 @@
 (* Type28 *)
 external pyimport_addmodule : string -> pyobject = "PyImport_AddModule_wrapper"
 external pybytes_fromstring : string -> pyobject = "PyBytes_FromString_wrapper"
+IFDEF PYMAJOR2 THEN
 external pystring_fromstring : string -> pyobject = "PyBytes_FromString_wrapper" (* Legacy support *)
+ELSE
+external pystring_fromstring : string -> pyobject = "PyUnicode_FromString_wrapper" (* Legacy support *)
+ENDIF
 external pymodule_new : string -> pyobject = "PyModule_New_wrapper"
 external pyimport_importmodule : string -> pyobject = "PyImport_ImportModule_wrapper"
 
@@ -380,15 +384,11 @@
 
 (* Type42 *)
 external pyslice_new : (pyobject * pyobject * pyobject) -> pyobject = "PySlice_New_wrapper"
-IFDEF PYMAJOR2 THEN
 external pyclass_new : (pyobject * pyobject * pyobject) -> pyobject = "PyClass_New_wrapper"
+IFDEF PYMAJOR2 THEN
 external pyinstance_new : (pyobject * pyobject * pyobject) -> pyobject = "PyInstance_New_wrapper"
 END
-IFDEF PYMAJOR2 THEN
 external pymethod_new : (pyobject * pyobject * pyobject) -> pyobject = "PyMethod_New_wrapper"
-ELSE
-external pymethod_new : (pyobject * pyobject) -> pyobject = "PyMethod_New_wrapper"
-END
 external pyeval_callobjectwithkeywords : (pyobject * pyobject * pyobject) -> pyobject = "PyEval_CallObjectWithKeywords_wrapper"
 external pynumber_power : (pyobject * pyobject * pyobject) -> pyobject = "PyNumber_Power_wrapper"
 external pynumber_inplacepower : (pyobject * pyobject * pyobject) -> pyobject = "PyNumber_InPlacePower_wrapper"
--- /tmp/chemoelectric-pycaml-8614105/pycaml_stubs.c	2011-10-01 02:05:57.000000000 +0200
+++ chemoelectric-pycaml-8614105/pycaml_stubs.c	2012-04-10 20:12:06.871665196 +0200
@@ -1096,6 +1096,7 @@
 Type28(PyImport_AddModule, pywrap)
 
 Type28(PyBytes_FromString, pywrap_steal)
+Type28(PyUnicode_FromString, pywrap_steal)
 Type28(PyModule_New, pywrap_steal)
 Type28(PyImport_ImportModule, pywrap_steal)
 
@@ -1300,7 +1301,7 @@
         CAMLparam1(py_args);                                    \
                                                                 \
         PyObject *new_obj = func(pyunwrap(Field(py_args, 0)),   \
-                                 pyunwrap(Field(py_args, 1)));  \
+                                 pyunwrap(Field(py_args, 2)));  \
         CAMLreturn(wrap_obj(new_obj));                          \
     }
 #endif
@@ -1313,6 +1314,22 @@
 #if PY_MAJOR_VERSION <= 2
 Type42(PyClass_New, pywrap_steal)
 Type42(PyInstance_New, pywrap_steal)
+#else
+/* Calls the builtin-function: type(name,bases,dict), with the
+ * name of the class, tuples of parent names, and dictionary
+ * with initializations of fields.
+ */
+CAMLprim value PyClass_New_wrapper(value py_args)
+{
+  CAMLparam1(py_args);
+  PyObject *bases = pyunwrap(Field(py_args, 0));
+  PyObject *dict = pyunwrap(Field(py_args, 1));
+  PyObject *name = pyunwrap(Field(py_args, 2));
+  PyObject *new_obj = 
+    PyObject_CallFunctionObjArgs
+    ( (PyObject *) &PyType_Type, name, bases, dict, NULL);
+  CAMLreturn(pywrap_steal(new_obj));
+}
 #endif
 
 Type42a(PyMethod_New, pywrap_steal)
