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

This commit is contained in:
Hyunkyun Moon 2023-03-02 20:10:08 +09:00 committed by GitHub
parent eaae563b68
commit 60597439ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 9 deletions

View File

@ -5,20 +5,13 @@ and print it out, until terminated."""
# 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])