Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
17a837e4
Kaydet (Commit)
17a837e4
authored
Şub 17, 2009
tarafından
Hirokazu Yamamoto
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #5282: Fixed mmap resize on 32bit windows and unix. When offset > 0,
The file was resized to wrong size.
üst
1d0b5cc6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
test_mmap.py
Lib/test/test_mmap.py
+21
-0
NEWS
Misc/NEWS
+3
-0
mmapmodule.c
Modules/mmapmodule.c
+2
-2
No files found.
Lib/test/test_mmap.py
Dosyayı görüntüle @
17a837e4
...
@@ -417,6 +417,27 @@ class MmapTests(unittest.TestCase):
...
@@ -417,6 +417,27 @@ class MmapTests(unittest.TestCase):
m
=
mmap
.
mmap
(
f
.
fileno
(),
mapsize
-
halfsize
,
offset
=
halfsize
)
m
=
mmap
.
mmap
(
f
.
fileno
(),
mapsize
-
halfsize
,
offset
=
halfsize
)
self
.
assertEqual
(
m
[
0
:
3
],
'foo'
)
self
.
assertEqual
(
m
[
0
:
3
],
'foo'
)
f
.
close
()
f
.
close
()
# Try resizing map
try
:
m
.
resize
(
512
)
except
SystemError
:
pass
else
:
# resize() is supported
self
.
assertEqual
(
len
(
m
),
512
)
# Check that we can no longer seek beyond the new size.
self
.
assertRaises
(
ValueError
,
m
.
seek
,
513
,
0
)
# Check that the content is not changed
self
.
assertEqual
(
m
[
0
:
3
],
'foo'
)
# Check that the underlying file is truncated too
f
=
open
(
TESTFN
)
f
.
seek
(
0
,
2
)
self
.
assertEqual
(
f
.
tell
(),
halfsize
+
512
)
f
.
close
()
self
.
assertEqual
(
m
.
size
(),
halfsize
+
512
)
m
.
close
()
m
.
close
()
finally
:
finally
:
...
...
Misc/NEWS
Dosyayı görüntüle @
17a837e4
...
@@ -159,6 +159,9 @@ Core and Builtins
...
@@ -159,6 +159,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #5282: Fixed mmap resize on 32bit windows and unix. When offset > 0,
The file was resized to wrong size.
- Issue #5292: Fixed mmap crash on its boundary access m[len(m)].
- Issue #5292: Fixed mmap crash on its boundary access m[len(m)].
- Issue #2279: distutils.sdist.add_defaults now add files
- Issue #2279: distutils.sdist.add_defaults now add files
...
...
Modules/mmapmodule.c
Dosyayı görüntüle @
17a837e4
...
@@ -444,7 +444,7 @@ mmap_resize_method(mmap_object *self,
...
@@ -444,7 +444,7 @@ mmap_resize_method(mmap_object *self,
off_lo
=
(
DWORD
)(
self
->
offset
&
0xFFFFFFFF
);
off_lo
=
(
DWORD
)(
self
->
offset
&
0xFFFFFFFF
);
#else
#else
newSizeHigh
=
0
;
newSizeHigh
=
0
;
newSizeLow
=
(
DWORD
)
new_size
;
newSizeLow
=
(
DWORD
)
(
self
->
offset
+
new_size
)
;
off_hi
=
0
;
off_hi
=
0
;
off_lo
=
(
DWORD
)
self
->
offset
;
off_lo
=
(
DWORD
)
self
->
offset
;
#endif
#endif
...
@@ -490,7 +490,7 @@ mmap_resize_method(mmap_object *self,
...
@@ -490,7 +490,7 @@ mmap_resize_method(mmap_object *self,
}
else
{
}
else
{
void
*
newmap
;
void
*
newmap
;
if
(
ftruncate
(
self
->
fd
,
new_size
)
==
-
1
)
{
if
(
ftruncate
(
self
->
fd
,
self
->
offset
+
new_size
)
==
-
1
)
{
PyErr_SetFromErrno
(
mmap_module_error
);
PyErr_SetFromErrno
(
mmap_module_error
);
return
NULL
;
return
NULL
;
}
}
...
...
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