comparison mercurial/formatter.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 d4ba4d51f85f
children 6000f5b25c9b
comparison
equal deleted inserted replaced
48869:57b58413dad1 48870:df56e6bd37f6
108 from __future__ import absolute_import, print_function 108 from __future__ import absolute_import, print_function
109 109
110 import contextlib 110 import contextlib
111 import itertools 111 import itertools
112 import os 112 import os
113 import pickle
113 114
114 from .i18n import _ 115 from .i18n import _
115 from .node import ( 116 from .node import (
116 hex, 117 hex,
117 short, 118 short,
130 from .utils import ( 131 from .utils import (
131 cborutil, 132 cborutil,
132 dateutil, 133 dateutil,
133 stringutil, 134 stringutil,
134 ) 135 )
135
136 pickle = util.pickle
137 136
138 137
139 def isprintable(obj): 138 def isprintable(obj):
140 """Check if the given object can be directly passed in to formatter's 139 """Check if the given object can be directly passed in to formatter's
141 write() and data() functions 140 write() and data() functions