You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
msvc9compiler.py: TypeError: can't use a string pattern on a bytes-like object #51805
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/tarekziade'closed_at=<Date2009-12-21.23:45:26.384>created_at=<Date2009-12-21.18:59:17.290>labels= ['type-bug', 'library']
title="msvc9compiler.py: TypeError: can't use a string pattern on a bytes-like object"updated_at=<Date2009-12-21.23:45:26.382>user='https://bugs.python.org/srid'
While building pywin32 with Py3k trunk (not release version), I get this
traceback:
Creating library build\temp.win32-
3.1\Release\win32\src\pywintypes31.lib and object buil
d\temp.win32-3.1\Release\win32\src\pywintypes31.exp
Traceback (most recent call last):
File "setup3.py", line 16, in <module>exec(str(got))
...skipping...
File "<string>", line 2194, in <module>
File
"C:\HOME\as\apy\branches\nightly\build\pyhg_branches_release3_1_maint-
win32-x86-hgti
\core.py", line 149, in setup
dist.run_commands()
File
"C:\HOME\as\apy\branches\nightly\build\pyhg_branches_release3_1_maint-
win32-x86-hgti
\dist.py", line 919, in run_commands
self.run_command(cmd)
File
"C:\HOME\as\apy\branches\nightly\build\pyhg_branches_release3_1_maint-
win32-x86-hgti
\dist.py", line 938, in run_command
cmd_obj.run()
File "<string>", line 619, in run
File
"C:\HOME\as\apy\branches\nightly\build\pyhg_branches_release3_1_maint-
win32-x86-hgti
\command\build.py", line 128, in run
self.run_command(cmd_name)
File
"C:\HOME\as\apy\branches\nightly\build\pyhg_branches_release3_1_maint-
win32-x86-hgti
\cmd.py", line 315, in run_command
self.distribution.run_command(command)
File
"C:\HOME\as\apy\branches\nightly\build\pyhg_branches_release3_1_maint-
win32-x86-hgti
\dist.py", line 938, in run_command
cmd_obj.run()
File
"C:\HOME\as\apy\branches\nightly\build\pyhg_branches_release3_1_maint-
win32-x86-hgti
\command\build_ext.py", line 347, in run
p31-rrun\python\lib\distutils\ccompiler.py", line 791, in
link_shared_object
extra_preargs, extra_postargs, build_temp, target_lang)
File "<string>", line 1384, in link
p31-rrun\python\lib\distutils\msvc9compiler.py", line 663, in link
manifest_buf = re.sub(pattern, "", manifest_buf)
p31-rrun\python\lib\re.py", line 166, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: can't use a string pattern on a bytes-like object
Correction: I found this in branches/release3.1-maint (not trunk - which I
never tried)
skrah commented on Dec 21, 2009
skrahmannequin
Mannequin
More actions
I also raised this issue at the end of bpo-4120 (which is closed).
I'll post the diff here, too.
tarekziade commented on Dec 21, 2009
tarekziademannequin
Mannequin
More actions
Stefan's patch will do the trick. I am adding a test to make sure this
part is covered before I apply the patch
loewis commented on Dec 21, 2009
loewismannequin
Mannequin
More actions
I'd rather prefer if the manifest was opened in text mode. It should be
UTF-8 encoded (although ASCII would work as well).
tarekziade commented on Dec 21, 2009
tarekziademannequin
Mannequin
More actions
sure, that's even simpler. I am adding a test and this simple fix.
Notice that this code could be replaced with some code that uses an xml
parser. I find the regexp patterns a bit inappropriate here because it
removes "<dependentAssembly></dependentAssembly>" in a second call, but
may leave an empty "<dependency></dependency>" as far as I understand
loewis commented on Dec 21, 2009
loewismannequin
Mannequin
More actions
As for using proper XML processing: that would be fine as well.
As for leaving an empty dependency element: in the original report, MAL
says that this is conforming. I found a schema file (from MS) which
agrees, and a textual documentation page that disagrees. The actual
implementation (atleast in Win7) also seems to agree: the loader would
(apparently) recognize the entire manifest even though it had this empty
dependency in it.
tarekziade commented on Dec 21, 2009
tarekziademannequin
Mannequin
More actions
Ok thanks for the detailed info, Martin
I guess we could refactor it to an xml reader/writer if we need to do
more things in the future with these files.
I'll close this issue, as the mentioned problem is now fixed by using a
text mode. The test in test_msvc9compiler will make sure the XML file
gets cleaned up by the regexp.
done in r76993, r76995
backported in r76996 and r76998 so the trunk behaves the same way.
2.6 stays unchanged, and keep using a binary mode.
Activity
srid commentedon Dec 21, 2009
While building pywin32 with Py3k trunk (not release version), I get this
traceback:
srid commentedon Dec 21, 2009
Uh, cmd.exe seemed to have stripped some chars. Here's the full traceback:
http://gist.github.com/261153
srid commentedon Dec 21, 2009
Correction: I found this in branches/release3.1-maint (not trunk - which I
never tried)
skrah commentedon Dec 21, 2009
I also raised this issue at the end of bpo-4120 (which is closed).
I'll post the diff here, too.
tarekziade commentedon Dec 21, 2009
Stefan's patch will do the trick. I am adding a test to make sure this
part is covered before I apply the patch
loewis commentedon Dec 21, 2009
I'd rather prefer if the manifest was opened in text mode. It should be
UTF-8 encoded (although ASCII would work as well).
tarekziade commentedon Dec 21, 2009
sure, that's even simpler. I am adding a test and this simple fix.
Notice that this code could be replaced with some code that uses an xml
parser. I find the regexp patterns a bit inappropriate here because it
removes "<dependentAssembly></dependentAssembly>" in a second call, but
may leave an empty "<dependency></dependency>" as far as I understand
loewis commentedon Dec 21, 2009
As for using proper XML processing: that would be fine as well.
As for leaving an empty dependency element: in the original report, MAL
says that this is conforming. I found a schema file (from MS) which
agrees, and a textual documentation page that disagrees. The actual
implementation (atleast in Win7) also seems to agree: the loader would
(apparently) recognize the entire manifest even though it had this empty
dependency in it.
tarekziade commentedon Dec 21, 2009
Ok thanks for the detailed info, Martin
I guess we could refactor it to an xml reader/writer if we need to do
more things in the future with these files.
I'll close this issue, as the mentioned problem is now fixed by using a
text mode. The test in test_msvc9compiler will make sure the XML file
gets cleaned up by the regexp.
Thanks all !