MCPcopy Index your code
hub / github.com/python/cpython / JSONDecodeError

Class JSONDecodeError

Lib/json/decoder.py:20–43  ·  view source on GitHub ↗

Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos

Source from the content-addressed store, hash-verified

18
19
20class JSONDecodeError(ValueError):
21 """Subclass of ValueError with the following additional properties:
22
23 msg: The unformatted error message
24 doc: The JSON document being parsed
25 pos: The start index of doc where parsing failed
26 lineno: The line corresponding to pos
27 colno: The column corresponding to pos
28
29 """
30 # Note that this exception is used from _json
31 def __init__(self, msg, doc, pos):
32 lineno = doc.count('\n', 0, pos) + 1
33 colno = pos - doc.rfind('\n', 0, pos)
34 errmsg = '%s: line %d column %d (char %d)' % (msg, lineno, colno, pos)
35 ValueError.__init__(self, errmsg)
36 self.msg = msg
37 self.doc = doc
38 self.pos = pos
39 self.lineno = lineno
40 self.colno = colno
41
42 def __reduce__(self):
43 return self.__class__, (self.msg, self.doc, self.pos)
44
45
46_CONSTANTS = frozendict({

Callers 7

_decode_uXXXXFunction · 0.85
py_scanstringFunction · 0.85
JSONObjectFunction · 0.85
JSONArrayFunction · 0.85
decodeMethod · 0.85
raw_decodeMethod · 0.85
loadsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…