summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2017-11-24 15:11:18 (GMT)
committerGitHub <noreply@github.com>2017-11-24 15:11:18 (GMT)
commit19fb134185ce155bc53f517116fca73093ba55e9 (patch)
treee38accbe5c87a8c93a40ef649e2a07cd9cee79df
parent9e87e7776f7ace66baaf7247233afdabd00c2b44 (diff)
downloadcpython-19fb134185ce155bc53f517116fca73093ba55e9.zip
cpython-19fb134185ce155bc53f517116fca73093ba55e9.tar.gz
cpython-19fb134185ce155bc53f517116fca73093ba55e9.tar.bz2
bpo-12239: Make GetProperty() return None for VT_EMPTY (GH-4539)
The previous behavior was to raise an exception NotImplementedError: result of type 0 when the value of the property is VT_EMPTY.
-rw-r--r--Lib/test/test_msilib.py7
-rw-r--r--Misc/NEWS.d/next/Library/2017-11-24-14-07-55.bpo-12239.Nj3A0x.rst2
-rw-r--r--PC/_msi.c2
3 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_msilib.py b/Lib/test/test_msilib.py
index 4093134..6d89ca4 100644
--- a/Lib/test/test_msilib.py
+++ b/Lib/test/test_msilib.py
@@ -53,6 +53,13 @@ class MsiDatabaseTestCase(unittest.TestCase):
msilib.OpenDatabase(db_path, msilib.MSIDBOPEN_CREATE)
self.assertEqual(str(cm.exception), 'create failed')
+ def test_get_property_vt_empty(self):
+ db, db_path = init_database()
+ summary = db.GetSummaryInformation(0)
+ self.assertIsNone(summary.GetProperty(msilib.PID_SECURITY))
+ db.Close()
+ self.addCleanup(unlink, db_path)
+
class Test_make_id(unittest.TestCase):
#http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
diff --git a/Misc/NEWS.d/next/Library/2017-11-24-14-07-55.bpo-12239.Nj3A0x.rst b/Misc/NEWS.d/next/Library/2017-11-24-14-07-55.bpo-12239.Nj3A0x.rst
new file mode 100644
index 0000000..20d9477
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2017-11-24-14-07-55.bpo-12239.Nj3A0x.rst
@@ -0,0 +1,2 @@
+Make :meth:`msilib.SummaryInformation.GetProperty` return ``None`` when the
+value of property is ``VT_EMPTY``. Initial patch by Mark Mc Mahon.
diff --git a/PC/_msi.c b/PC/_msi.c
index 8cc1fd5..000d81f 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -575,6 +575,8 @@ summary_getproperty(msiobj* si, PyObject *args)
if (sval != sbuf)
free(sval);
return result;
+ case VT_EMPTY:
+ Py_RETURN_NONE;
}
PyErr_Format(PyExc_NotImplementedError, "result of type %d", type);
return NULL;