diff --git a/src/poetry/core/packages/utils/utils.py b/src/poetry/core/packages/utils/utils.py index c5d059946..dc6e8e124 100644 --- a/src/poetry/core/packages/utils/utils.py +++ b/src/poetry/core/packages/utils/utils.py @@ -316,7 +316,7 @@ def normalize_python_version_markers( # NOSONAR ands = [] for op, version in or_: # Expand python version - if op == "==" and "*" not in version: + if op == "==" and "*" not in version and version.count(".") < 2: version = "~" + version op = "" diff --git a/tests/packages/utils/test_utils.py b/tests/packages/utils/test_utils.py index 2afc8d3a4..f64550e0d 100644 --- a/tests/packages/utils/test_utils.py +++ b/tests/packages/utils/test_utils.py @@ -134,6 +134,11 @@ def test_convert_markers( 'python_version >= "3.5" and python_full_version != "3.7.6"', ">=3.5,<3.7.6 || >3.7.6", ), + # Full exact version + ( + 'python_full_version == "3.6.1"', + "3.6.1", + ), ], ) def test_get_python_constraint_from_marker(marker: str, constraint: str) -> None: