mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows.
This commit is contained in:
parent
d6ec309c36
commit
76b47655ff
3 changed files with 28 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
from test.support import (TESTFN, run_unittest, import_module, unlink,
|
||||
requires, _2G, _4G, gc_collect)
|
||||
requires, _2G, _4G, gc_collect, cpython_only)
|
||||
import unittest
|
||||
import os
|
||||
import re
|
||||
|
@ -639,6 +639,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue