Patchwork [7,of,7] py3: use open() instead of file() constructor

login
register
mail settings
Submitter Pulkit Goyal
Date June 17, 2017, 12:45 p.m.
Message ID <bfd8dddf91ee12066e6b.1497703525@workspace>
Download mbox | patch
Permalink /patch/21460/
State Accepted
Headers show

Comments

Pulkit Goyal - June 17, 2017, 12:45 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1497699988 -19800
#      Sat Jun 17 17:16:28 2017 +0530
# Node ID bfd8dddf91ee12066e6bda973060aac2a64f82b1
# Parent  46301f911f32d24da71dc25ac9dde01e537e3f24
py3: use open() instead of file() constructor

The file() constructor has been removed in python 3.

Patch

diff --git a/tests/f b/tests/f
--- a/tests/f
+++ b/tests/f
@@ -51,7 +51,7 @@ 
             if opts.type:
                 facts.append('file')
             if opts.hexdump or opts.dump or opts.md5:
-                content = file(f, 'rb').read()
+                content = open(f, 'rb').read()
         elif islink:
             if opts.type:
                 facts.append('link')