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
d0ebc75e
Commit
d0ebc75e
authored
Jan 15, 2011
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mmap and test_mmap under Windows too (followup to r88022)
parent
3988ed8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
Lib/test/test_mmap.py
Lib/test/test_mmap.py
+6
-5
Modules/mmapmodule.c
Modules/mmapmodule.c
+1
-0
No files found.
Lib/test/test_mmap.py
View file @
d0ebc75e
...
...
@@ -325,13 +325,14 @@ class MmapTests(unittest.TestCase):
# map length with an offset doesn't cause a segfault.
if
not
hasattr
(
os
,
"stat"
):
self
.
skipTest
(
"needs os.stat"
)
with
open
(
TESTFN
,
"wb+"
)
as
f
:
f
.
write
(
49152
*
b'm'
)
# Arbitrary character
# NOTE: allocation granularity is currently 65536 under Win64,
# and therefore the minimum offset alignment.
with
open
(
TESTFN
,
"wb"
)
as
f
:
f
.
write
((
65536
*
2
)
*
b'm'
)
# Arbitrary character
with
open
(
TESTFN
,
"rb"
)
as
f
:
mf
=
mmap
.
mmap
(
f
.
fileno
(),
0
,
offset
=
40960
,
access
=
mmap
.
ACCESS_READ
)
self
.
assertRaises
(
IndexError
,
mf
.
__getitem__
,
45000
)
mf
.
close
()
with
mmap
.
mmap
(
f
.
fileno
(),
0
,
offset
=
65536
,
access
=
mmap
.
ACCESS_READ
)
as
mf
:
self
.
assertRaises
(
IndexError
,
mf
.
__getitem__
,
80000
)
def
test_move
(
self
):
# make move works everywhere (64-bit format problem earlier)
...
...
Modules/mmapmodule.c
View file @
d0ebc75e
...
...
@@ -1300,6 +1300,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
else
m_obj
->
size
=
low
;
#endif
m_obj
->
size
-=
offset
;
}
else
{
m_obj
->
size
=
map_size
;
}
...
...
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