mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #24379: Revert the operator.subscript patch (dccc4e63aef5) pending resolution of the related refcnt leak.
This commit is contained in:
parent
0bdf9ea136
commit
a1fc949b5a
4 changed files with 1 additions and 83 deletions
|
@ -596,38 +596,5 @@ class CCOperatorPickleTestCase(OperatorPickleTestCase, unittest.TestCase):
|
|||
module2 = c_operator
|
||||
|
||||
|
||||
class SubscriptTestCase:
|
||||
def test_subscript(self):
|
||||
subscript = self.module.subscript
|
||||
self.assertIsNone(subscript[None])
|
||||
self.assertEqual(subscript[0], 0)
|
||||
self.assertEqual(subscript[0:1:2], slice(0, 1, 2))
|
||||
self.assertEqual(
|
||||
subscript[0, ..., :2, ...],
|
||||
(0, Ellipsis, slice(2), Ellipsis),
|
||||
)
|
||||
|
||||
def test_pickle(self):
|
||||
from operator import subscript
|
||||
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
|
||||
with self.subTest(proto=proto):
|
||||
self.assertIs(
|
||||
pickle.loads(pickle.dumps(subscript, proto)),
|
||||
subscript,
|
||||
)
|
||||
|
||||
def test_singleton(self):
|
||||
with self.assertRaises(TypeError):
|
||||
type(self.module.subscript)()
|
||||
|
||||
def test_immutable(self):
|
||||
with self.assertRaises(AttributeError):
|
||||
self.module.subscript.attr = None
|
||||
|
||||
|
||||
class PySubscriptTestCase(SubscriptTestCase, PyOperatorTestCase):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue