Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bdb8315c
Commit
bdb8315c
authored
Nov 23, 2017
by
Berker Peksag
Committed by
GitHub
Nov 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-1102: View.Fetch() now returns None when it's exhausted (GH-4459)
parent
5ce1069a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
2 deletions
+49
-2
Lib/test/test_msilib.py
Lib/test/test_msilib.py
+40
-1
Misc/NEWS.d/next/Windows/2017-11-19-09-46-27.bpo-1102.NY-g1F.rst
...WS.d/next/Windows/2017-11-19-09-46-27.bpo-1102.NY-g1F.rst
+4
-0
PC/_msi.c
PC/_msi.c
+5
-1
No files found.
Lib/test/test_msilib.py
View file @
bdb8315c
""" Test suite for the code in msilib """
import
unittest
from
test.support
import
import_module
from
test.support
import
TESTFN
,
import_module
,
unlink
msilib
=
import_module
(
'msilib'
)
import
msilib.schema
def
init_database
():
path
=
TESTFN
+
'.msi'
db
=
msilib
.
init_database
(
path
,
msilib
.
schema
,
'Python Tests'
,
'product_code'
,
'1.0'
,
'PSF'
,
)
return
db
,
path
class
MsiDatabaseTestCase
(
unittest
.
TestCase
):
def
test_view_fetch_returns_none
(
self
):
db
,
db_path
=
init_database
()
properties
=
[]
view
=
db
.
OpenView
(
'SELECT Property, Value FROM Property'
)
view
.
Execute
(
None
)
while
True
:
record
=
view
.
Fetch
()
if
record
is
None
:
break
properties
.
append
(
record
.
GetString
(
1
))
view
.
Close
()
db
.
Close
()
self
.
assertEqual
(
properties
,
[
'ProductName'
,
'ProductCode'
,
'ProductVersion'
,
'Manufacturer'
,
'ProductLanguage'
,
]
)
self
.
addCleanup
(
unlink
,
db_path
)
class
Test_make_id
(
unittest
.
TestCase
):
#http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
...
...
Misc/NEWS.d/next/Windows/2017-11-19-09-46-27.bpo-1102.NY-g1F.rst
0 → 100644
View file @
bdb8315c
Return ``None`` when ``View.Fetch()`` returns ``ERROR_NO_MORE_ITEMS``
instead of raising ``MSIError``.
Initial patch by Anthony Tuininga.
PC/_msi.c
View file @
bdb8315c
...
...
@@ -723,8 +723,12 @@ view_fetch(msiobj *view, PyObject*args)
int
status
;
MSIHANDLE
result
;
if
((
status
=
MsiViewFetch
(
view
->
h
,
&
result
))
!=
ERROR_SUCCESS
)
status
=
MsiViewFetch
(
view
->
h
,
&
result
);
if
(
status
==
ERROR_NO_MORE_ITEMS
)
{
Py_RETURN_NONE
;
}
else
if
(
status
!=
ERROR_SUCCESS
)
{
return
msierror
(
status
);
}
return
record_new
(
result
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment