File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -701,19 +701,20 @@ def test_trigger_leak(self):
701701 parser .ElementDeclHandler = lambda _1 , _2 : None
702702 self .assertRaises (TypeError , parser .Parse , data , True )
703703
704+ @support .skip_if_unlimited_stack_size
705+ @support .skip_emscripten_stack_overflow ()
706+ @support .skip_wasi_stack_overflow ()
704707 def test_deeply_nested_content_model (self ):
705708 data = ('<!DOCTYPE root [\n <!ELEMENT root '
706- + '(a, ' * 200000 + 'a'
707- + ')' * 200000
709+ + '(a, ' * 500000 + 'a'
710+ + ')' * 500000
708711 + '>\n ]>\n <root/>\n ' ).encode ('UTF-8' )
709712
710713 parser = expat .ParserCreate ()
711714 parser .ElementDeclHandler = lambda _1 , _2 : None
712- # This shouldn't crash:
713- try :
714- parser .ParseFile (BytesIO (data ))
715- except RecursionError :
716- pass
715+ with self .assertRaises (RecursionError ):
716+ with support .infinite_recursion ():
717+ parser .ParseFile (BytesIO (data ))
717718
718719class MalformedInputTest (unittest .TestCase ):
719720 def test1 (self ):
Original file line number Diff line number Diff line change 33#endif
44
55#include "Python.h"
6+ #include "pycore_ceval.h" // _Py_EnterRecursiveCall()
67#include "pycore_import.h" // _PyImport_SetModule()
78#include "pycore_pyhash.h" // _Py_HashSecret
89#include "pycore_traceback.h" // _PyTraceback_Add()
@@ -607,7 +608,7 @@ static PyObject *
607608conv_content_model (XML_Content * const model ,
608609 PyObject * (* conv_string )(void * ))
609610{
610- if (Py_EnterRecursiveCall (" in conv_content_model" )) {
611+ if (_Py_EnterRecursiveCall (" in conv_content_model" )) {
611612 return NULL ;
612613 }
613614
@@ -631,7 +632,7 @@ conv_content_model(XML_Content * const model,
631632 conv_string , model -> name , children );
632633 }
633634done :
634- Py_LeaveRecursiveCall ();
635+ _Py_LeaveRecursiveCall ();
635636 return result ;
636637}
637638
You can’t perform that action at this time.
0 commit comments