Dan Snider <mr.assume.a...@gmail.com> added the comment:

Not 100% sure if it's appropriate to post this here... so sorry if not. 

So anyway, the _MAX_COLS and _MAX_LINE constants used for `get_argspec` seem 
like they were intended to limit the generated text tips to at most 5 rows, 85 
characters wide, which makes sense, but isn't what happens at all.

Easy to just post an example of how the call signature isn't limited in any 
meaningful way, which can easily lead to a call tip millions of character long 
that obviously cannot be rendered and can maybe cause crashes:

# freshly started repl session
>>> if 1:
        from idlelib.calltips import get_argspec
        G = globals()
        @get_argspec
        def func(x, d=G): pass
        print('len of func signature:', len(func))
        print(f'len(repr(globals())): {len(repr(G)):_} ({len(G)} globals)')

len of func signature: 564
len(repr(globals())): 899 (10 globals)
>>> from numpy import *
>>> if 1:
        from idlelib.calltips import get_argspec
        G = globals()
        @get_argspec
        def func(x, d=G): pass
        print('len of func signature:', len(func))
        print(f'len(repr(globals())): {len(repr(G)):_} ({len(G)} globals)')
...
len of func signature: 45524
len(repr(globals())): 92_488 (604 globals)

----------
nosy: +bup

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35196>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to