Mercurial > hg
comparison tests/test-stdio.py @ 48870:df56e6bd37f6
py3: use pickle directly
pycompat.pickle abstracted over the different pickle modules in
Python 2 and 3. Now that we're Python 3 only, it is safe to use the
`pickle` module directly. So this commit does that.
As part of this we remove the rules from check-code.py that were
forbidden direct pickle module use.
We retain the `util.pickle` symbol for backwards compatibility, just
in case some extensions were using it.
Differential Revision: https://phab.mercurial-scm.org/D12249
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 01 Mar 2022 20:29:03 -0800 |
parents | 23f5ed6dbcb1 |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
48869:57b58413dad1 | 48870:df56e6bd37f6 |
---|---|
5 from __future__ import absolute_import | 5 from __future__ import absolute_import |
6 | 6 |
7 import contextlib | 7 import contextlib |
8 import errno | 8 import errno |
9 import os | 9 import os |
10 import pickle | |
10 import signal | 11 import signal |
11 import subprocess | 12 import subprocess |
12 import sys | 13 import sys |
13 import tempfile | 14 import tempfile |
14 import unittest | 15 import unittest |
334 os.close(stream_receiver) | 335 os.close(stream_receiver) |
335 proc.stdin.write(b'x') | 336 proc.stdin.write(b'x') |
336 proc.stdin.close() | 337 proc.stdin.close() |
337 | 338 |
338 def post_child_check(): | 339 def post_child_check(): |
339 err = util.pickle.load(err_f) | 340 err = pickle.load(err_f) |
340 self.assertEqual(err.errno, errno.EPIPE) | 341 self.assertEqual(err.errno, errno.EPIPE) |
341 self.assertEqual(err.strerror, "Broken pipe") | 342 self.assertEqual(err.strerror, "Broken pipe") |
342 | 343 |
343 with tempfile.NamedTemporaryFile('rb') as err_f: | 344 with tempfile.NamedTemporaryFile('rb') as err_f: |
344 self._test( | 345 self._test( |