Skip to content
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

Fix Python 3.12 'imp' error #1497

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Tests

on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

env:
PYTHON_LATEST: "3.11"
PYTHON_LATEST: "3.12"

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down
8 changes: 7 additions & 1 deletion thefuck/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ def load_source(name, pathname, _file=None):
module_spec.loader.exec_module(module)
return module
except ImportError:
from imp import load_source
py_version = sys.version_info
major = py_version.major
minor = py_version.minor
if major == 3 and minor < 12:
from imp import load_source
else:
from importlib import load_source


class Settings(dict):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{27,35,36,37,38,39,310,311}
envlist = py{27,35,36,37,38,39,310,311,312}

[testenv]
deps = -rrequirements.txt
Expand Down