Skip to content

Commit b8e5110

Browse files
authored
Fix Python3.10/3.11 tomli compatibility (#6449)
* Fix Python 3.9 compatibility by adding future annotations Add 'from __future__ import annotations' to files in pipenv/patched/pip that use Python 3.10+ type annotation syntax (dict | None, list[str]). This allows the code to work on Python 3.9 by deferring annotation evaluation (PEP 563). Fixes #6448 * fix bad import format from vendoring < py3.11 * try addressing bottle/pypiserver errors
1 parent 6a4bdc3 commit b8e5110

File tree

30 files changed

+240
-120
lines changed

30 files changed

+240
-120
lines changed

Pipfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ pyyaml = "==6.0.1"
2828
build = "*"
2929
twine = "*"
3030
semver = "*"
31-
pypiserver = "2.3.2"
3231
zipp = "==3.21.0"
32+
pypiserver = "*"
33+
tomli = "*"
34+
bottle = "*"
35+
legacy-cgi = {version = "*", markers = "python_version >= '3.13'"}
3336

3437
[packages]
3538
pytz = "*"

Pipfile.lock

Lines changed: 185 additions & 117 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

news/6448.bugfix.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix TypeError when using pipenv with Python 3.9 target environments
2+
by adding ``from __future__ import annotations`` to files in
3+
``pipenv/patched/pip`` that use Python 3.10+ type annotation syntax.

pipenv/patched/pip/_internal/commands/cache.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import os
24
import textwrap
35
from optparse import Values

pipenv/patched/pip/_internal/commands/check.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import logging
24
from optparse import Values
35

pipenv/patched/pip/_internal/commands/completion.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import sys
24
import textwrap
35
from optparse import Values

pipenv/patched/pip/_internal/commands/download.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import logging
24
import os
35
from optparse import Values

pipenv/patched/pip/_internal/commands/freeze.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import sys
24
from optparse import Values
35

pipenv/patched/pip/_internal/commands/hash.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import hashlib
24
import logging
35
import sys

pipenv/patched/pip/_internal/commands/help.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from optparse import Values
24

35
from pipenv.patched.pip._internal.cli.base_command import Command

0 commit comments

Comments
 (0)