@@ -307,7 +307,12 @@ def fix_scaling(root):
307307 font ['size' ] = round (- 0.75 * size )
308308
309309
310+ def fixdoc (fun , text ):
311+ tem = (fun .__doc__ + '\n \n ' ) if fun .__doc__ is not None else ''
312+ fun .__doc__ = tem + textwrap .fill (textwrap .dedent (text ))
313+
310314RECURSIONLIMIT_DELTA = 30
315+
311316def install_recursionlimit_wrappers ():
312317 """Install wrappers to always add 30 to the recursion limit."""
313318 # see: bpo-26806
@@ -329,19 +334,17 @@ def setrecursionlimit(*args, **kwargs):
329334
330335 return setrecursionlimit .__wrapped__ (limit + RECURSIONLIMIT_DELTA )
331336
332- setrecursionlimit .__doc__ += "\n \n " + textwrap .fill (textwrap .dedent (f"""\
333- This IDLE wrapper adds { RECURSIONLIMIT_DELTA } to prevent possible
334- uninterruptible loops.
335- """ ).strip ())
337+ fixdoc (setrecursionlimit , f"""\
338+ This IDLE wrapper adds { RECURSIONLIMIT_DELTA } to prevent possible
339+ uninterruptible loops.""" )
336340
337341 @functools .wraps (sys .getrecursionlimit )
338342 def getrecursionlimit ():
339343 return getrecursionlimit .__wrapped__ () - RECURSIONLIMIT_DELTA
340344
341- getrecursionlimit .__doc__ += "\n \n " + textwrap .fill (textwrap .dedent (f"""\
342- This IDLE wrapper subtracts { RECURSIONLIMIT_DELTA } to compensate for
343- the { RECURSIONLIMIT_DELTA } IDLE adds when setting the limit.
344- """ ).strip ())
345+ fixdoc (getrecursionlimit , f"""\
346+ This IDLE wrapper subtracts { RECURSIONLIMIT_DELTA } to compensate
347+ for the { RECURSIONLIMIT_DELTA } IDLE adds when setting the limit.""" )
345348
346349 # add the delta to the default recursion limit, to compensate
347350 sys .setrecursionlimit (sys .getrecursionlimit () + RECURSIONLIMIT_DELTA )
0 commit comments