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
cbee972e
Kaydet (Commit)
cbee972e
authored
Agu 19, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows.
üst
ede745a7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
test_mmap.py
Lib/test/test_mmap.py
+10
-1
NEWS
Misc/NEWS
+2
-0
mmapmodule.c
Modules/mmapmodule.c
+16
-0
No files found.
Lib/test/test_mmap.py
Dosyayı görüntüle @
cbee972e
from
test.test_support
import
(
TESTFN
,
run_unittest
,
import_module
,
unlink
,
requires
,
_2G
,
_4G
)
requires
,
_2G
,
_4G
,
gc_collect
,
cpython_only
)
import
unittest
import
os
,
re
,
itertools
,
socket
,
sys
...
...
@@ -606,6 +606,15 @@ class MmapTests(unittest.TestCase):
m2
.
close
()
m1
.
close
()
@cpython_only
@unittest.skipUnless
(
os
.
name
==
'nt'
,
'requires Windows'
)
def
test_sizeof
(
self
):
m1
=
mmap
.
mmap
(
-
1
,
100
)
tagname
=
"foo"
m2
=
mmap
.
mmap
(
-
1
,
100
,
tagname
=
tagname
)
self
.
assertEqual
(
sys
.
getsize
(
m2
),
sys
.
getsize
(
m1
)
+
len
(
tagname
)
+
1
)
@unittest.skipUnless
(
os
.
name
==
'nt'
,
'requires Windows'
)
def
test_crasher_on_windows
(
self
):
# Should not crash (Issue 1733986)
...
...
Misc/NEWS
Dosyayı görüntüle @
cbee972e
...
...
@@ -19,6 +19,8 @@ Core and Builtins
Library
-------
- Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows.
- Issue #22068: Avoided reference loops with Variables and Fonts in Tkinter.
- Issue #21448: Changed FeedParser feed() to avoid O(N**2) behavior when
...
...
Modules/mmapmodule.c
Dosyayı görüntüle @
cbee972e
...
...
@@ -649,6 +649,19 @@ mmap_move_method(mmap_object *self, PyObject *args)
}
}
#ifdef MS_WINDOWS
static
PyObject
*
mmap__sizeof__method
(
mmap_object
*
self
,
void
*
unused
)
{
Py_ssize_t
res
;
res
=
sizeof
(
mmap_object
);
if
(
self
->
tagname
)
res
+=
strlen
(
self
->
tagname
)
+
1
;
return
PyLong_FromSsize_t
(
res
);
}
#endif
static
struct
PyMethodDef
mmap_object_methods
[]
=
{
{
"close"
,
(
PyCFunction
)
mmap_close_method
,
METH_NOARGS
},
{
"find"
,
(
PyCFunction
)
mmap_find_method
,
METH_VARARGS
},
...
...
@@ -664,6 +677,9 @@ static struct PyMethodDef mmap_object_methods[] = {
{
"tell"
,
(
PyCFunction
)
mmap_tell_method
,
METH_NOARGS
},
{
"write"
,
(
PyCFunction
)
mmap_write_method
,
METH_VARARGS
},
{
"write_byte"
,
(
PyCFunction
)
mmap_write_byte_method
,
METH_VARARGS
},
#ifdef MS_WINDOWS
{
"__sizeof__"
,
(
PyCFunction
)
mmap__sizeof__method
,
METH_NOARGS
},
#endif
{
NULL
,
NULL
}
/* sentinel */
};
...
...
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