8000 gh-119050: Add XML support to libregrtest refleak checker by vstinner · Pull Request #119148 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-119050: Add XML support to libregrtest refleak checker #119148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use pickle to serialize
  • Loading branch information
vstinner committed May 18, 2024
commit 0eb1be31613b07962ee7bbcdedf82fc39cf36d02
14 changes: 6 additions & 8 deletions Lib/test/libregrtest/refleak.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,21 @@ def save_support_xml(filename):
if support.junit_xml_list is None:
return

with open(filename, 'x', encoding='ascii') as fp:
for elem in support.junit_xml_list:
print(elem, file=fp)
import pickle
with open(filename, 'xb') as fp:
pickle.dump(support.junit_xml_list, fp)
support.junit_xml_list = None


def restore_support_xml(filename):
try:
fp = open(filename, 'r', encoding='ascii')
fp = open(filename, 'rb')
except FileNotFoundError:
return

xml_list = []
import pickle
with fp:
for line in fp:
line = line.rstrip()
xml_list.append(line)
xml_list = pickle.load(fp)
os.unlink(filename)

support.junit_xml_list = xml_list
Expand Down
Loading
0