[Python-checkins] gh-95672: Update memory_watchdog to use test.support.get_pagesize (gh-102365)

corona10 webhook-mailer at python.org
Thu Mar 2 06:10:19 EST 2023


https://github.com/python/cpython/commit/60597439ef482a840f8ffc76eb6c27f3ba773d9c
commit: 60597439ef482a840f8ffc76eb6c27f3ba773d9c
branch: main
author: Hyunkyun Moon <hyunkyun.moon at linecorp.com>
committer: corona10 <donghee.na92 at gmail.com>
date: 2023-03-02T20:10:08+09:00
summary:

gh-95672: Update memory_watchdog to use test.support.get_pagesize (gh-102365)

files:
M Lib/test/memory_watchdog.py

diff --git a/Lib/test/memory_watchdog.py b/Lib/test/memory_watchdog.py
index 88cca8d323a6..fee062ecc9b3 100644
--- a/Lib/test/memory_watchdog.py
+++ b/Lib/test/memory_watchdog.py
@@ -5,20 +5,13 @@
 # If the process crashes, reading from the /proc entry will fail with ESRCH.
 
 
-import os
 import sys
 import time
+from test.support import get_pagesize
 
 
-try:
-    page_size = os.sysconf('SC_PAGESIZE')
-except (ValueError, AttributeError):
-    try:
-        page_size = os.sysconf('SC_PAGE_SIZE')
-    except (ValueError, AttributeError):
-        page_size = 4096
-
 while True:
+    page_size = get_pagesize()
     sys.stdin.seek(0)
     statm = sys.stdin.read()
     data = int(statm.split()[5])



More information about the Python-checkins mailing list