@@ -380,7 +380,7 @@ def _compare_equal(self, prospective: Version, spec: str) -> bool:
380380 # We need special logic to handle prefix matching
381381 if spec .endswith (".*" ):
382382 # In the case of prefix matching we want to ignore local segment.
383- prospective = Version (prospective .public )
383+ normalized_prospective = canonicalize_version (prospective .public )
384384 # Get the normalized version string ignoring the trailing .*
385385 normalized_spec = canonicalize_version (spec [:- 2 ], strip_trailing_zero = False )
386386 # Split the spec out by dots, and pretend that there is an implicit
@@ -390,20 +390,18 @@ def _compare_equal(self, prospective: Version, spec: str) -> bool:
390390 # Split the prospective version out by dots, and pretend that there
391391 # is an implicit dot in between a release segment and a pre-release
392392 # segment.
393- split_prospective = _version_split (str (prospective ))
393+ split_prospective = _version_split (normalized_prospective )
394+
395+ # 0-pad the prospective version before shortening it to get the correct
396+ # shortened version.
397+ padded_prospective , _ = _pad_version (split_prospective , split_spec )
394398
395399 # Shorten the prospective version to be the same length as the spec
396400 # so that we can determine if the specifier is a prefix of the
397401 # prospective version or not.
398- shortened_prospective = split_prospective [: len (split_spec )]
399-
400- # Pad out our two sides with zeros so that they both equal the same
401- # length.
402- padded_spec , padded_prospective = _pad_version (
403- split_spec , shortened_prospective
404- )
402+ shortened_prospective = padded_prospective [: len (split_spec )]
405403
406- return padded_prospective == padded_spec
404+ return shortened_prospective == split_spec
407405 else :
408406 # Convert our spec string into a Version
409407 spec_version = Version (spec )
0 commit comments