Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update imp to importlib for py3
  • Loading branch information
Joseph Curtis
Joseph Curtis committed Sep 16, 2020
commit 05bc771c8d8770da5b7e82db77078e6b2fef8146
6 changes: 5 additions & 1 deletion docs/other/auto2to3.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
import argparse
import os
import sys
import imp
# imp was deprecated in python 3.6
if sys.version_info >= (3, 6):
import importlib as imp
else:
import imp
import runpy
from io import StringIO
from pkgutil import ImpImporter, ImpLoader
Expand Down
6 changes: 5 additions & 1 deletion src/future/backports/test/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
# import collections.abc # not present on Py2.7
import re
import subprocess
import imp
# imp was deprecated in python 3.6
if sys.version_info >= (3, 6):
import importlib as imp
else:
import imp
import time
try:
import sysconfig
Expand Down
6 changes: 5 additions & 1 deletion src/future/standard_library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@

import sys
import logging
import imp
# imp was deprecated in python 3.6
if sys.version_info >= (3, 6):
import importlib as imp
else:
import imp
import contextlib
import types
import copy
Expand Down
3 changes: 2 additions & 1 deletion src/past/builtins/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def oct(number):
return '0' + builtins.oct(number)[2:]

raw_input = input
from imp import reload
# imp was deprecated in python 3.6
from importlib import reload
unicode = str
unichr = chr
xrange = range
Expand Down
8 changes: 6 additions & 2 deletions src/past/translation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@
Inspired by and based on ``uprefix`` by Vinay M. Sajip.
"""

import imp
import sys
# imp was deprecated in python 3.6
if sys.version_info >= (3, 6):
import importlib as imp
else:
import imp
import logging
import marshal
import os
import sys
import copy
from lib2to3.pgen2.parse import ParseError
from lib2to3.refactor import RefactoringTool
Expand Down
6 changes: 5 additions & 1 deletion tests/test_future/test_standard_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,11 @@ def test_reload(self):
"""
reload has been moved to the imp module
"""
import imp
# imp was deprecated in python 3.6
if sys.version_info >= (3, 6):
import importlib as imp
else:
import imp
imp.reload(imp)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is causing the CI failure.

self.assertTrue(True)

Expand Down