diff options
| author | Paul Ganssle <paul@ganssle.io> | 2017-11-01 17:10:54 -0400 |
|---|---|---|
| committer | Paul Ganssle <paul@ganssle.io> | 2017-12-06 12:43:58 +0000 |
| commit | 396b89803dcef174eca50cde283e2e40da211cf4 (patch) | |
| tree | cc6db0facd72b24b0404004671366b47c89fcc2a /dateutil/parser | |
| parent | c8964ad107c23af4478ec1363e2c81d2216d3cc1 (diff) | |
| download | dateutil-git-396b89803dcef174eca50cde283e2e40da211cf4.tar.gz | |
Make restrictions on sep stricter
Diffstat (limited to 'dateutil/parser')
| -rw-r--r-- | dateutil/parser/isoparser.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/dateutil/parser/isoparser.py b/dateutil/parser/isoparser.py index 0e2025f..77043b4 100644 --- a/dateutil/parser/isoparser.py +++ b/dateutil/parser/isoparser.py @@ -13,6 +13,7 @@ import re __all__ = ["isoparse", "Isoparser"] + class Isoparser(object): def __init__(self, sep='T', default_year=None): """ @@ -23,8 +24,9 @@ class Isoparser(object): The default year to be used as the basis for parsing the uncommon no-year date formats. """ - if len(sep) != 1: - raise ValueError('Separator must be a single character') + if (len(sep) != 1 or ord(sep) >= 128 or sep in '0123456789'): + raise ValueError('Separator must be a single, non-numeric ' + 'ASCII character') self._sep = sep if default_year is not None: |
