Skip to content

Commit 3a46167

Browse files
committed
allow trailing comma in version_many
1 parent 9fea6ca commit 3a46167

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

source/specifications/dependency-specifiers.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ URI is defined in :rfc:`std-66 <3986>`)::
6666
version_cmp = wsp* '<' | '<=' | '!=' | '==' | '>=' | '>' | '~=' | '==='
6767
version = wsp* ( letterOrDigit | '-' | '_' | '.' | '*' | '+' | '!' )+
6868
version_one = version_cmp version wsp*
69-
version_many = version_one (wsp* ',' version_one)*
69+
version_many = version_one (',' version_one)* (',' wsp*)?
7070
versionspec = ( '(' version_many ')' ) | version_many
7171
urlspec = '@' wsp* <URI_reference>
7272

@@ -303,7 +303,7 @@ The complete parsley grammar::
303303
version_cmp = wsp* <'<=' | '<' | '!=' | '==' | '>=' | '>' | '~=' | '==='>
304304
version = wsp* <( letterOrDigit | '-' | '_' | '.' | '*' | '+' | '!' )+>
305305
version_one = version_cmp:op version:v wsp* -> (op, v)
306-
version_many = version_one:v1 (wsp* ',' version_one)*:v2 -> [v1] + v2
306+
version_many = version_one:v1 (',' version_one)*:v2 (',' wsp*)? -> [v1] + v2
307307
versionspec = ('(' version_many:v ')' ->v) | version_many
308308
urlspec = '@' wsp* <URI_reference>
309309
marker_op = version_cmp | (wsp* 'in') | (wsp* 'not' wsp+ 'in')
@@ -424,6 +424,7 @@ A test program - if the grammar is in a string ``grammar``:
424424
"name",
425425
"name<=1",
426426
"name>=3",
427+
"name>=3,",
427428
"name>=3,<2",
428429
"name@http://foo.com",
429430
"name [fred,bar] @ http://foo.com ; python_version=='2.7'",
@@ -481,6 +482,9 @@ History
481482
``'.'.join(platform.python_version_tuple()[:2])``, to accommodate potential
482483
future versions of Python with 2-digit major and minor versions
483484
(e.g. 3.10). [#future_versions]_
485+
- May 2024: The definition of ``version_many`` was changed to allow trailing
486+
commas, matching with the behavior of the Python implementation that has been
487+
in use since late 2022.
484488

485489

486490
References

0 commit comments

Comments
 (0)