Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
452add08
Commit
452add08
authored
Oct 01, 2012
by
Nadeem Vawda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16304: Another performance optimization for BZ2File.
Patch by Serhiy Storchaka.
parent
4524b467
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
Lib/bz2.py
Lib/bz2.py
+3
-6
No files found.
Lib/bz2.py
View file @
452add08
...
...
@@ -159,21 +159,18 @@ class BZ2File(io.BufferedIOBase):
raise
ValueError
(
"I/O operation on closed file"
)
def
_check_can_read
(
self
):
if
self
.
closed
:
raise
ValueError
(
"I/O operation on closed file"
)
if
self
.
_mode
not
in
(
_MODE_READ
,
_MODE_READ_EOF
):
self
.
_check_not_closed
()
raise
io
.
UnsupportedOperation
(
"File not open for reading"
)
def
_check_can_write
(
self
):
if
self
.
closed
:
raise
ValueError
(
"I/O operation on closed file"
)
if
self
.
_mode
!=
_MODE_WRITE
:
self
.
_check_not_closed
()
raise
io
.
UnsupportedOperation
(
"File not open for writing"
)
def
_check_can_seek
(
self
):
if
self
.
closed
:
raise
ValueError
(
"I/O operation on closed file"
)
if
self
.
_mode
not
in
(
_MODE_READ
,
_MODE_READ_EOF
):
self
.
_check_not_closed
()
raise
io
.
UnsupportedOperation
(
"Seeking is only supported "
"on files open for reading"
)
if
not
self
.
_fp
.
seekable
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment