Skip to content

Python 3.12 support #632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -xuo pipefail

DOCKER_IMAGE=jmadler/python-future-builder
# XXX: TODO: Perhaps this version shouldn't be hardcoded
version=0.18.3
version=0.18.4

docker build . -t $DOCKER_IMAGE
docker push $DOCKER_IMAGE:latest
Expand Down
6 changes: 6 additions & 0 deletions docs/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
What's New
**********

What's new in version 0.18.4 (2023-10-10)
=========================================
This is a minor bug-fix release containing a number of fixes:

- Fix for Python 3.12's removal of the imp module

What's new in version 0.18.3 (2023-01-13)
=========================================
This is a minor bug-fix release containing a number of fixes:
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved",
"License :: OSI Approved :: MIT License",
"Development Status :: 4 - Beta",
Expand Down
2 changes: 1 addition & 1 deletion src/future/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
__copyright__ = 'Copyright 2013-2019 Python Charmers Pty Ltd'
__ver_major__ = 0
__ver_minor__ = 18
__ver_patch__ = 3
__ver_patch__ = 4
__ver_sub__ = ''
__version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__,
__ver_patch__, __ver_sub__)
32 changes: 0 additions & 32 deletions src/future/backports/test/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# import collections.abc # not present on Py2.7
import re
import subprocess
import imp
import time
try:
import sysconfig
Expand Down Expand Up @@ -341,37 +340,6 @@ def rmtree(path):
if error.errno != errno.ENOENT:
raise

def make_legacy_pyc(source):
"""Move a PEP 3147 pyc/pyo file to its legacy pyc/pyo location.

The choice of .pyc or .pyo extension is done based on the __debug__ flag
value.

:param source: The file system path to the source file. The source file
does not need to exist, however the PEP 3147 pyc file must exist.
:return: The file system path to the legacy pyc file.
"""
pyc_file = imp.cache_from_source(source)
up_one = os.path.dirname(os.path.abspath(source))
legacy_pyc = os.path.join(up_one, source + ('c' if __debug__ else 'o'))
os.rename(pyc_file, legacy_pyc)
return legacy_pyc

def forget(modname):
"""'Forget' a module was ever imported.

This removes the module from sys.modules and deletes any PEP 3147 or
legacy .pyc and .pyo files.
"""
unload(modname)
for dirname in sys.path:
source = os.path.join(dirname, modname + '.py')
# It doesn't matter if they exist or not, unlink all possible
# combinations of PEP 3147 and legacy pyc and pyo files.
unlink(source + 'c')
unlink(source + 'o')
unlink(imp.cache_from_source(source, debug_override=True))
unlink(imp.cache_from_source(source, debug_override=False))

# On some platforms, should not run gui test even if it is allowed
# in `use_resources'.
Expand Down
9 changes: 9 additions & 0 deletions src/future/moves/test/support.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
from __future__ import absolute_import

import sys

from future.standard_library import suspend_hooks
from future.utils import PY3

if PY3:
from test.support import *
if sys.version_info[:2] >= (3, 10):
from test.support.os_helper import (
EnvironmentVarGuard,
TESTFN,
)
from test.support.warnings_helper import check_warnings
else:
__future_module__ = True
with suspend_hooks():
Expand Down
5 changes: 3 additions & 2 deletions src/future/standard_library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@

import sys
import logging
import imp
import contextlib
import types
import copy
import os

Expand All @@ -79,6 +77,9 @@

from future.utils import PY2, PY3

if PY2:
import imp

# The modules that are defined under the same names on Py3 but with
# different contents in a significant way (e.g. submodules) are:
# pickle (fast one)
Expand Down
Loading