@@ -214,21 +214,21 @@ def _iter_source(lines, *, maxtext=11_000, maxlines=200, showtext=False):
214214 text = text [:500 ] + '...'
215215
216216 if srcinfo .too_much_text (maxtext ):
217- msg = [
218- ' too much text, try to increase MAX_SIZES[MAXTEXT] in cpython/_parser.py' ,
219- f' { filename } starting at line { lno_from } to { lno_to } ' ,
220- f' has code with length { len (text )} greater than { maxtext } :' ,
221- text
222- ]
223- raise Exception ( ' \n ' . join (msg ))
217+ import textwrap
218+ msg = f''' too much text, try to increase MAX_SIZES[MAXTEXT] in cpython/_parser.py
219+ { filename } starting at line { lno_from } to { lno_to }
220+ has code with length { len (text )} greater than { maxtext } :
221+ { text }
222+ '''
223+ raise RuntimeError ( textwrap . dedent (msg ))
224224
225225 if srcinfo .too_much_lines (maxlines ):
226- msg = [
227- ' too much lines, try to increase MAX_SIZES[MAXLINES] in cpython/_parser.py' ,
228- f' { filename } starting at line { lno_from } to { lno_to } ' ,
229- f' has code with number of lines { lno_to - lno_from } greater than { maxlines } :' ,
230- text
231- ]
232- raise Exception ( ' \n ' . join (msg ))
233-
234- raise Exception (f'unmatched text ({ filename } starting at line { lno_from } ):\n { text } ' )
226+ import textwrap
227+ msg = f''' too much lines, try to increase MAX_SIZES[MAXLINES] in cpython/_parser.py
228+ { filename } starting at line { lno_from } to { lno_to }
229+ has code with number of lines { lno_to - lno_from } greater than { maxlines } :
230+ { text }
231+ '''
232+ raise RuntimeError ( textwrap . dedent (msg ))
233+
234+ raise RuntimeError (f'unmatched text ({ filename } starting at line { lno_from } ):\n { text } ' )
0 commit comments