forked from skulpt/skulpt
-
Notifications
You must be signed in to change notification settings - Fork 6
/
records.txt
16622 lines (16517 loc) · 979 KB
/
records.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
> [email protected] start C:\Users\acbart\Projects\blockpy-edu\skulpt
> node support/run/runfile.js "py3" "src/lib/traceback.py"
Using skulpt.js
-----
import collections
class linecache:
@staticmethod
def getline(filename, lineno, module_globals=None):
return "Apples and bananas"
@staticmethod
def lazycache(filename, globals):
return "Frogs and ketchup"
@staticmethod
def checkcache(filename):
return "Weird ocean city"
import sys
from itertools import islice
__all__ = ['extract_stack', 'extract_tb', 'format_exception',
'format_exception_only', 'format_list', 'format_stack',
'format_tb', 'print_exc', 'format_exc', 'print_exception',
'print_last', 'print_stack', 'print_tb', 'clear_frames',
'FrameSummary', 'StackSummary', 'TracebackException',
'walk_stack', 'walk_tb']
#
# Formatting and printing lists of traceback lines.
#
def print_list(extracted_list, file=None):
if file is None:
file = sys.stderr
for item in StackSummary.from_list(extracted_list).format():
print(item, file=file, end="")
def format_list(extracted_list):
return StackSummary.from_list(extracted_list).format()
#
# Printing and Extracting Tracebacks.
#
def print_tb(tb, limit=None, file=None):
print_list(extract_tb(tb, limit=limit), file=file)
def format_tb(tb, limit=None):
return extract_tb(tb, limit=limit).format()
def extract_tb(tb, limit=None):
return extract(walk_tb(tb), limit=limit)
#
# Exception formatting and output.
#
_cause_message = (
"\nThe above exception was the direct cause "
"of the following exception:\n\n")
_context_message = (
"\nDuring handling of the above exception, "
"another exception occurred:\n\n")
def print_exception(etype, value, tb, limit=None, file=None, chain=True):
# format_exception has ignored etype for some time, and code such as cgitb
# passes in bogus values as a result. For compatibility with such code we
# ignore it here (rather than in the new TracebackException API).
if file is None:
file = sys.stderr
for line in TracebackException(
type(value), value, tb, limit=limit).format(chain=chain):
print(line, file=file, end="")
def format_exception(etype, value, tb, limit=None, chain=True):
# format_exception has ignored etype for some time, and code such as cgitb
# passes in bogus values as a result. For compatibility with such code we
# ignore it here (rather than in the new TracebackException API).
return list(TracebackException(
type(value), value, tb, limit=limit).format(chain=chain))
def format_exception_only(etype, value):
return list(TracebackException(etype, value, None).format_exception_only())
# -- not official API but folk probably use these two functions.
def _format_final_exc_line(etype, value):
valuestr = _some_str(value)
if value is None or not valuestr:
line = "%s\n" % etype
else:
line = "%s: %s\n" % (etype, valuestr)
return line
def _some_str(value):
try:
return str(value)
except:
return '<unprintable %s object>' % type(value).__name__
# --
def print_exc(limit=None, file=None, chain=True):
print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
def format_exc(limit=None, chain=True):
return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))
def print_last(limit=None, file=None, chain=True):
if not hasattr(sys, "last_type"):
raise ValueError("no last exception")
print_exception(sys.last_type, sys.last_value, sys.last_traceback,
limit, file, chain)
#
# Printing and Extracting Stacks.
#
def print_stack(f=None, limit=None, file=None):
if f is None:
f = sys._getframe().f_back
print_list(extract_stack(f, limit=limit), file=file)
def format_stack(f=None, limit=None):
if f is None:
f = sys._getframe().f_back
return format_list(extract_stack(f, limit=limit))
def extract_stack(f=None, limit=None):
if f is None:
f = sys._getframe().f_back
stack = StackSummary.extract(walk_stack(f), limit=limit)
stack.reverse()
return stack
def clear_frames(tb):
"Clear all references to local variables in the frames of a traceback."
while tb is not None:
try:
tb.tb_frame.clear()
except RuntimeError:
# Ignore the exception raised if the frame is still executing.
pass
tb = tb.tb_next
class FrameSummary:
__slots__ = ('filename', 'lineno', 'name', '_line', 'locals')
def __init__(self, filename, lineno, name, *, lookup_line=True,
locals=None, line=None):
self.filename = filename
self.lineno = lineno
self.name = name
self._line = line
if lookup_line:
self.line
self.locals = {k: repr(v) for k, v in locals.items()} if locals else None
def __eq__(self, other):
if isinstance(other, FrameSummary):
return (self.filename == other.filename and
self.lineno == other.lineno and
self.name == other.name and
self.locals == other.locals)
if isinstance(other, tuple):
return (self.filename, self.lineno, self.name, self.line) == other
return NotImplemented
def __getitem__(self, pos):
return (self.filename, self.lineno, self.name, self.line)[pos]
def __iter__(self):
return iter([self.filename, self.lineno, self.name, self.line])
def __repr__(self):
return "<FrameSummary file {filename}, line {lineno} in {name}>".format(
filename=self.filename, lineno=self.lineno, name=self.name)
def __len__(self):
return 4
@property
def line(self):
if self._line is None:
self._line = linecache.getline(self.filename, self.lineno).strip()
return self._line
def walk_stack(f):
if f is None:
f = sys._getframe().f_back.f_back
while f is not None:
yield f, f.f_lineno
f = f.f_back
def walk_tb(tb):
while tb is not None:
yield tb.tb_frame, tb.tb_lineno
tb = tb.tb_next
_RECURSIVE_CUTOFF = 3 # Also hardcoded in traceback.c.
def extract(frame_gen, limit=None, lookup_lines=True, capture_locals=False):
if limit is None:
limit = getattr(sys, 'tracebacklimit', None)
if limit is not None and limit < 0:
limit = 0
if limit is not None:
if limit >= 0:
frame_gen = islice(frame_gen, limit)
else:
frame_gen = collections.deque(frame_gen, maxlen=-limit)
result = StackSummary()
fnames = set()
for f, lineno in frame_gen:
co = f.f_code
filename = f.co_filename #co.co_filename
name = f.co_name #co.co_name
fnames.add(filename)
linecache.lazycache(filename, f.f_globals)
# Must defer line lookups until we have called checkcache.
if capture_locals:
f_locals = f.f_locals
else:
f_locals = None
result.append(FrameSummary(
filename, lineno, name, lookup_line=False, locals=f_locals))
for filename in fnames:
linecache.checkcache(filename)
# If immediate lookup was desired, trigger lookups now.
if lookup_lines:
for f in result:
f.line
return result
class StackSummary(list):
@classmethod
def from_list(klass, a_list):
# While doing a fast-path check for isinstance(a_list, StackSummary) is
# appealing, idlelib.run.cleanup_traceback and other similar code may
# break this by making arbitrary frames plain tuples, so we need to
# check on a frame by frame basis.
result = StackSummary()
for frame in a_list:
if isinstance(frame, FrameSummary):
result.append(frame)
else:
filename, lineno, name, line = frame
result.append(FrameSummary(filename, lineno, name, line=line))
return result
def format(self):
result = []
last_file = None
last_line = None
last_name = None
count = 0
for frame in self:
if (last_file is None or last_file != frame.filename or
last_line is None or last_line != frame.lineno or
last_name is None or last_name != frame.name):
if count > _RECURSIVE_CUTOFF:
count -= _RECURSIVE_CUTOFF
result.append((
' [Previous line repeated {count} more '
'time{s_count}]\n'
).format(count=count, s_count="s" if count > 1 else ""))
last_file = frame.filename
last_line = frame.lineno
last_name = frame.name
count = 0
count += 1
if count > _RECURSIVE_CUTOFF:
continue
row = []
row.append(' File "{}", line {}, in {}\n'.format(
frame.filename, frame.lineno, frame.name))
if frame.line:
row.append(' {}\n'.format(frame.line.strip()))
if frame.locals:
for name, value in sorted(frame.locals.items()):
row.append(' {name} = {value}\n'.format(name=name, value=value))
result.append(''.join(row))
if count > _RECURSIVE_CUTOFF:
count -= _RECURSIVE_CUTOFF
result.append((
' [Previous line repeated {count} more '
'time{s_count}]\n'
).format(count=count, s_count='s' if count > 1 else ''))
return result
class TracebackException:
def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None,
lookup_lines=True, capture_locals=False, _seen=None):
# NB: we need to accept exc_traceback, exc_value, exc_traceback to
# permit backwards compat with the existing API, otherwise we
# need stub thunk objects just to glue it together.
# Handle loops in __cause__ or __context__.
if _seen is None:
_seen = set()
_seen.add(id(exc_value))
# Gracefully handle (the way Python 2.4 and earlier did) the case of
# being called with no type or value (None, None, None).
if (exc_value and exc_value.__cause__ is not None
and id(exc_value.__cause__) not in _seen):
cause = TracebackException(
type(exc_value.__cause__),
exc_value.__cause__,
exc_value.__cause__.__traceback__,
limit=limit,
lookup_lines=False,
capture_locals=capture_locals,
_seen=_seen)
else:
cause = None
if (exc_value and exc_value.__context__ is not None
and id(exc_value.__context__) not in _seen):
context = TracebackException(
type(exc_value.__context__),
exc_value.__context__,
exc_value.__context__.__traceback__,
limit=limit,
lookup_lines=False,
capture_locals=capture_locals,
_seen=_seen)
else:
context = None
self.exc_traceback = exc_traceback
self.__cause__ = cause
self.__context__ = context
self.__suppress_context__ = \
exc_value.__suppress_context__ if exc_value else False
# TODO: locals.
self.stack = StackSummary.extract(
walk_tb(exc_traceback), limit=limit, lookup_lines=lookup_lines,
capture_locals=capture_locals)
self.exc_type = exc_type
# Capture now to permit freeing resources: only complication is in the
# unofficial API _format_final_exc_line
self._str = _some_str(exc_value)
if exc_type and issubclass(exc_type, SyntaxError):
# Handle SyntaxError's specially
self.filename = exc_value.filename
self.lineno = str(exc_value.lineno)
self.text = exc_value.text
self.offset = exc_value.offset
self.msg = exc_value.msg
if lookup_lines:
self._load_lines()
@classmethod
def from_exception(cls, exc, *args, **kwargs):
return cls(type(exc), exc, exc.__traceback__, *args, **kwargs)
def _load_lines(self):
for frame in self.stack:
frame.line
if self.__context__:
self.__context__._load_lines()
if self.__cause__:
self.__cause__._load_lines()
def __eq__(self, other):
return self.__dict__ == other.__dict__
def __str__(self):
return self._str
def format_exception_only(self):
if self.exc_type is None:
yield _format_final_exc_line(None, self._str)
return
stype = self.exc_type.__qualname__
smod = self.exc_type.__module__
if smod not in ("__main__", "builtins"):
stype = smod + '.' + stype
if not issubclass(self.exc_type, SyntaxError):
yield _format_final_exc_line(stype, self._str)
return
# It was a syntax error; show exactly where the problem was found.
filename = self.filename or "<string>"
lineno = str(self.lineno) or '?'
yield ' File "{}", line {}\n'.format(filename, lineno)
badline = self.text
offset = self.offset
if badline is not None:
yield ' {}\n'.format(badline.strip())
if offset is not None:
caretspace = badline.rstrip('\n')
offset = min(len(caretspace), offset) - 1
caretspace = caretspace[:offset].lstrip()
# non-space whitespace (likes tabs) must be kept for alignment
caretspace = ((c.isspace() and c or ' ') for c in caretspace)
yield ' {}^\n'.format(''.join(caretspace))
msg = self.msg or "<no detail available>"
yield "{}: {}\n".format(stype, msg)
def format(self, *, chain=True):
if chain:
if self.__cause__ is not None:
#yield from self.__cause__.format(chain=chain)
for g in self.__cause__.format(chain=chain):
yield g
yield _cause_message
elif (self.__context__ is not None and
not self.__suppress_context__):
#yield from self.__context__.format(chain=chain)
for g in self.__cause__.format(chain=chain):
yield g
yield _context_message
if self.exc_traceback is not None:
yield 'Traceback (most recent call last):\n'
#yield from self.stack.format()
for g in self.stack.format():
yield g
#yield from self.format_exception_only()
for g in self.format_exception_only():
yield g
-----
Parse classmethod.py 8
AST classmethod.py 6
Parse property.py 11
AST property.py 4
Parse staticmethod.py 1
AST staticmethod.py 0
Parse src/lib/traceback.py 79
AST src/lib/traceback.py 41
/* 1 */ $compiledmod = function() {
/* 2 */ var $scope149 = (function($forcegbl) {
/* 3 */ var $wakeFromSuspension = function() {
/* 4 */ var susp = $scope149.$wakingSuspension;
/* 5 */ $scope149.$wakingSuspension = undefined;
/* 6 */ $blk = susp.$blk;
/* 7 */ $loc = susp.$loc;
/* 8 */ $gbl = susp.$gbl;
/* 9 */ $exc = susp.$exc;
/* 10 */ $err = susp.$err;
/* 11 */ $postfinally = susp.$postfinally;
/* 12 */ $currLineNo = susp.$lineno;
/* 13 */ $currColNo = susp.$colno;
/* 14 */ Sk.lastYield = Date.now();
/* 15 */ try {
/* 16 */ $ret = susp.child.resume();
/* 17 */ } catch (err) {
/* 18 */ if (err instanceof Sk.builtin.TimeLimitError) {
/* 19 */ Sk.execStart = Date.now();
/* 20 */ Sk.execPaused = 0
/* 21 */ }
/* 22 */ if (!(err instanceof Sk.builtin.BaseException)) {
/* 23 */ err = new Sk.builtin.ExternalError(err);
/* 24 */ }
/* 25 */ Sk.err = err;
/* 26 */ err.traceback.push({
/* 27 */ lineno: $currLineNo,
/* 28 */ colno: $currColNo,
/* 29 */ filename: 'src/lib/traceback.py',
/* 30 */ scope: '$scope149'
/* 31 */ });
/* 32 */ if ($exc.length > 0) {
/* 33 */ $err = err;
/* 34 */ $blk = $exc.pop();
/* 35 */ } else {
/* 36 */ throw err;
/* 37 */ }
/* 38 */ }
/* 39 */ };
/* 40 */ var $saveSuspension = function($child, $filename, $lineno, $colno) {
/* 41 */ var susp = new Sk.misceval.Suspension();
/* 42 */ susp.child = $child;
/* 43 */ susp.resume = function() {
/* 44 */ $scope149.$wakingSuspension = susp;
/* 45 */ return $scope149();
/* 46 */ };
/* 47 */ susp.data = susp.child.data;
/* 48 */ susp.$blk = $blk;
/* 49 */ susp.$loc = $loc;
/* 50 */ susp.$gbl = $gbl;
/* 51 */ susp.$exc = $exc;
/* 52 */ susp.$err = $err;
/* 53 */ susp.$postfinally = $postfinally;
/* 54 */ susp.$filename = $filename;
/* 55 */ susp.$lineno = $lineno;
/* 56 */ susp.$colno = $colno;
/* 57 */ susp.optional = susp.child.optional;
/* 58 */ susp.$tmps = {};
/* 59 */ return susp;
/* 60 */ };
/* 61 */ var $gbl = $forcegbl || {},
/* 62 */ $blk = 0,
/* 63 */ $exc = [],
/* 64 */ $loc = $gbl,
/* 65 */ $cell = {},
/* 66 */ $err = undefined;
/* 67 */ $loc.__file__ = new Sk.builtins.str('src/lib/traceback.py');
/* 68 */ var $ret = undefined,
/* 69 */ $postfinally = undefined,
/* 70 */ $currLineNo = undefined,
/* 71 */ $currColNo = undefined;
/* 72 */ if (typeof Sk.execStart === 'undefined') {
/* 73 */ Sk.execStart = Date.now();
/* 74 */ Sk.execPaused = 0
/* 75 */ }
/* 76 */ if (typeof Sk.lastYield === 'undefined') {
/* 77 */ Sk.lastYield = Date.now()
/* 78 */ }
/* 79 */ if ($scope149.$wakingSuspension !== undefined) {
/* 80 */ $wakeFromSuspension();
/* 81 */ }
/* 82 */ if (Sk.retainGlobals) {
/* 83 */ if (Sk.globals) {
/* 84 */ $gbl = Sk.globals;
/* 85 */ Sk.globals = $gbl;
/* 86 */ $loc = $gbl;
/* 87 */ $loc.__file__ = new Sk.builtins.str('src/lib/traceback.py');
/* 88 */ } else {
/* 89 */ Sk.globals = $gbl;
/* 90 */ }
/* 91 */ } else {
/* 92 */ Sk.globals = $gbl;
/* 93 */ }
/* 94 */ while (true) {
/* 95 */ try {
/* 96 */ var $dateNow = Date.now();
/* 97 */ if (Sk.execLimit !== null && $dateNow - Sk.execStart - Sk.execPaused > Sk.execLimit) {
/* 98 */ throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())
/* 99 */ }
/* 100 */ if ($dateNow - Sk.lastYield > Sk.yieldLimit) {
/* 101 */ var $susp = $saveSuspension({
/* 102 */ data: {
/* 103 */ type: 'Sk.yield'
/* 104 */ },
/* 105 */ resume: function() {}
/* 106 */ }, 'src/lib/traceback.py', $currLineNo, $currColNo);
/* 107 */ $susp.$blk = $blk;
/* 108 */ $susp.optional = true;
/* 109 */ return $susp;
/* 110 */ }
/* 111 */ switch ($blk) {
/* 112 */ case 0:
/* 113 */ /* --- module entry --- */
/* 114 */ //
/* 115 */ // line 3:
/* 116 */ // import collections
/* 117 */ // ^
/* 118 */ //
/* 119 */
/* 120 */ $currLineNo = Sk.currLineNo = 3;
/* 121 */ $currColNo = Sk.currColNo = 0;
/* 122 */ Sk.currFilename = 'src/lib/traceback.py';
/* 123 */ $ret = Sk.builtin.__import__('collections', $gbl, $loc, [], -1);
/* 124 */ $blk = 1; /* allowing case fallthrough */
/* 125 */ case 1:
/* 126 */ /* --- function return or resume suspension --- */ if ($ret && $ret.$isSuspension) {
/* 127 */ return $saveSuspension($ret, 'src/lib/traceback.py', 3, 0);
/* 128 */ }
/* 129 */ var $module150 = $ret;
/* 130 */ $loc.collections = $module150;
/* 131 */ //
/* 132 */ // line 5:
/* 133 */ // class linecache:
/* 134 */ // ^
/* 135 */ //
/* 136 */
/* 137 */ $currLineNo = Sk.currLineNo = 5;
/* 138 */ $currColNo = Sk.currColNo = 0;
/* 139 */ Sk.currFilename = 'src/lib/traceback.py';
/* 140 */ $scope151.co_name = new Sk.builtins['str']('linecache');
/* 141 */ var $built167 = Sk.misceval.buildClass($gbl, $scope151, 'linecache', [], $cell);
/* 142 */ $loc.linecache = $built167;
/* 143 */ //
/* 144 */ // line 16:
/* 145 */ // import sys
/* 146 */ // ^
/* 147 */ //
/* 148 */
/* 149 */ $currLineNo = Sk.currLineNo = 16;
/* 150 */ $currColNo = Sk.currColNo = 0;
/* 151 */ Sk.currFilename = 'src/lib/traceback.py';
/* 152 */ $ret = Sk.builtin.__import__('sys', $gbl, $loc, [], -1);
/* 153 */ $blk = 2; /* allowing case fallthrough */
/* 154 */ case 2:
/* 155 */ /* --- function return or resume suspension --- */ if ($ret && $ret.$isSuspension) {
/* 156 */ return $saveSuspension($ret, 'src/lib/traceback.py', 16, 0);
/* 157 */ }
/* 158 */ var $module168 = $ret;
/* 159 */ $loc.sys = $module168;
/* 160 */ //
/* 161 */ // line 17:
/* 162 */ // from itertools import islice
/* 163 */ // ^
/* 164 */ //
/* 165 */
/* 166 */ $currLineNo = Sk.currLineNo = 17;
/* 167 */ $currColNo = Sk.currColNo = 0;
/* 168 */ Sk.currFilename = 'src/lib/traceback.py';
/* 169 */ $ret = Sk.builtin.__import__('itertools', $gbl, $loc, ['islice'], -1);
/* 170 */ $blk = 3; /* allowing case fallthrough */
/* 171 */ case 3:
/* 172 */ /* --- function return or resume suspension --- */ if ($ret && $ret.$isSuspension) {
/* 173 */ return $saveSuspension($ret, 'src/lib/traceback.py', 17, 0);
/* 174 */ }
/* 175 */ var $module169 = $ret;
/* 176 */ var $item170 = Sk.abstr.gattr($module169, new Sk.builtin.str('islice'));
/* 177 */ $loc.islice = $item170;
/* 178 */ //
/* 179 */ // line 19:
/* 180 */ // __all__ = ['extract_stack', 'extract_tb', 'format_exception',
/* 181 */ // ^
/* 182 */ //
/* 183 */
/* 184 */ $currLineNo = Sk.currLineNo = 19;
/* 185 */ $currColNo = Sk.currColNo = 0;
/* 186 */ Sk.currFilename = 'src/lib/traceback.py';
/* 187 */ var $elem172 = $scope149.$const171;
/* 188 */ var $elem174 = $scope149.$const173;
/* 189 */ var $elem176 = $scope149.$const175;
/* 190 */ var $elem178 = $scope149.$const177;
/* 191 */ var $elem180 = $scope149.$const179;
/* 192 */ var $elem182 = $scope149.$const181;
/* 193 */ var $elem184 = $scope149.$const183;
/* 194 */ var $elem186 = $scope149.$const185;
/* 195 */ var $elem188 = $scope149.$const187;
/* 196 */ var $elem190 = $scope149.$const189;
/* 197 */ var $elem192 = $scope149.$const191;
/* 198 */ var $elem194 = $scope149.$const193;
/* 199 */ var $elem196 = $scope149.$const195;
/* 200 */ var $elem198 = $scope149.$const197;
/* 201 */ var $elem200 = $scope149.$const199;
/* 202 */ var $elem202 = $scope149.$const201;
/* 203 */ var $elem204 = $scope149.$const203;
/* 204 */ var $elem206 = $scope149.$const205;
/* 205 */ var $elem208 = $scope149.$const207;
/* 206 */ var $loadlist209 = new Sk.builtins['list']([$elem172, $elem174, $elem176, $elem178, $elem180, $elem182, $elem184, $elem186, $elem188, $elem190, $elem192, $elem194, $elem196, $elem198, $elem200, $elem202, $elem204, $elem206, $elem208]);
/* 207 */ $loc.__all__ = $loadlist209;
/* 208 */ //
/* 209 */ // line 30:
/* 210 */ // def print_list(extracted_list, file=None):
/* 211 */ // ^
/* 212 */ //
/* 213 */
/* 214 */ $currLineNo = Sk.currLineNo = 30;
/* 215 */ $currColNo = Sk.currColNo = 0;
/* 216 */ Sk.currFilename = 'src/lib/traceback.py';
/* 217 */ $scope210.co_name = new Sk.builtins['str']('print_list');
/* 218 */ $scope210.$defaults = [Sk.builtin.none.none$];
/* 219 */ $scope210.co_varnames = ['extracted_list', 'file'];
/* 220 */ var $funcobj230 = new Sk.builtins['function']($scope210, $gbl);
/* 221 */ $loc.print_list = $funcobj230;
/* 222 */ //
/* 223 */ // line 37:
/* 224 */ // def format_list(extracted_list):
/* 225 */ // ^
/* 226 */ //
/* 227 */
/* 228 */ $currLineNo = Sk.currLineNo = 37;
/* 229 */ $currColNo = Sk.currColNo = 0;
/* 230 */ Sk.currFilename = 'src/lib/traceback.py';
/* 231 */ $scope231.co_name = new Sk.builtins['str']('format_list');
/* 232 */ $scope231.co_varnames = ['extracted_list'];
/* 233 */ var $funcobj240 = new Sk.builtins['function']($scope231, $gbl);
/* 234 */ $loc.format_list = $funcobj240;
/* 235 */ //
/* 236 */ // line 45:
/* 237 */ // def print_tb(tb, limit=None, file=None):
/* 238 */ // ^
/* 239 */ //
/* 240 */
/* 241 */ $currLineNo = Sk.currLineNo = 45;
/* 242 */ $currColNo = Sk.currColNo = 0;
/* 243 */ Sk.currFilename = 'src/lib/traceback.py';
/* 244 */ $scope241.co_name = new Sk.builtins['str']('print_tb');
/* 245 */ $scope241.$defaults = [Sk.builtin.none.none$, Sk.builtin.none.none$];
/* 246 */ $scope241.co_varnames = ['tb', 'limit', 'file'];
/* 247 */ var $funcobj247 = new Sk.builtins['function']($scope241, $gbl);
/* 248 */ $loc.print_tb = $funcobj247;
/* 249 */ //
/* 250 */ // line 49:
/* 251 */ // def format_tb(tb, limit=None):
/* 252 */ // ^
/* 253 */ //
/* 254 */
/* 255 */ $currLineNo = Sk.currLineNo = 49;
/* 256 */ $currColNo = Sk.currColNo = 0;
/* 257 */ Sk.currFilename = 'src/lib/traceback.py';
/* 258 */ $scope248.co_name = new Sk.builtins['str']('format_tb');
/* 259 */ $scope248.$defaults = [Sk.builtin.none.none$];
/* 260 */ $scope248.co_varnames = ['tb', 'limit'];
/* 261 */ var $funcobj255 = new Sk.builtins['function']($scope248, $gbl);
/* 262 */ $loc.format_tb = $funcobj255;
/* 263 */ //
/* 264 */ // line 53:
/* 265 */ // def extract_tb(tb, limit=None):
/* 266 */ // ^
/* 267 */ //
/* 268 */
/* 269 */ $currLineNo = Sk.currLineNo = 53;
/* 270 */ $currColNo = Sk.currColNo = 0;
/* 271 */ Sk.currFilename = 'src/lib/traceback.py';
/* 272 */ $scope256.co_name = new Sk.builtins['str']('extract_tb');
/* 273 */ $scope256.$defaults = [Sk.builtin.none.none$];
/* 274 */ $scope256.co_varnames = ['tb', 'limit'];
/* 275 */ var $funcobj262 = new Sk.builtins['function']($scope256, $gbl);
/* 276 */ $loc.extract_tb = $funcobj262;
/* 277 */ //
/* 278 */ // line 61:
/* 279 */ // _cause_message = (
/* 280 */ // ^
/* 281 */ //
/* 282 */
/* 283 */ $currLineNo = Sk.currLineNo = 61;
/* 284 */ $currColNo = Sk.currColNo = 0;
/* 285 */ Sk.currFilename = 'src/lib/traceback.py';
/* 286 */ $loc._cause_message = $scope149.$const263;
/* 287 */ //
/* 288 */ // line 65:
/* 289 */ // _context_message = (
/* 290 */ // ^
/* 291 */ //
/* 292 */
/* 293 */ $currLineNo = Sk.currLineNo = 65;
/* 294 */ $currColNo = Sk.currColNo = 0;
/* 295 */ Sk.currFilename = 'src/lib/traceback.py';
/* 296 */ $loc._context_message = $scope149.$const264;
/* 297 */ //
/* 298 */ // line 70:
/* 299 */ // def print_exception(etype, value, tb, limit=None, file=None, chain=True):
/* 300 */ // ^
/* 301 */ //
/* 302 */
/* 303 */ $currLineNo = Sk.currLineNo = 70;
/* 304 */ $currColNo = Sk.currColNo = 0;
/* 305 */ Sk.currFilename = 'src/lib/traceback.py';
/* 306 */ $scope265.co_name = new Sk.builtins['str']('print_exception');
/* 307 */ $scope265.$defaults = [Sk.builtin.none.none$, Sk.builtin.none.none$, Sk.builtin.bool.true$];
/* 308 */ $scope265.co_varnames = ['etype', 'value', 'tb', 'limit', 'file', 'chain'];
/* 309 */ var $funcobj285 = new Sk.builtins['function']($scope265, $gbl);
/* 310 */ $loc.print_exception = $funcobj285;
/* 311 */ //
/* 312 */ // line 82:
/* 313 */ // def format_exception(etype, value, tb, limit=None, chain=True):
/* 314 */ // ^
/* 315 */ //
/* 316 */
/* 317 */ $currLineNo = Sk.currLineNo = 82;
/* 318 */ $currColNo = Sk.currColNo = 0;
/* 319 */ Sk.currFilename = 'src/lib/traceback.py';
/* 320 */ $scope286.co_name = new Sk.builtins['str']('format_exception');
/* 321 */ $scope286.$defaults = [Sk.builtin.none.none$, Sk.builtin.bool.true$];
/* 322 */ $scope286.co_varnames = ['etype', 'value', 'tb', 'limit', 'chain'];
/* 323 */ var $funcobj297 = new Sk.builtins['function']($scope286, $gbl);
/* 324 */ $loc.format_exception = $funcobj297;
/* 325 */ //
/* 326 */ // line 91:
/* 327 */ // def format_exception_only(etype, value):
/* 328 */ // ^
/* 329 */ //
/* 330 */
/* 331 */ $currLineNo = Sk.currLineNo = 91;
/* 332 */ $currColNo = Sk.currColNo = 0;
/* 333 */ Sk.currFilename = 'src/lib/traceback.py';
/* 334 */ $scope298.co_name = new Sk.builtins['str']('format_exception_only');
/* 335 */ $scope298.co_varnames = ['etype', 'value'];
/* 336 */ var $funcobj307 = new Sk.builtins['function']($scope298, $gbl);
/* 337 */ $loc.format_exception_only = $funcobj307;
/* 338 */ //
/* 339 */ // line 98:
/* 340 */ // def _format_final_exc_line(etype, value):
/* 341 */ // ^
/* 342 */ //
/* 343 */
/* 344 */ $currLineNo = Sk.currLineNo = 98;
/* 345 */ $currColNo = Sk.currColNo = 0;
/* 346 */ Sk.currFilename = 'src/lib/traceback.py';
/* 347 */ $scope308.co_name = new Sk.builtins['str']('_format_final_exc_line');
/* 348 */ $scope308.co_varnames = ['etype', 'value'];
/* 349 */ var $funcobj326 = new Sk.builtins['function']($scope308, $gbl);
/* 350 */ $loc._format_final_exc_line = $funcobj326;
/* 351 */ //
/* 352 */ // line 106:
/* 353 */ // def _some_str(value):
/* 354 */ // ^
/* 355 */ //
/* 356 */
/* 357 */ $currLineNo = Sk.currLineNo = 106;
/* 358 */ $currColNo = Sk.currColNo = 0;
/* 359 */ Sk.currFilename = 'src/lib/traceback.py';
/* 360 */ $scope327.co_name = new Sk.builtins['str']('_some_str');
/* 361 */ $scope327.co_varnames = ['value'];
/* 362 */ var $funcobj337 = new Sk.builtins['function']($scope327, $gbl);
/* 363 */ $loc._some_str = $funcobj337;
/* 364 */ //
/* 365 */ // line 114:
/* 366 */ // def print_exc(limit=None, file=None, chain=True):
/* 367 */ // ^
/* 368 */ //
/* 369 */
/* 370 */ $currLineNo = Sk.currLineNo = 114;
/* 371 */ $currColNo = Sk.currColNo = 0;
/* 372 */ Sk.currFilename = 'src/lib/traceback.py';
/* 373 */ $scope338.co_name = new Sk.builtins['str']('print_exc');
/* 374 */ $scope338.$defaults = [Sk.builtin.none.none$, Sk.builtin.none.none$, Sk.builtin.bool.true$];
/* 375 */ $scope338.co_varnames = ['limit', 'file', 'chain'];
/* 376 */ var $funcobj347 = new Sk.builtins['function']($scope338, $gbl);
/* 377 */ $loc.print_exc = $funcobj347;
/* 378 */ //
/* 379 */ // line 118:
/* 380 */ // def format_exc(limit=None, chain=True):
/* 381 */ // ^
/* 382 */ //
/* 383 */
/* 384 */ $currLineNo = Sk.currLineNo = 118;
/* 385 */ $currColNo = Sk.currColNo = 0;
/* 386 */ Sk.currFilename = 'src/lib/traceback.py';
/* 387 */ $scope348.co_name = new Sk.builtins['str']('format_exc');
/* 388 */ $scope348.$defaults = [Sk.builtin.none.none$, Sk.builtin.bool.true$];
/* 389 */ $scope348.co_varnames = ['limit', 'chain'];
/* 390 */ var $funcobj361 = new Sk.builtins['function']($scope348, $gbl);
/* 391 */ $loc.format_exc = $funcobj361;
/* 392 */ //
/* 393 */ // line 122:
/* 394 */ // def print_last(limit=None, file=None, chain=True):
/* 395 */ // ^
/* 396 */ //
/* 397 */
/* 398 */ $currLineNo = Sk.currLineNo = 122;
/* 399 */ $currColNo = Sk.currColNo = 0;
/* 400 */ Sk.currFilename = 'src/lib/traceback.py';
/* 401 */ $scope362.co_name = new Sk.builtins['str']('print_last');
/* 402 */ $scope362.$defaults = [Sk.builtin.none.none$, Sk.builtin.none.none$, Sk.builtin.bool.true$];
/* 403 */ $scope362.co_varnames = ['limit', 'file', 'chain'];
/* 404 */ var $funcobj386 = new Sk.builtins['function']($scope362, $gbl);
/* 405 */ $loc.print_last = $funcobj386;
/* 406 */ //
/* 407 */ // line 133:
/* 408 */ // def print_stack(f=None, limit=None, file=None):
/* 409 */ // ^
/* 410 */ //
/* 411 */
/* 412 */ $currLineNo = Sk.currLineNo = 133;
/* 413 */ $currColNo = Sk.currColNo = 0;
/* 414 */ Sk.currFilename = 'src/lib/traceback.py';
/* 415 */ $scope387.co_name = new Sk.builtins['str']('print_stack');
/* 416 */ $scope387.$defaults = [Sk.builtin.none.none$, Sk.builtin.none.none$, Sk.builtin.none.none$];
/* 417 */ $scope387.co_varnames = ['f', 'limit', 'file'];
/* 418 */ var $funcobj402 = new Sk.builtins['function']($scope387, $gbl);
/* 419 */ $loc.print_stack = $funcobj402;
/* 420 */ //
/* 421 */ // line 140:
/* 422 */ // def format_stack(f=None, limit=None):
/* 423 */ // ^
/* 424 */ //
/* 425 */
/* 426 */ $currLineNo = Sk.currLineNo = 140;
/* 427 */ $currColNo = Sk.currColNo = 0;
/* 428 */ Sk.currFilename = 'src/lib/traceback.py';
/* 429 */ $scope403.co_name = new Sk.builtins['str']('format_stack');
/* 430 */ $scope403.$defaults = [Sk.builtin.none.none$, Sk.builtin.none.none$];
/* 431 */ $scope403.co_varnames = ['f', 'limit'];
/* 432 */ var $funcobj418 = new Sk.builtins['function']($scope403, $gbl);
/* 433 */ $loc.format_stack = $funcobj418;
/* 434 */ //
/* 435 */ // line 147:
/* 436 */ // def extract_stack(f=None, limit=None):
/* 437 */ // ^
/* 438 */ //
/* 439 */
/* 440 */ $currLineNo = Sk.currLineNo = 147;
/* 441 */ $currColNo = Sk.currColNo = 0;
/* 442 */ Sk.currFilename = 'src/lib/traceback.py';
/* 443 */ $scope419.co_name = new Sk.builtins['str']('extract_stack');
/* 444 */ $scope419.$defaults = [Sk.builtin.none.none$, Sk.builtin.none.none$];
/* 445 */ $scope419.co_varnames = ['f', 'limit'];
/* 446 */ var $funcobj439 = new Sk.builtins['function']($scope419, $gbl);
/* 447 */ $loc.extract_stack = $funcobj439;
/* 448 */ //
/* 449 */ // line 156:
/* 450 */ // def clear_frames(tb):
/* 451 */ // ^
/* 452 */ //
/* 453 */
/* 454 */ $currLineNo = Sk.currLineNo = 156;
/* 455 */ $currColNo = Sk.currColNo = 0;
/* 456 */ Sk.currFilename = 'src/lib/traceback.py';
/* 457 */ $scope440.co_name = new Sk.builtins['str']('clear_frames');
/* 458 */ $scope440.co_varnames = ['tb'];
/* 459 */ var $funcobj456 = new Sk.builtins['function']($scope440, $gbl);
/* 460 */ $loc.clear_frames = $funcobj456;
/* 461 */ //
/* 462 */ // line 167:
/* 463 */ // class FrameSummary:
/* 464 */ // ^
/* 465 */ //
/* 466 */
/* 467 */ $currLineNo = Sk.currLineNo = 167;
/* 468 */ $currColNo = Sk.currColNo = 0;
/* 469 */ Sk.currFilename = 'src/lib/traceback.py';
/* 470 */ $scope457.co_name = new Sk.builtins['str']('FrameSummary');
/* 471 */ var $built607 = Sk.misceval.buildClass($gbl, $scope457, 'FrameSummary', [], $cell);
/* 472 */ $loc.FrameSummary = $built607;
/* 473 */ //
/* 474 */ // line 213:
/* 475 */ // def walk_stack(f):
/* 476 */ // ^
/* 477 */ //
/* 478 */
/* 479 */ $currLineNo = Sk.currLineNo = 213;
/* 480 */ $currColNo = Sk.currColNo = 0;
/* 481 */ Sk.currFilename = 'src/lib/traceback.py';
/* 482 */ $scope608.co_name = new Sk.builtins['str']('walk_stack');
/* 483 */ $scope608.co_varnames = ['f'];
/* 484 */ var $gener634 = new Sk.builtins['function']((function() {
/* 485 */ var $origargs = Array.prototype.slice.call(arguments);
/* 486 */ Sk.builtin.pyCheckArgsLen("walk_stack", arguments.length, 1, 1);
/* 487 */ return new Sk.builtins['generator']($scope608, $gbl, $origargs);
/* 488 */ }));
/* 489 */ $loc.walk_stack = $gener634;
/* 490 */ //
/* 491 */ // line 222:
/* 492 */ // def walk_tb(tb):
/* 493 */ // ^
/* 494 */ //
/* 495 */
/* 496 */ $currLineNo = Sk.currLineNo = 222;
/* 497 */ $currColNo = Sk.currColNo = 0;
/* 498 */ Sk.currFilename = 'src/lib/traceback.py';
/* 499 */ $scope635.co_name = new Sk.builtins['str']('walk_tb');
/* 500 */ $scope635.co_varnames = ['tb'];
/* 501 */ var $gener653 = new Sk.builtins['function']((function() {
/* 502 */ var $origargs = Array.prototype.slice.call(arguments);
/* 503 */ Sk.builtin.pyCheckArgsLen("walk_tb", arguments.length, 1, 1);
/* 504 */ return new Sk.builtins['generator']($scope635, $gbl, $origargs);
/* 505 */ }));
/* 506 */ $loc.walk_tb = $gener653;
/* 507 */ //
/* 508 */ // line 229:
/* 509 */ // _RECURSIVE_CUTOFF = 3 # Also hardcoded in traceback.c.
/* 510 */ // ^
/* 511 */ //
/* 512 */
/* 513 */ $currLineNo = Sk.currLineNo = 229;
/* 514 */ $currColNo = Sk.currColNo = 0;
/* 515 */ Sk.currFilename = 'src/lib/traceback.py';
/* 516 */ $loc._RECURSIVE_CUTOFF = $scope149.$const654;
/* 517 */ //