This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author akira
Recipients akira
Date 2014-03-23.22:16:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395613011.22.0.29152070109.issue21041@psf.upfronthosting.co.za>
In-reply-to
Content
`pathlib.PurePath.parents` is a sequence [1] but it rejects negative indexes:

  >>> from pathlib import PurePath
  >>> PurePath('a/b/c').parents[-2]
  Traceback (most recent call last):
  ...
  IndexError: -2

Sequences in Python interpret negative indexes as `len(seq) + i` [2]

I've included the patch that fixes the issue and adds corresponding tests. No documentation changes are needed.

[1]: http://docs.python.org/3/library/pathlib#pathlib.PurePath.parents
[2]: http://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range
History
Date User Action Args
2014-03-23 22:16:51akirasetrecipients: + akira
2014-03-23 22:16:51akirasetmessageid: <1395613011.22.0.29152070109.issue21041@psf.upfronthosting.co.za>
2014-03-23 22:16:51akiralinkissue21041 messages
2014-03-23 22:16:50akiracreate