Skip to content

Commit 704a3f8

Browse files
[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 cc39b19) Co-authored-by: sobolevn <[email protected]>
1 parent 0458554 commit 704a3f8

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

Lib/test/support/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1285,8 +1285,8 @@ def _check_docstrings():
12851285
sys.platform != 'win32' and
12861286
not sysconfig.get_config_var('WITH_DOC_STRINGS'))
12871287

1288-
HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None and
1289-
not MISSING_C_DOCSTRINGS)
1288+
HAVE_PY_DOCSTRINGS = _check_docstrings.__doc__ is not None
1289+
HAVE_DOCSTRINGS = (HAVE_PY_DOCSTRINGS and not MISSING_C_DOCSTRINGS)
12901290

12911291
requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS,
12921292
"test requires docstrings")

Lib/test/test_functools.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2770,7 +2770,7 @@ def static_func(arg: int) -> str:
27702770
self.assertEqual(meth.__qualname__, prefix + meth.__name__)
27712771
self.assertEqual(meth.__doc__,
27722772
('My function docstring'
2773-
if support.HAVE_DOCSTRINGS
2773+
if support.HAVE_PY_DOCSTRINGS
27742774
else None))
27752775
self.assertEqual(meth.__annotations__['arg'], int)
27762776

@@ -2862,7 +2862,7 @@ def decorated_classmethod(cls, arg: int) -> str:
28622862
with self.subTest(meth=meth):
28632863
self.assertEqual(meth.__doc__,
28642864
('My function docstring'
2865-
if support.HAVE_DOCSTRINGS
2865+
if support.HAVE_PY_DOCSTRINGS
28662866
else None))
28672867
self.assertEqual(meth.__annotations__['arg'], int)
28682868

@@ -3317,7 +3317,7 @@ def test_access_from_class(self):
33173317
def test_doc(self):
33183318
self.assertEqual(CachedCostItem.cost.__doc__,
33193319
("The cost of the item."
3320-
if support.HAVE_DOCSTRINGS
3320+
if support.HAVE_PY_DOCSTRINGS
33213321
else None))
33223322

33233323
def test_module(self):

Lib/test/test_operator.py

+3
Original file line numberDiff line numberDiff line change
@@ -603,20 +603,23 @@ def test_dunder_is_original(self):
603603
if dunder:
604604
self.assertIs(dunder, orig)
605605

606+
@support.requires_docstrings
606607
def test_attrgetter_signature(self):
607608
operator = self.module
608609
sig = inspect.signature(operator.attrgetter)
609610
self.assertEqual(str(sig), '(attr, /, *attrs)')
610611
sig = inspect.signature(operator.attrgetter('x', 'z', 'y'))
611612
self.assertEqual(str(sig), '(obj, /)')
612613

614+
@support.requires_docstrings
613615
def test_itemgetter_signature(self):
614616
operator = self.module
615617
sig = inspect.signature(operator.itemgetter)
616618
self.assertEqual(str(sig), '(item, /, *items)')
617619
sig = inspect.signature(operator.itemgetter(2, 3, 5))
618620
self.assertEqual(str(sig), '(obj, /)')
619621

622+
@support.requires_docstrings
620623
def test_methodcaller_signature(self):
621624
operator = self.module
622625
sig = inspect.signature(operator.methodcaller)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix compilation process with ``--enable-optimizations`` and
2+
``--without-docstrings``.

0 commit comments

Comments
 (0)