File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 1010
1111import os
1212import platform
13+ import re
1314import subprocess
1415import sys
1516import tempfile
@@ -521,7 +522,21 @@ def test_4435():
521522 with pymupdf .open (path ) as document :
522523 page = document [2 ]
523524 print (f'Calling page.get_pixmap().' , flush = 1 )
524- pixmap = page .get_pixmap (alpha = False , dpi = 120 )
525+ if os .environ .get ('PYODIDE_ROOT' ):
526+ # 2025-11-07: Expect alloc failure.
527+ try :
528+ pixmap = page .get_pixmap (alpha = False , dpi = 120 )
529+ except Exception as e :
530+ print (f'Received exception: { type (e )= } : { e } ' )
531+ assert isinstance (e , pymupdf .mupdf .FzErrorSystem ), f'Unrecognised { type (e )= } '
532+ m = re .match ('code=2: malloc [(][0-9]+ bytes[)] failed' , str (e ))
533+ assert m , f'Unrecognised exception text: { e } '
534+ return
535+ else :
536+ # Hopefully this means that mupdf has been fixed.
537+ assert 0 , 'Expected alloc failure on pyodide'
538+ else :
539+ pixmap = page .get_pixmap (alpha = False , dpi = 120 )
525540 print (f'Called page.get_pixmap().' , flush = 1 )
526541 if pymupdf .mupdf_version_tuple < (1 , 27 ):
527542 assert pymupdf .TOOLS .mupdf_warnings () == 'bogus font ascent/descent values (0 / 0)\n ... repeated 9 times...'
You can’t perform that action at this time.
0 commit comments