Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
39d11d3
time: use CLOCK_UPTIME_RAW for monotonic/perf_counter on Apple
moreal Sep 7, 2026
66ba6e1
vm: derive f_lineno lazily instead of tracking prev_line per instruction
moreal Sep 7, 2026
ac82d32
vm: coalesce per-call thread-locals into one FRAME_SLOT_CACHE
moreal Sep 7, 2026
7a11a3b
vm: fold stop/finalizing checks into EVAL_BREAKER
moreal Sep 7, 2026
39d87f2
gc: set the TRACKED bit with a plain store for freshly allocated objects
moreal Sep 7, 2026
eb8b69e
vm: skip thread exception publish when pushing/popping a None exc slot
moreal Sep 7, 2026
1bf9630
vm: allocation-free keyword-call fast path and super() MRO walk
moreal Sep 7, 2026
d269dfb
builtins: cheaper enumerate and zip iteration
moreal Sep 7, 2026
1f71703
_asyncio: cache module objects and use native set/dict operations
moreal Sep 7, 2026
d452905
_json: add native make_encoder (c_make_encoder)
moreal Sep 7, 2026
5c93014
perf: use mimalloc as global allocator for rustpython CLI
moreal Sep 7, 2026
91b2d6b
vm: cap dict/set table shrink and compact holes on resize
moreal Sep 7, 2026
0e4843d
_functools: add native _lru_cache_wrapper
moreal Sep 7, 2026
e99d4a2
sre_engine: ASCII fast path for \d \s \w unicode category checks
moreal Sep 7, 2026
432544f
vm: skip VM attach for no-op generator/coroutine __del__
moreal Sep 7, 2026
1ecde48
_asyncio: skip full __import__ dispatch on module-cache hot path
moreal Sep 7, 2026
bc13f4e
vm: skip VM-attach section in with_vm when already on the current int…
moreal Sep 7, 2026
9eed979
vm: general sys.modules fast path for vm.import
moreal Sep 7, 2026
3b7af91
_asyncio: bypass generic context.run dispatch in task_eager_start
moreal Sep 7, 2026
1e1e759
vm: drop scopeguard::defer! from generator/coroutine resume hot path
moreal Sep 7, 2026
a937132
vm: run generator bodies through the call trampoline
moreal Sep 7, 2026
85ee43c
vm: run a `yield from` chain in one eval loop
moreal Sep 7, 2026
c2603be
vm: reset the oparg prefix when a signal unwinds a frame
moreal Sep 7, 2026
e1cc23a
bytecode: fetch a code unit with one 16-bit acquire load
moreal Sep 7, 2026
b607c75
vm: compute the cache-entry count after dispatch, not before
moreal Sep 7, 2026
08f6b09
vm: move the eval-breaker body out of the dispatch loop
moreal Sep 7, 2026
a775909
vm: always inline the eval stack push/pop primitives
moreal Sep 7, 2026
4053122
vm: carry the instruction fetch state in loop locals
moreal Sep 7, 2026
46dfbbb
bytecode: hoist the instruction array base out of the dispatch loop
moreal Sep 8, 2026
7e7cb53
common: an immortal bit in the refcount word
moreal Sep 8, 2026
53bb614
vm: make the singletons, small ints, interned strings and static type…
moreal Sep 8, 2026
3117c76
codecs: fast-path utf-8 decode, skipping the codec registry round trip
moreal Sep 8, 2026
100c9ba
codecs: fast-path utf-8/ascii/latin-1 encode and ascii/latin-1 decode
moreal Sep 8, 2026
d5a0a34
vm: make the runtime safe for borrowed stack entries
moreal Sep 8, 2026
9c1e562
vm: read consumed stack entries in place instead of owning them
moreal Sep 8, 2026
c4a41b0
vm: turn LOAD_FAST_BORROW into an actual borrow
moreal Sep 8, 2026
52606c3
vm: exact-dict fast path for DICT_MERGE and CALL_FUNCTION_EX kwargs
moreal Sep 8, 2026
3d8f962
vm: skip the recursion guard hashing exact ints inside a tuple
moreal Sep 8, 2026
6786aa5
vm: wire slot descriptors from __slots__ into C-level type slots
moreal Sep 8, 2026
9b9446f
pyexpat: add UseForeignDTD, fix silently swallowed handler exceptions
moreal Sep 8, 2026
656747b
pyexpat: support multi-chunk Parse()/ParseFile() feeds
moreal Sep 8, 2026
92e90d7
frame: stop allocating cold data to close a generator
moreal Sep 8, 2026
6fedae2
function: bind exact args straight into a generator's frame
moreal Sep 8, 2026
08a74b5
frame: drain a dead frame in place instead of moving it out
moreal Sep 8, 2026
96e2ce5
vm: don't raise a TypeError to ask an iterator for its length
moreal Sep 8, 2026
1cf9ac5
gc: track a generator and its frame in one pass
moreal Sep 8, 2026
315fd8b
test: drop stale expectedFailure markers fixed by the pyexpat changes
moreal Sep 8, 2026
80ad27b
pyexpat: drive a single background EventReader for true incremental P…
moreal Sep 8, 2026
87d26a3
pyexpat: add a Sync fallback backend for targets without threads
moreal Sep 8, 2026
73b4344
_pickle: native Pickler, Unpickler and PickleBuffer
moreal Sep 8, 2026
1dcf7eb
_pickle: raise the pickle.find_class audit event
moreal Sep 8, 2026
448e2ca
_pickle: avoid temporary buffers on the save fast paths
moreal Sep 8, 2026
396b46e
pyexpat: make the threaded backend fork-safe
moreal Sep 8, 2026
b27f902
pyexpat: implement name interning via self.intern, matching libexpat
moreal Sep 8, 2026
70cdb65
_elementtree: native Element, SubElement and ParseError
moreal Sep 8, 2026
b589832
_elementtree: native TreeBuilder and XMLParser
moreal Sep 8, 2026
b47ba37
pyexpat: stop rescanning the whole line per position query
moreal Sep 8, 2026
8f177ab
_elementtree: charge Element.__deepcopy__ to the recursion budget
moreal Sep 8, 2026
4297304
pyexpat: don't let a stale NeedMore end a Parse() early
moreal Sep 8, 2026
e138008
dict_inner: fast-path exact-int equality in key_eq
moreal Sep 8, 2026
f53f16b
vm: let the modulus type handle a three-argument pow
moreal Sep 8, 2026
307e38c
decimal: add a native arbitrary-precision decimal engine
moreal Sep 8, 2026
d83425c
_decimal: ship the native engine as decimal's accelerator
moreal Sep 8, 2026
bee10b8
vm: add a feature-gated opcode-pair histogram
moreal Sep 8, 2026
db5048f
vm: let boolean producers run the branch that follows them
moreal Sep 8, 2026
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
_json: add native make_encoder (c_make_encoder)
json.encoder fell back to the pure-Python _make_iterencode because _json
had no make_encoder, making json.dumps ~25x slower than CPython. Implement
the C encoder semantics natively: str/None/bool/int/float/list/tuple/dict
ordering, key coercion and skipkeys, sort_keys via the VM's fallible sort
(comparison errors propagate instead of panicking), circular reference
detection, indent handling, allow_nan, default() fallback with recursion
guard, and CPython's add_note annotations. Removes the now-passing
expectedFailure markers in test_json.

