summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2017-11-07 12:58:53 (GMT)
committerGitHub <noreply@github.com>2017-11-07 12:58:53 (GMT)
commita935654f0613640535fbf0ba190f81d02a63d35c (patch)
tree5753241a41d176bfdd41a03ef3fc546b2a4de5d7 /PC
parent3cc4c53a64bdcf21431ad306eca0e568f88735a2 (diff)
downloadcpython-a935654f0613640535fbf0ba190f81d02a63d35c.zip
cpython-a935654f0613640535fbf0ba190f81d02a63d35c.tar.gz
cpython-a935654f0613640535fbf0ba190f81d02a63d35c.tar.bz2
bpo-20486: Implement Database.Close() method in msilib (GH-4141)
Diffstat (limited to 'PC')
-rw-r--r--PC/_msi.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/PC/_msi.c b/PC/_msi.c
index a15f684..df6c881 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -287,14 +287,6 @@ msiobj_dealloc(msiobj* msidb)
}
static PyObject*
-msiobj_close(msiobj* msidb, PyObject *args)
-{
- MsiCloseHandle(msidb->h);
- msidb->h = 0;
- Py_RETURN_NONE;
-}
-
-static PyObject*
msierror(int status)
{
int code;
@@ -342,6 +334,17 @@ msierror(int status)
return NULL;
}
+static PyObject*
+msidb_close(msiobj* msidb, PyObject *args)
+{
+ int status;
+ if ((status = MsiCloseHandle(msidb->h)) != ERROR_SUCCESS) {
+ return msierror(status);
+ }
+ msidb->h = 0;
+ Py_RETURN_NONE;
+}
+
/*************************** Record objects **********************/
static PyObject*
@@ -901,6 +904,8 @@ static PyMethodDef db_methods[] = {
PyDoc_STR("Commit() -> None\nWraps MsiDatabaseCommit")},
{ "GetSummaryInformation", (PyCFunction)msidb_getsummaryinformation, METH_VARARGS,
PyDoc_STR("GetSummaryInformation(updateCount) -> viewobj\nWraps MsiGetSummaryInformation")},
+ { "Close", (PyCFunction)msidb_close, METH_NOARGS,
+ PyDoc_STR("Close() -> None\nWraps MsiCloseHandle")},
{ NULL, NULL }
};