diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2017-11-07 12:58:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-07 12:58:53 (GMT) |
commit | a935654f0613640535fbf0ba190f81d02a63d35c (patch) | |
tree | 5753241a41d176bfdd41a03ef3fc546b2a4de5d7 /PC/_msi.c | |
parent | 3cc4c53a64bdcf21431ad306eca0e568f88735a2 (diff) | |
download | cpython-a935654f0613640535fbf0ba190f81d02a63d35c.zip cpython-a935654f0613640535fbf0ba190f81d02a63d35c.tar.gz cpython-a935654f0613640535fbf0ba190f81d02a63d35c.tar.bz2 |
bpo-20486: Implement Database.Close() method in msilib (GH-4141)
Diffstat (limited to 'PC/_msi.c')
-rw-r--r-- | PC/_msi.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -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 } }; |