Skip to content

Commit

Permalink
Update the benchmarks to support Python 3.13 (the "cgi" module was re…
Browse files Browse the repository at this point in the history
…moved in 3.13) (#90)
  • Loading branch information
a-detiste authored Nov 16, 2024
1 parent 89a931c commit c4afb78
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
12 changes: 10 additions & 2 deletions examples/bench/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@

from __future__ import print_function

from cgi import escape
import os
from StringIO import StringIO
import sys
import timeit

try:
from html import escape
except ImportError:
from cgi import escape

try:
from io import StringIO
except ImportError:
from StringIO import StringIO

__all__ = ['clearsilver', 'mako', 'django', 'kid', 'genshi', 'genshi_text',
'simpletal']

Expand Down
14 changes: 11 additions & 3 deletions examples/bench/bigtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@

from __future__ import print_function

import cgi
import sys
import timeit
from StringIO import StringIO
from genshi.builder import tag
from genshi.filters.i18n import Translator
from genshi.filters.tests.i18n import DummyTranslations
from genshi.template import MarkupTemplate, NewTextTemplate

try:
from html import escape
except ImportError:
from cgi import escape

try:
from io import StringIO
except ImportError:
from StringIO import StringIO

try:
from elementtree import ElementTree as et
except ImportError:
Expand Down Expand Up @@ -202,7 +210,7 @@ def test_clearsilver():
hdf = neo_util.HDF()
for i, row in enumerate(table):
for j, c in enumerate(row.values()):
hdf.setValue("rows.%d.cell.%d" % (i, j), cgi.escape(str(c)))
hdf.setValue("rows.%d.cell.%d" % (i, j), escape(str(c)))

cs = neo_cs.CS(hdf)
cs.parseStr("""
Expand Down

0 comments on commit c4afb78

Please sign in to comment.