diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-26 06:43:21 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-26 06:43:21 (GMT) |
commit | f3fa308817a578c8809c70f6b24b1c489eeef803 (patch) | |
tree | 69098314e0b7896b62666b1a6e5fc81bb153846b /Lib/pprint.py | |
parent | e6bb7eb27b8b81ed74e5132628ca8e6415baf57e (diff) | |
download | cpython-f3fa308817a578c8809c70f6b24b1c489eeef803.zip cpython-f3fa308817a578c8809c70f6b24b1c489eeef803.tar.gz cpython-f3fa308817a578c8809c70f6b24b1c489eeef803.tar.bz2 |
Issue #23776: Removed asserts from pprint.PrettyPrinter constructor.
Diffstat (limited to 'Lib/pprint.py')
-rw-r--r-- | Lib/pprint.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/pprint.py b/Lib/pprint.py index 9031a0b..fc5395e 100644 --- a/Lib/pprint.py +++ b/Lib/pprint.py @@ -124,9 +124,12 @@ class PrettyPrinter: """ indent = int(indent) width = int(width) - assert indent >= 0, "indent must be >= 0" - assert depth is None or depth > 0, "depth must be > 0" - assert width, "width must be != 0" + if indent < 0: + raise ValueError('indent must be >= 0') + if depth is not None and depth <= 0: + raise ValueError('depth must be > 0') + if not width: + raise ValueError('width must be != 0') self._depth = depth self._indent_per_level = indent self._width = width |