summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-09-09 14:04:58 (GMT)
committerGitHub <noreply@github.com>2024-09-09 14:04:58 (GMT)
commitd8f3c1e8f9c384fa6a473c3923f3b26ad6257cac (patch)
treee6006569bb1b1cc169fedfd065af6a0456ac9492 /Lib
parentb950831c941a37c37b68a771610e072d11d33331 (diff)
downloadcpython-d8f3c1e8f9c384fa6a473c3923f3b26ad6257cac.zip
cpython-d8f3c1e8f9c384fa6a473c3923f3b26ad6257cac.tar.gz
cpython-d8f3c1e8f9c384fa6a473c3923f3b26ad6257cac.tar.bz2
gh-117482: Simplify the Fix For Builtin Types Slot Wrappers (GH-122865)
In gh-121602, I applied a fix to a builtin types initialization bug. That fix made sense in the context of some broader future changes, but introduced a little bit of extra complexity. That fix has turned out to be incomplete for some of the builtin types we haven't been testing. I found that out while improving the tests. A while back, @markshannon suggested a simpler fix that doesn't have that problem, which I've already applied to 3.12 and 3.13. I'm switching to that here. Given the potential long-term benefits of the more complex (but still incomplete) approach, I'll circle back to it in the future, particularly after I've improved the tests so no corner cases slip through the cracks. (This is effectively a "forward-port" of 716c677 from 3.13.)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_doctest/test_doctest.py2
-rw-r--r--Lib/test/test_embed.py1
-rw-r--r--Lib/test/test_types.py10
3 files changed, 1 insertions, 12 deletions
diff --git a/Lib/test/test_doctest/test_doctest.py b/Lib/test/test_doctest/test_doctest.py
index 3e93a3b..171412c 100644
--- a/Lib/test/test_doctest/test_doctest.py
+++ b/Lib/test/test_doctest/test_doctest.py
@@ -738,7 +738,7 @@ plain ol' Python and is guaranteed to be available.
>>> import builtins
>>> tests = doctest.DocTestFinder().find(builtins)
- >>> 830 < len(tests) < 860 # approximate number of objects with docstrings
+ >>> 750 < len(tests) < 800 # approximate number of objects with docstrings
True
>>> real_tests = [t for t in tests if len(t.examples) > 0]
>>> len(real_tests) # objects that actually have doctests
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index 4962586..6790326 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -416,7 +416,6 @@ class EmbeddingTests(EmbeddingTestsMixin, unittest.TestCase):
out, err = self.run_embedded_interpreter("test_repeated_init_exec", code)
self.assertEqual(out, '20000101\n' * INIT_LOOPS)
- @unittest.skip('inheritance across re-init is currently broken; see gh-117482')
def test_static_types_inherited_slots(self):
script = textwrap.dedent("""
import test.support
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 2ee4660..3c9e33e 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -2410,9 +2410,6 @@ class SubinterpreterTests(unittest.TestCase):
def collate_results(raw):
results = {}
for cls, attr, wrapper in raw:
- # XXX This should not be necessary.
- if cls == repr(bool) and attr in self.NUMERIC_METHODS:
- continue
key = cls, attr
assert key not in results, (results, key, wrapper)
results[key] = wrapper
@@ -2433,14 +2430,7 @@ class SubinterpreterTests(unittest.TestCase):
cls, attr = key
with self.subTest(cls=cls, slotattr=attr):
actual = interp_results.pop(key)
- # XXX This should not be necessary.
- if cls == "<class 'collections.OrderedDict'>" and attr == '__len__':
- continue
self.assertEqual(actual, expected)
- # XXX This should not be necessary.
- interp_results = {k: v for k, v in interp_results.items() if k[1] != '__hash__'}
- # XXX This should not be necessary.
- interp_results.pop(("<class 'collections.OrderedDict'>", '__getitem__'), None)
self.maxDiff = None
self.assertEqual(interp_results, {})