@@ -307,7 +307,12 @@ def fix_scaling(root):
307
307
font ['size' ] = round (- 0.75 * size )
308
308
309
309
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
+
310
314
RECURSIONLIMIT_DELTA = 30
315
+
311
316
def install_recursionlimit_wrappers ():
312
317
"""Install wrappers to always add 30 to the recursion limit."""
313
318
# see: bpo-26806
@@ -329,19 +334,17 @@ def setrecursionlimit(*args, **kwargs):
329
334
330
335
return setrecursionlimit .__wrapped__ (limit + RECURSIONLIMIT_DELTA )
331
336
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.""" )
336
340
337
341
@functools .wraps (sys .getrecursionlimit )
338
342
def getrecursionlimit ():
339
343
return getrecursionlimit .__wrapped__ () - RECURSIONLIMIT_DELTA
340
344
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.""" )
345
348
346
349
# add the delta to the default recursion limit, to compensate
347
350
sys .setrecursionlimit (sys .getrecursionlimit () + RECURSIONLIMIT_DELTA )
0 commit comments