Opened 6 years ago
Closed 5 years ago
#16097 closed enhancement (fixed)
Python 3 preparation: Replace Py2 file() builtin by open() builtin
Reported by:  wluebbe  Owned by:  

Priority:  major  Milestone:  sage6.4 
Component:  distribution  Keywords:  python3 
Cc:  Merged in:  
Authors:  André Apitzsch  Reviewers:  Jeroen Demeyer 
Report Upstream:  N/A  Work issues:  
Branch:  60f5622 (Commits)  Commit:  60f5622de6c95451e440c002327a87432e587ed4 
Dependencies:  Stopgaps: 
Description (last modified by )
The Py2 builtin function file()
is gone. It should be replaced with the open()
builtin function.
This ticket is tracked as a dependency of metaticket ticket:16052.
Change History (11)
comment:1 Changed 5 years ago by
 Milestone changed from sage6.2 to sage6.3
comment:2 Changed 5 years ago by
 Milestone changed from sage6.3 to sage6.4
comment:3 Changed 5 years ago by
 Branch set to u/aapitzsch/ticket/16097
 Commit set to 0765f1f2429ea60c3a389c23d9c4cd57ce0b9542
 Status changed from new to needs_review
comment:4 Changed 5 years ago by
 Status changed from needs_review to needs_work
comment:5 Changed 5 years ago by
 Description modified (diff)
comment:6 Changed 5 years ago by
In the few cases where isinstance(data, file)
is used, I actually think such behaviour should be deprecated: force the user to call foo(open(f).read())
instead of foo(open(f))
.
comment:7 followup: ↓ 9 Changed 5 years ago by
The code in lattice_polytope.py
is already deprecated anyway by #15240...
comment:8 Changed 5 years ago by
 Commit changed from 0765f1f2429ea60c3a389c23d9c4cd57ce0b9542 to 60f5622de6c95451e440c002327a87432e587ed4
Branch pushed to git repo; I updated commit sha1. New commits:
60f5622  Revert "replace file by io.IOBase"

comment:9 in reply to: ↑ 7 Changed 5 years ago by
 Reviewers set to Jeroen Demeyer
 Status changed from needs_work to needs_review
comment:10 Changed 5 years ago by
 Created changed from 04/08/14 13:05:29 to 04/08/14 13:05:29
 Modified changed from 10/09/14 19:34:06 to 10/09/14 19:34:06
 Status changed from needs_review to positive_review
comment:11 Changed 5 years ago by
 Branch changed from u/aapitzsch/ticket/16097 to 60f5622de6c95451e440c002327a87432e587ed4
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
In Python 2,
isinstance(f, file)
is not equivalent toisinstance(f, io.IOBase)
.I do give positive_review to the change from
file()
toopen()
.