diff -r f1f707dd7cae PC/winreg.c --- a/PC/winreg.c Wed Jan 08 16:01:42 2014 +0100 +++ b/PC/winreg.c Wed Jan 08 15:15:13 2014 -0600 @@ -12,6 +12,11 @@ */ +/*[clinic input] +module winreg +[clinic start generated code]*/ +/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ + #include "Python.h" #include "structmember.h" #include "windows.h" @@ -71,15 +76,6 @@ "to see what constants are used, and where."); -PyDoc_STRVAR(CloseKey_doc, -"CloseKey(hkey)\n" -"Closes a previously opened registry key.\n" -"\n" -"The hkey argument specifies a previously opened key.\n" -"\n" -"Note that if the key is not closed using this method, it will be\n" -"closed when the hkey object is destroyed by Python."); - PyDoc_STRVAR(ConnectRegistry_doc, "ConnectRegistry(computer_name, key) -> key\n" "Establishes a connection to a predefined registry handle on another computer.\n" @@ -980,13 +976,37 @@ /* The Python methods */ +/*[clinic input] +winreg.CloseKey + + hkey: object + A previously opened key. + / + +Closes a previously opened registry key. + +Note that if the key is not closed using this method, it will be +closed when the hkey object is destroyed by Python. +[clinic start generated code]*/ + +PyDoc_STRVAR(winreg_CloseKey__doc__, +"CloseKey(hkey)\n" +"Closes a previously opened registry key.\n" +"\n" +" hkey\n" +" A previously opened key.\n" +"\n" +"Note that if the key is not closed using this method, it will be\n" +"closed when the hkey object is destroyed by Python."); + +#define WINREG_CLOSEKEY_METHODDEF \ + {"CloseKey", (PyCFunction)winreg_CloseKey, METH_O, winreg_CloseKey__doc__}, + static PyObject * -PyCloseKey(PyObject *self, PyObject *args) +winreg_CloseKey(PyModuleDef *module, PyObject *hkey) +/*[clinic end generated code: checksum=cfaef388f0014846b9e46b8da1a026f72980ec37]*/ { - PyObject *obKey; - if (!PyArg_ParseTuple(args, "O:CloseKey", &obKey)) - return NULL; - if (!PyHKEY_Close(obKey)) + if (!PyHKEY_Close(hkey)) return NULL; Py_INCREF(Py_None); return Py_None; @@ -1713,7 +1733,7 @@ } static struct PyMethodDef winreg_methods[] = { - {"CloseKey", PyCloseKey, METH_VARARGS, CloseKey_doc}, + WINREG_CLOSEKEY_METHODDEF {"ConnectRegistry", PyConnectRegistry, METH_VARARGS, ConnectRegistry_doc}, {"CreateKey", PyCreateKey, METH_VARARGS, CreateKey_doc}, {"CreateKeyEx", (PyCFunction)PyCreateKeyEx,

AltStyle によって変換されたページ (->オリジナル) /