Commit b426297b authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #23615: Modules bz2, tarfile and tokenize now can be reloaded with

imp.reload().  Patch by Thomas Kluyver.
parents fbd59794 887e990d
...@@ -9,6 +9,7 @@ __all__ = ["BZ2File", "BZ2Compressor", "BZ2Decompressor", ...@@ -9,6 +9,7 @@ __all__ = ["BZ2File", "BZ2Compressor", "BZ2Decompressor",
__author__ = "Nadeem Vawda <nadeem.vawda@gmail.com>" __author__ = "Nadeem Vawda <nadeem.vawda@gmail.com>"
from builtins import open as _builtin_open
import io import io
import warnings import warnings
...@@ -27,8 +28,6 @@ _MODE_WRITE = 3 ...@@ -27,8 +28,6 @@ _MODE_WRITE = 3
_BUFFER_SIZE = 8192 _BUFFER_SIZE = 8192
_builtin_open = open
class BZ2File(io.BufferedIOBase): class BZ2File(io.BufferedIOBase):
......
...@@ -38,6 +38,7 @@ __credits__ = "Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend." ...@@ -38,6 +38,7 @@ __credits__ = "Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend."
#--------- #---------
# Imports # Imports
#--------- #---------
from builtins import open as bltn_open
import sys import sys
import os import os
import io import io
...@@ -2433,7 +2434,6 @@ def is_tarfile(name): ...@@ -2433,7 +2434,6 @@ def is_tarfile(name):
except TarError: except TarError:
return False return False
bltn_open = open
open = TarFile.open open = TarFile.open
......
...@@ -24,6 +24,7 @@ __author__ = 'Ka-Ping Yee <ping@lfw.org>' ...@@ -24,6 +24,7 @@ __author__ = 'Ka-Ping Yee <ping@lfw.org>'
__credits__ = ('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, ' __credits__ = ('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, '
'Skip Montanaro, Raymond Hettinger, Trent Nelson, ' 'Skip Montanaro, Raymond Hettinger, Trent Nelson, '
'Michael Foord') 'Michael Foord')
from builtins import open as _builtin_open
from codecs import lookup, BOM_UTF8 from codecs import lookup, BOM_UTF8
import collections import collections
from io import TextIOWrapper from io import TextIOWrapper
...@@ -429,8 +430,6 @@ def detect_encoding(readline): ...@@ -429,8 +430,6 @@ def detect_encoding(readline):
return default, [first, second] return default, [first, second]
_builtin_open = open
def open(filename): def open(filename):
"""Open a file in read only mode using the encoding detected by """Open a file in read only mode using the encoding detected by
detect_encoding(). detect_encoding().
......
...@@ -16,6 +16,9 @@ Core and Builtins ...@@ -16,6 +16,9 @@ Core and Builtins
Library Library
------- -------
- Issue #23615: Modules bz2, tarfile and tokenize now can be reloaded with
imp.reload(). Patch by Thomas Kluyver.
- Issue #23605: os.walk() now calls os.scandir() instead of os.listdir(). - Issue #23605: os.walk() now calls os.scandir() instead of os.listdir().
The usage of os.scandir() reduces the number of calls to os.stat(). The usage of os.scandir() reduces the number of calls to os.stat().
Initial patch written by Ben Hoyt. Initial patch written by Ben Hoyt.
......
_orig_open = open from builtins import open as _orig_open
class _BkFile: class _BkFile:
def __init__(self, file, mode, bufsize): def __init__(self, file, mode, bufsize):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment