8000 bpo-1104: msilib.SummaryInfo.GetProperty() truncates the string by one character by uranusjr · Pull Request #4517 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'master' into bpo-1104-msilib-getproperty-truncation
  • Loading branch information
zooba authored Feb 2, 2019
commit 68ee77a064d6184e1d720fb144e93db77ac4fbc8
18 changes: 18 additions & 0 deletions Lib/test/test_msilib.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ def test_summaryinfo_getproperty_issue1104(self):
sum_info = None
os.unlink(db_path)

def test_database_open_failed(self):
with self.assertRaises(msilib.MSIError) as cm:
msilib.OpenDatabase('non-existent.msi', msilib.MSIDBOPEN_READONLY)
self.assertEqual(str(cm.exception), 'open failed')

def test_database_create_failed(self):
db_path = os.path.join(TESTFN, 'test.msi')
with self.assertRaises(msilib.MSIError) as cm:
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
Expand Down
4 changes: 4 additions & 0 deletions PC/_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,10 @@ summary_getproperty(msiobj* si, PyObject *args)
case VT_LPSTR:
result = PyBytes_FromStringAndSize(sval, ssize);
break;
case VT_EMPTY:
Py_INCREF(Py_None);
result = Py_None;
break;
default:
PyErr_Format(PyExc_NotImplementedError, "result of type %d", type);
result = NULL;
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0