Assisted-by: Claude Code:claude-fable-5-1
  • Loading branch information
moreal committed Sep 13, 2026
commit d45290533553ee4bfdc4420e10449604ce7b8e1a
1 change: 0 additions & 1 deletion Lib/test/test_json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def test_pyjson(self):
'json.encoder')

class TestCTest(CTest):
@unittest.expectedFailure # TODO: RUSTPYTHON
def test_cjson(self):
self.assertEqual(self.json.scanner.make_scanner.__module__, '_json')
self.assertEqual(self.json.decoder.scanstring.__module__, '_json')
Expand Down
5 changes: 0 additions & 5 deletions Lib/test/test_json/test_speedups.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def test_make_encoder(self):
b"\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75",
None)

@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: 'NoneType' object is not callable
def test_bad_str_encoder(self):
# Issue #31505: There shouldn't be an assertion failure in case
# c_make_encoder() receives a bad encoder() argument.
Expand All @@ -63,7 +62,6 @@ def bad_encoder2(*args):
with self.assertRaises(ZeroDivisionError):
enc('spam', 4)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_bad_markers_argument_to_encoder(self):
# https://bugs.python.org/issue45269
with self.assertRaisesRegex(
Expand All @@ -73,7 +71,6 @@ def test_bad_markers_argument_to_encoder(self):
self.json.encoder.c_make_encoder(1, None, None, None, ': ', ', ',
False, False, False)

@unittest.expectedFailure # TODO: RUSTPYTHON; ZeroDivisionError not raised by test
def test_bad_bool_args(self):
def test(name):
self.json.encoder.JSONEncoder(**{name: BadBool()}).encode({'a': 1})
Expand Down Expand Up @@ -119,7 +116,6 @@ def test_current_indent_level(self):
self.assertRaises(TypeError, enc, ['spam', {'ham': 'eggs'}], 3.0)
self.assertRaises(TypeError, enc, ['spam', {'ham': 'eggs'}])

@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: 'NoneType' object is not callable
def test_mutate_dict_items_during_encode(self):
# gh-142831: Clearing the items list via a re-entrant key encoder
# must not cause a use-after-free. BadDict.items() returns a
Expand Down Expand Up @@ -153,7 +149,6 @@ def encode_str(obj):
encoder(BadDict(real=1), 0)
self.assertTrue(cleared)

@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: 'NoneType' object is not callable
def test_mutate_list_during_encode(self):
# gh-142831: Clearing a list mid-iteration via the default
# callback must not cause a use-after-free.
Expand Down
Loading