mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
PEP 292 classes Template and SafeTemplate are added to the string module.
This patch includes test cases and documentation updates, as well as NEWS file updates. This patch also updates the sre modules so that they don't import the string module, breaking direct circular imports.
This commit is contained in:
parent
c885443479
commit
8bee76106e
7 changed files with 329 additions and 93 deletions
|
@ -217,12 +217,11 @@ SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix)
|
|||
SRE_INFO_CHARSET = 4 # pattern starts with character from given set
|
||||
|
||||
if __name__ == "__main__":
|
||||
import string
|
||||
def dump(f, d, prefix):
|
||||
items = d.items()
|
||||
items.sort(key=lambda a: a[1])
|
||||
for k, v in items:
|
||||
f.write("#define %s_%s %s\n" % (prefix, string.upper(k), v))
|
||||
f.write("#define %s_%s %s\n" % (prefix, k.upper(), v))
|
||||
f = open("sre_constants.h", "w")
|
||||
f.write("""\
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue