]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-133167: Fix compilation process with `--enable-optimizations` and `--withou...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 30 Apr 2025 14:06:31 +0000 (16:06 +0200)
committerGitHub <noreply@github.com>
Wed, 30 Apr 2025 14:06:31 +0000 (14:06 +0000)
gh-133167: Fix compilation process with `--enable-optimizations` and `--without-docstrings` (GH-133187)
(cherry picked from commit cc39b19f0fca8db0f881ecaf02f88d72d9f93776)

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/support/__init__.py
Lib/test/test_functools.py
Lib/test/test_operator.py
Misc/NEWS.d/next/Build/2025-04-30-10-23-18.gh-issue-133167.E0jrYJ.rst [new file with mode: 0644]

index a21b1e70d7016471ffcc400123b53d5942874917..f4cc51a918758728082692c1b81430778df2ae64 100644 (file)
@@ -1285,8 +1285,8 @@ MISSING_C_DOCSTRINGS = (check_impl_detail() and
                         sys.platform != 'win32' and
                         not sysconfig.get_config_var('WITH_DOC_STRINGS'))
 
-HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None and
-                   not MISSING_C_DOCSTRINGS)
+HAVE_PY_DOCSTRINGS = _check_docstrings.__doc__ is not None
+HAVE_DOCSTRINGS = (HAVE_PY_DOCSTRINGS and not MISSING_C_DOCSTRINGS)
 
 requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
                                           "test requires docstrings")
index 96001a943f0327209836a84ef75fe3f53c7d4e5d..9793df50a3d4a810ae1745b8836a2b1828a6489a 100644 (file)
@@ -2770,7 +2770,7 @@ class TestSingleDispatch(unittest.TestCase):
                 self.assertEqual(meth.__qualname__, prefix + meth.__name__)
                 self.assertEqual(meth.__doc__,
                                  ('My function docstring'
-                                  if support.HAVE_DOCSTRINGS
+                                  if support.HAVE_PY_DOCSTRINGS
                                   else None))
                 self.assertEqual(meth.__annotations__['arg'], int)
 
@@ -2862,7 +2862,7 @@ class TestSingleDispatch(unittest.TestCase):
             with self.subTest(meth=meth):
                 self.assertEqual(meth.__doc__,
                                  ('My function docstring'
-                                  if support.HAVE_DOCSTRINGS
+                                  if support.HAVE_PY_DOCSTRINGS
                                   else None))
                 self.assertEqual(meth.__annotations__['arg'], int)
 
@@ -3317,7 +3317,7 @@ class TestCachedProperty(unittest.TestCase):
     def test_doc(self):
         self.assertEqual(CachedCostItem.cost.__doc__,
                          ("The cost of the item."
-                          if support.HAVE_DOCSTRINGS
+                          if support.HAVE_PY_DOCSTRINGS
                           else None))
 
     def test_module(self):
index f8eac8dc0026369f1088dcc2777e34a77e770135..d90f820052c7186e38989f572aeb361053a35e96 100644 (file)
@@ -603,6 +603,7 @@ class OperatorTestCase:
             if dunder:
                 self.assertIs(dunder, orig)
 
+    @support.requires_docstrings
     def test_attrgetter_signature(self):
         operator = self.module
         sig = inspect.signature(operator.attrgetter)
@@ -610,6 +611,7 @@ class OperatorTestCase:
         sig = inspect.signature(operator.attrgetter('x', 'z', 'y'))
         self.assertEqual(str(sig), '(obj, /)')
 
+    @support.requires_docstrings
     def test_itemgetter_signature(self):
         operator = self.module
         sig = inspect.signature(operator.itemgetter)
@@ -617,6 +619,7 @@ class OperatorTestCase:
         sig = inspect.signature(operator.itemgetter(2, 3, 5))
         self.assertEqual(str(sig), '(obj, /)')
 
+    @support.requires_docstrings
     def test_methodcaller_signature(self):
         operator = self.module
         sig = inspect.signature(operator.methodcaller)
diff --git a/Misc/NEWS.d/next/Build/2025-04-30-10-23-18.gh-issue-133167.E0jrYJ.rst b/Misc/NEWS.d/next/Build/2025-04-30-10-23-18.gh-issue-133167.E0jrYJ.rst
new file mode 100644 (file)
index 0000000..ee6d5a3
--- /dev/null
@@ -0,0 +1,2 @@
+Fix compilation process with ``--enable-optimizations`` and
+``--without-docstrings``.