Skip to content

Commit ac5a9fb

Browse files
committed
Merge pull request #207 in LCL/wolframclientforpython from bugfix/376952-traceback-fix to master
* commit '79402a86ea31c8a301d69593d21b851f8935aa9e': adding .DS_Store to gitignore Revert "adding gitignore" fixing single line traceback chain was not defined adding gitignore
2 parents 733a0e7 + 79402a8 commit ac5a9fb

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ wolframclient/tests/local_config.json
99
.coverage
1010
.vscode
1111
*.code-workspace
12-
/test-reports
12+
/test-reports
13+
.DS_Store

wolframclient/language/traceback.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na
236236
break
237237
source = [force_text(sline, encoding, "replace") for sline in source]
238238

239+
lineno = min(lineno, len(source) - 1)
239240
lower_bound = max(0, lineno - context_lines)
240241
upper_bound = lineno + context_lines
241242

wolframclient/utils/six.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
import datetime
44
import decimal
5+
import itertools
56
import platform
67
import sys
78
import types
8-
import itertools
9+
910
# stripped version of SIX
1011

1112
PY2 = sys.version_info[0] == 2
@@ -57,12 +58,20 @@
5758
memoryview = buffer
5859
buffer_types = (bytearray, memoryview, buffer)
5960

60-
iterable_types = [list, tuple, set, frozenset, types.GeneratorType, itertools.chain, itertools.groupby]
61+
iterable_types = [
62+
list,
63+
tuple,
64+
set,
65+
frozenset,
66+
types.GeneratorType,
67+
itertools.chain,
68+
itertools.groupby,
69+
]
6170
if not PY2:
6271
iterable_types.extend((map, range))
6372

6473
protected_types = tuple(
65-
chain(
74+
itertools.chain(
6675
string_types,
6776
integer_types,
6877
(

0 commit comments

Comments
 (0)