diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2014-06-15 12:26:06 +0200 |
|---|---|---|
| committer | Sebastian Thiel <byronimo@gmail.com> | 2014-06-15 12:26:06 +0200 |
| commit | 137d5b15088feaa690cb002810f4b06da85fb198 (patch) | |
| tree | 3d7482fc06bbd6dcffb49bef9c0b1077f85343e0 | |
| parent | f0680101739da3435bbae0139765bb5ce65bcb92 (diff) | |
| parent | 403ad7816e2c88be78606cfee2d9944f535e7ed7 (diff) | |
| download | smmap-137d5b15088feaa690cb002810f4b06da85fb198.tar.gz | |
Merge pull request #9 from msabramo/delay_sys_getrefcount_pypy
Delay importing sys.getrefcount until needed
| -rw-r--r-- | smmap/mman.py | 1 | ||||
| -rw-r--r-- | smmap/util.py | 4 |
2 files changed, 2 insertions, 3 deletions
diff --git a/smmap/mman.py b/smmap/mman.py index 9cc251f..637a284 100644 --- a/smmap/mman.py +++ b/smmap/mman.py @@ -10,7 +10,6 @@ from .util import ( from weakref import ref import sys -from sys import getrefcount from functools import reduce __all__ = ["StaticWindowMapManager", "SlidingWindowMapManager", "WindowCursor"] diff --git a/smmap/util.py b/smmap/util.py index f4ecd22..ec86cbf 100644 --- a/smmap/util.py +++ b/smmap/util.py @@ -12,8 +12,6 @@ except ImportError: from mmap import PAGESIZE as ALLOCATIONGRANULARITY #END handle pythons missing quality assurance -from sys import getrefcount - __all__ = [ "align_to_mmap", "is_64_bit", "MapWindow", "MapRegion", "MapRegionList", "ALLOCATIONGRANULARITY"] @@ -210,6 +208,7 @@ class MapRegion(object): def client_count(self): """:return: number of clients currently using this region""" + from sys import getrefcount # -1: self on stack, -1 self in this method, -1 self in getrefcount return getrefcount(self)-3 @@ -256,6 +255,7 @@ class MapRegionList(list): def client_count(self): """:return: amount of clients which hold a reference to this instance""" + from sys import getrefcount return getrefcount(self)-3 def path_or_fd(self): |
