mirror of
https://github.com/python/cpython.git
synced 2025-09-29 19:56:59 +00:00
[3.6] 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.
(cherry picked from commit 19fb134185
)
This commit is contained in:
parent
bfa89b21e1
commit
412f00b839
3 changed files with 11 additions and 0 deletions
|
@ -52,6 +52,13 @@ class MsiDatabaseTestCase(unittest.TestCase):
|
||||||
msilib.OpenDatabase(db_path, msilib.MSIDBOPEN_CREATE)
|
msilib.OpenDatabase(db_path, msilib.MSIDBOPEN_CREATE)
|
||||||
self.assertEqual(str(cm.exception), 'create failed')
|
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))
|
||||||
|
del db
|
||||||
|
self.addCleanup(unlink, db_path)
|
||||||
|
|
||||||
|
|
||||||
class Test_make_id(unittest.TestCase):
|
class Test_make_id(unittest.TestCase):
|
||||||
#http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
|
#http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
|
||||||
|
|
|
@ -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.
|
|
@ -578,6 +578,8 @@ summary_getproperty(msiobj* si, PyObject *args)
|
||||||
if (sval != sbuf)
|
if (sval != sbuf)
|
||||||
free(sval);
|
free(sval);
|
||||||
return result;
|
return result;
|
||||||
|
case VT_EMPTY:
|
||||||
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
PyErr_Format(PyExc_NotImplementedError, "result of type %d", type);
|
PyErr_Format(PyExc_NotImplementedError, "result of type %d", type);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue