diff Modules/_cursesmodule.c @ 53816:911df82bc25d

add a replacement API for PyCObject, PyCapsule #5630 All stdlib modules with C-APIs now use this. Patch by Larry Hastings
author Benjamin Peterson <benjamin@python.org>
date Tue, 05 May 2009 22:31:58 +0000
parents 2df1517d868c
children ff6eea017a7f
line wrap: on
line diff
--- a/Modules/_cursesmodule.c	Tue May 05 22:14:50 2009 +0000
+++ b/Modules/_cursesmodule.c	Tue May 05 22:31:58 2009 +0000
@@ -104,6 +104,7 @@
 
 #include "Python.h"
 
+
 #ifdef __osf__
 #define STRICT_SYSV_CURSES      /* Don't use ncurses extensions */
 #endif
@@ -174,7 +175,7 @@
 /*
  * Check the return code from a curses function and return None 
  * or raise an exception as appropriate.  These are exported using the
- * CObject API. 
+ * capsule API. 
  */
 
 static PyObject *
@@ -2827,8 +2828,8 @@
 		return NULL;
 	ModDict = d; /* For PyCurses_InitScr to use later */
 
-	/* Add a CObject for the C API */
-	c_api_object = PyCObject_FromVoidPtr((void *)PyCurses_API, NULL);
+	/* Add a capsule for the C API */
+	c_api_object = PyCapsule_New(PyCurses_API, PyCurses_CAPSULE_NAME, NULL);
 	PyDict_SetItemString(d, "_C_API", c_api_object);
 	Py_DECREF(c_api_object);