Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 9fc3670

Browse files
committed
Use six to solve raise from issue in Python 2.7.
1 parent 3041dcb commit 9fc3670

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
package_data={'pydocstyle': ['data/*.txt']},
2929
install_requires=[
3030
'snowballstemmer',
31+
'six',
3132
],
3233
entry_points={
3334
'console_scripts': [

src/pydocstyle/parser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"""Python code parser."""
22

33
import logging
4-
import sys
4+
import six
55
import textwrap
66
import tokenize as tk
7-
from collections import defaultdict
87
from itertools import chain, dropwhile
98
from re import compile as re
109

@@ -277,7 +276,7 @@ def parse(self, filelike, filename):
277276
try:
278277
compile(src, filename, 'exec')
279278
except SyntaxError as error:
280-
raise ParseError() from error
279+
six.raise_from(ParseError(), error)
281280
self.stream = TokenStream(StringIO(src))
282281
self.filename = filename
283282
self.all = None

0 commit comments

Comments
 (0)