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

Always evaluate markers fresh, without lru_cache. #5373

Merged
merged 2 commits into from
Sep 24, 2022
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 pipenv/vendor/requirementslib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .models.pipfile import Pipfile
from .models.requirements import Requirement

__version__ = "2.0.2"
__version__ = "2.0.3"


logger = logging.getLogger(__name__)
Expand Down
14 changes: 1 addition & 13 deletions pipenv/vendor/requirementslib/models/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import operator
import re
from collections.abc import Mapping, Set
from functools import lru_cache, reduce
from functools import reduce

import pipenv.vendor.attr as attr
from pipenv.vendor.distlib import markers
Expand Down Expand Up @@ -116,7 +116,6 @@ def from_pipfile(cls, name, pipfile):
return combined_marker


@lru_cache(maxsize=1024)
def _tuplize_version(version):
# type: (STRING_TYPE) -> Union[Tuple[()], Tuple[int, ...], Tuple[int, int, str]]
output = []
Expand All @@ -131,7 +130,6 @@ def _tuplize_version(version):
return tuple(output)


@lru_cache(maxsize=1024)
def _format_version(version):
# type: (Tuple[int, ...]) -> STRING_TYPE
if not isinstance(version, str):
Expand All @@ -143,7 +141,6 @@ def _format_version(version):
REPLACE_RANGES = {">": ">=", "<=": "<"}


@lru_cache(maxsize=1024)
def _format_pyspec(specifier):
# type: (Union[STRING_TYPE, Specifier]) -> Specifier
if isinstance(specifier, str):
Expand Down Expand Up @@ -179,7 +176,6 @@ def _format_pyspec(specifier):
return specifier


@lru_cache(maxsize=1024)
def _get_specs(specset):
if specset is None:
return
Expand Down Expand Up @@ -263,7 +259,6 @@ def get_sorted_version_string(version_set):
# TODO: Rename this to something meaningful
# TODO: Add a deprecation decorator and deprecate this -- i'm sure it's used
# in other libraries
@lru_cache(maxsize=1024)
def cleanup_pyspecs(specs, joiner="or"):
specs = normalize_specifier_set(specs)
# for != operator we want to group by version
Expand Down Expand Up @@ -309,7 +304,6 @@ def cleanup_pyspecs(specs, joiner="or"):


# TODO: Rename this to something meaningful
@lru_cache(maxsize=1024)
def fix_version_tuple(version_tuple):
# type: (Tuple[AnyStr, AnyStr]) -> Tuple[AnyStr, AnyStr]
op, version = version_tuple
Expand All @@ -324,7 +318,6 @@ def fix_version_tuple(version_tuple):


# TODO: Rename this to something meaningful, deprecate it (See prior function)
@lru_cache(maxsize=128)
def get_versions(specset, group_by_operator=True):
# type: (Union[Set[Specifier], SpecifierSet], bool) -> List[Tuple[STRING_TYPE, STRING_TYPE]]
specs = [_get_specs(x) for x in list(tuple(specset))]
Expand Down Expand Up @@ -484,7 +477,6 @@ def _markers_contains_key(markers, key):
return False


@lru_cache(maxsize=128)
def get_contained_extras(marker):
"""Collect "extra == ..." operands from a marker.

Expand All @@ -498,7 +490,6 @@ def get_contained_extras(marker):
return extras


@lru_cache(maxsize=1024)
def get_contained_pyversions(marker):
"""Collect all `python_version` operands from a marker."""

Expand Down Expand Up @@ -529,7 +520,6 @@ def get_contained_pyversions(marker):
return versions


@lru_cache(maxsize=128)
def contains_extra(marker):
"""Check whether a marker contains an "extra == ..." operand."""
if not marker:
Expand All @@ -538,7 +528,6 @@ def contains_extra(marker):
return _markers_contains_extra(marker._markers)


@lru_cache(maxsize=128)
def contains_pyversion(marker):
"""Check whether a marker contains a python_version operand."""

Expand Down Expand Up @@ -710,7 +699,6 @@ def normalize_marker_str(marker):
return marker_str.replace('"', "'")


@lru_cache(maxsize=1024)
def marker_from_specifier(spec):
# type: (STRING_TYPE) -> Marker
if not any(spec.startswith(k) for k in Specifier._operators.keys()):
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ptyprocess==0.7.0
pyparsing==3.0.9
python-dotenv==0.19.0
pythonfinder==1.3.1
requirementslib==2.0.2
requirementslib==2.0.3
shellingham==1.5.0
six==1.16.0
termcolor==1.1.0
Expand Down