IndexError in DateTimeParser.parse
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
Research direction
Reproduce the failure with the DateTimeParser example in the issue and inspect arrow/parser.py around parse line 335, where match.group(token) raises IndexError. Compare the malformed fmt and regex match behavior, then verify that the reported input no longer produces this exception and that the resulting behavior is covered by the parser tests.
Written by the indexing model from the issue text.
Description
The below code triggers a list index out of range error when provided a malformed input. This occurs in parse at line 335 in arrow/parser.py.
It seems that when the fmt string is malformed this can lead to a matching error in the regex parsing later in the function.
from arrow.parser import DateTimeParser
import sys
buf = open(sys.argv[1], "rb").read().decode("utf-8")
parser = DateTimeParser()
parser.parse("foo", buf)
Version
1.3.0
POC File
https://github.com/FuturesLab/POC/blob/main/arrow-py/poc-01
How to trigger
python filename.py poc-01
Trace Report
Traceback (most recent call last):
File "rep.py", line 6, in <module>
parser.parse("foo", buf)
File "anon/lib/python3.8/site-packages/arrow/parser.py", line 331, in parse
value = match.group(token)
IndexError: no such group
- Dominant language
- Python
- Stars
- 9.1k
- Forks
- 790
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from arrow-py/arrow
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100