https://github.com/python/cpython/commit/704a3f8c0adc89a8b7f545f4d4be7550213d419c commit: 704a3f8c0adc89a8b7f545f4d4be7550213d419c branch: 3.13 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: sobolevn <m...@sobolevn.me> date: 2025-04-30T14:06:31Z summary:
[3.13] gh-133167: Fix compilation process with `--enable-optimizations` and `--without-docstrings` (GH-133187) (#133207) gh-133167: Fix compilation process with `--enable-optimizations` and `--without-docstrings` (GH-133187) (cherry picked from commit cc39b19f0fca8db0f881ecaf02f88d72d9f93776) Co-authored-by: sobolevn <m...@sobolevn.me> files: A Misc/NEWS.d/next/Build/2025-04-30-10-23-18.gh-issue-133167.E0jrYJ.rst M Lib/test/support/__init__.py M Lib/test/test_functools.py M Lib/test/test_operator.py diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index a21b1e70d70164..f4cc51a9187587 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1285,8 +1285,8 @@ def _check_docstrings(): 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") diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 96001a943f0327..9793df50a3d4a8 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -2770,7 +2770,7 @@ def static_func(arg: int) -> str: 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 @@ def decorated_classmethod(cls, arg: int) -> str: 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 @@ def test_access_from_class(self): 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): diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py index f8eac8dc002636..d90f820052c718 100644 --- a/Lib/test/test_operator.py +++ b/Lib/test/test_operator.py @@ -603,6 +603,7 @@ def test_dunder_is_original(self): 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 @@ def test_attrgetter_signature(self): 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 @@ def test_itemgetter_signature(self): 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 index 00000000000000..ee6d5a3b87995c --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-04-30-10-23-18.gh-issue-133167.E0jrYJ.rst @@ -0,0 +1,2 @@ +Fix compilation process with ``--enable-optimizations`` and +``--without-docstrings``. _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com