summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/support')
-rw-r--r--Lib/test/support/__init__.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 4a22ccd..c309fd7 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -51,6 +51,8 @@ __all__ = [
# sys
"is_jython", "is_android", "is_emscripten", "is_wasi",
"check_impl_detail", "unix_shell", "setswitchinterval",
+ # os
+ "get_pagesize",
# network
"open_urlresource",
# processes
@@ -1893,6 +1895,18 @@ def setswitchinterval(interval):
return sys.setswitchinterval(interval)
+def get_pagesize():
+ """Get size of a page in bytes."""
+ try:
+ page_size = os.sysconf('SC_PAGESIZE')
+ except (ValueError, AttributeError):
+ try:
+ page_size = os.sysconf('SC_PAGE_SIZE')
+ except (ValueError, AttributeError):
+ page_size = 4096
+ return page_size
+
+
@contextlib.contextmanager
def disable_faulthandler():
import faulthandler