Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply RUSTPYTHON specific method
  • Loading branch information
ShaharNaveh committed Jul 20, 2025
commit e385ffc7c03e3cdce7ab23416b25784a1839ed8a
14 changes: 14 additions & 0 deletions Lib/json/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ class JSONDecodeError(ValueError):
colno: The column corresponding to pos

"""
# RUSTPYTHON SPECIFIC
@classmethod
def _from_serde(cls, msg, doc, line, col):
pos = 0
# 0-indexed
line -= 1
col -= 1
while line > 0:
i = doc.index('\n', pos)
line -= 1
pos = i
pos += col
return cls(msg, doc, pos)

# Note that this exception is used from _json
def __init__(self, msg, doc, pos):
lineno = doc.count('\n', 0, pos) + 1
Expand Down