Almar Klein added the comment:

Just checking in to point out a possible problem with the code that strips the 
MSVCR dependency from the embedded manifest. The used regexpr is too greedy: 
the first bit can trigger on an earlier "assemblyIdentity" tag, so that after 
the removal the manifest is no longer valid XML. 

The key problem is that the "<assemblyIdentity" and the name attribute are 
allowed to be on a separate lines. To fix this I removed the re.DOTALL flag and 
replaced the second occurrence of ".*?" to also allow newlines: 

  pattern = re.compile(
-     r"""<assemblyIdentity.*?name=("|')Microsoft\."""\
-     r"""VC\d{2}\.CRT("|').*?(/>|</assemblyIdentity>)""",
-     re.DOTALL)
+     r"""<assemblyIdentity.*?name=("|')Microsoft\."""\
+     r"""VC\d{2}\.CRT("|')(.|\r|\r)*?(/>|</assemblyIdentity>)""")

It is well possible that the problem does not causes any problems for the 
intended usage of the code. I'm using the code to strip other DLL's and ran 
into this issue (with tk85.dll to be precise).

- Almar

nosy: +almar

Python tracker <>
Python-bugs-list mailing list

Reply via email to