[pull] main from RustPython:main#36
Merged
pull[bot] merged 6 commits intosunmy2019:mainfrom Apr 27, 2026
Merged
Conversation
* Update cspell to `v10.0.0` * Force node version to be 24 * Ensure node24 * Disable cache
CPython's staticmethod and classmethod set __func__ and copy wrapper attributes (__doc__, __name__, etc.) only inside __init__ (Objects/funcobject.c::sm_init / cm_init). RustPython did this work in slot_new and again in __init__, so subclasses that override __init__ without calling super().__init__() saw __func__ pointing at the original callable instead of None. Move the callable assignment and the wrapper-attribute copy into Initializer::init; slot_new now just validates the signature and stores None for the callable, matching the CPython contract.
#7698) The behavior already matched CPython (the slot conflict is detected, the __doc__ delete is rejected); only the message text drifted. - "__slots__ conflicts with a class variable" -> drop the stray "a" to match CPython's "conflicts with class variable". - "cannot delete '__doc__' attribute of type 'X'" -> insert "immutable" before "type" to match CPython's wording (CPython surfaces the same phrase even for user-defined classes since the descriptor refuses the delete unconditionally).
* Enforce int_max_str_digits on int-to-str conversions
The str-to-int direction already enforced sys.get_int_max_str_digits()
via bytes_to_int; the int-to-str direction did not. CPython 3.14 enforces
both per PEP 644.
Adds check_int_to_str_digits helper in builtins::int (bit-count fast path
+ digit upper-bound from log10(2)), wired into the four Python-level
entry points: repr, the str fast path in protocol::object, int.__format__
(decimal/n/empty spec only — binary bases x/o/b are exempt per CPython),
and the DecimalD/I/U branches of vm::cformat for both str % and bytes %.
Unmasks 8 expectedFailure tests across test_int (max_str_digits, DoS
prevention, int_from_other_bases — each mirrored in IntSubclass),
test_ast (test_repr_large_input_crash) and test_reprlib (test_numbers).
Boundary cases (4299/4300/4301 digits at limit=4300) match CPython 3.14.4.
* Skip int-to-str DoS test on platforms without time.get_clock_info
The test_denial_of_service_prevented_int_to_str regression test uses
support.Stopwatch, which calls time.get_clock_info('monotonic'). In
RustPython that function is gated to unix/windows targets only, so on
wasm32-wasip1 it surfaces as AttributeError and breaks the wasm-wasi CI.
Guard the test with skipUnless(hasattr(time, 'get_clock_info'), ...) so
it runs everywhere it can and is skipped on wasm.
Also narrow is_decimal_int_format to Number(Case::Lower): 'N' is rejected
by format_int as UnknownFormatCode, so excluding it preserves that error
path instead of intercepting it with the digit-limit check.
* Add TODO: RUSTPYTHON marker to skipUnless reason
scripts/update_lib uses TODO: RUSTPYTHON markers inside unittest
decorator reason strings to identify and migrate custom RustPython
patches across CPython library updates.
* Use expectedFailureIf for wasm get_clock_info gap
skipUnless silently hides the test forever; expectedFailureIf surfaces
unexpected success once RustPython implements time.get_clock_info on
wasm, prompting marker removal.
deque.__reduce__ passed None as the unpickle state, so a deque subclass's __dict__ and __slots__ values were dropped across a pickle round-trip. CPython's deque___reduce___impl (Modules/_collectionsmodule.c::deque___reduce___impl) calls _PyObject_GetState, which returns the dict (or a (dict, slots) tuple) so subclass attributes survive. Replace the placeholder with the result of __getstate__() on the instance. object.__getstate__ already implements the dict / dict+slots protocol, matching _PyObject_GetState.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )