Fix SF bug #1402308, segfault when using mmap(-1, ...)

This didn't crash on Linux, but valgrind complained.
I'm not sure if this test is valid on Windows.

Will backport.
This commit is contained in:
Neal Norwitz 2006-01-11 08:54:45 +00:00
parent ae1df41127
commit 3b4fff8079
5 changed files with 13 additions and 0 deletions

View file

@ -281,6 +281,14 @@ def test_both():
except OSError:
pass
print ' Try opening a bad file descriptor...'
try:
mmap.mmap(-1, 4096)
except mmap.error:
pass
else:
verify(0, 'expected a mmap.error but did not get it')
# Do a tougher .find() test. SF bug 515943 pointed out that, in 2.2,
# searching for data with embedded \0 bytes didn't work.
f = open(TESTFN, 'w+')