Fix dmd.py with Python 3
Categories
(Core :: DMD, defect)
Tracking
()
People
(Reporter: mccr8, Unassigned)
References
Details
I tried running dmd.py using python3, but it raised this exception:
osx:~/logs/queue/2 % python3 ~/mc/obj-dbg.noindex/dist/bin/dmd.py test.json.gz
Traceback (most recent call last):
File "/Users/andrewmccreight/mc/obj-dbg.noindex/dist/bin/dmd.py", line 923, in <module>
main()
File "/Users/andrewmccreight/mc/obj-dbg.noindex/dist/bin/dmd.py", line 915, in main
digest = getDigestFromFile(args, args.input_file)
File "/Users/andrewmccreight/mc/obj-dbg.noindex/dist/bin/dmd.py", line 267, in getDigestFromFile
fixStackTraces(inputFile, isZipped, opener)
File "/Users/andrewmccreight/mc/obj-dbg.noindex/dist/bin/dmd.py", line 253, in fixStackTraces
tmpFile.write(fix(line))
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/gzip.py", line 251, in write
raise OSError(errno.EBADF, "write() on read-only GzipFile object")
OSError: [Errno 9] write() on read-only GzipFile object
If I do the same thing, except with "python2" instead of "python3" it works. I looked up the documentation for 2.7 and 3.8 (though it looks like this is using 3.7) for tempfile and gzip and I didn't see any obvious reason why this would break.
Reporter | ||
Comment 1•5 years ago
|
||
The gzip documentation says "The default is the mode of fileobj if discernible; otherwise, the default is 'rb'." so maybe "discernibility" changed in Python 3, whatever that means.
Reporter | ||
Comment 2•5 years ago
|
||
Passing in a mode='wb' argument at least fixes that error, though then I hit a different error "memoryview: a bytes-like object is required, not 'str'", but at least that's an error I'd expect from running under Python3.
Comment 3•5 years ago
|
||
The severity field is not set for this bug.
:njn, could you have a look please?
For more information, please visit auto_nag documentation.
![]() |
||
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 5•5 years ago
|
||
I could land the fix for this particular issue, but it is a tiny patch, so we might as well aggregate more fixes together.
![]() |
||
Comment 6•5 years ago
|
||
Bug 1668903 has a patch so I will dup this bug to that one.
Description
•