Fix test discovery failure when srcpath contains symlinks#1
Closed
neek78 wants to merge 48 commits into
Closed
Conversation
Improve `hash()` builtin docstring with caveats. Mention its return type and that the value can be expected to change between processes (hash randomization). Why? The `hash` builtin gets reached for and used by a lot of people whether it is the right tool or not. IDEs surface docstrings and people use pydoc and `help(hash)`.
Fixes python#108951 Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com> Co-authored-by: Guido van Rossum <guido@python.org>
…RING_EVENT_*` values from pythongh-146182 (pythongh-148955) python#146182 left an unintended change in the `PY_MONITORING_*` macro values. This change reverts that part to avoid a user visible impact.
…on#148948) Also add a test demonstrating the need for the existing "is oldcls" check. Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
…c state read (python#148990) dead code
…5 decoding (pythonGH-146312) Add `canonical=False` keyword argument to `a2b_base64`, `a2b_base32`, `a2b_base85`, and `a2b_ascii85` (and their `base64` module wrappers). When `canonical=True`, non-canonical encodings are rejected per [RFC 4648 section 3.5](https://datatracker.ietf.org/doc/html/rfc4648.html#section-3.5). This is independent of `strict_mode`. For base85/ascii85, the check also rejects single-character final groups (never produced by a conforming encoder) and verifies partial group padding matches what the encoder would produce. Co-authored-by: Serhiy Storchaka via lots of great code review!
…nput long tail (python#149003) pythongh-141473: Speed up test_communicate_timeout_large_input Replace the slow reader's 30s sleep with a parent-driven wake over a loopback socket so post-timeout communicate() doesn't block waiting for the child to wake on its own. Worst-case runtime: ~30s -> <1s.
…144387) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
And turn on color for the `ast` module CLI.
…d to CFG (python#146456) The add_const() function in flowgraph.c uses a linear search over the consts list to find the index of a constant. After pythongh-126835 moved constant folding from the AST optimizer to the CFG optimizer, this function is now called N times for N inner tuple elements during fold_tuple_of_constants(), resulting in O(N²) total time. Fix by maintaining an auxiliary _Py_hashtable_t that maps object pointers to their indices in the consts list, providing O(1) lookup. For a file with 100,000 constant 2-tuples: - Before: 10.38s (add_const occupies 83.76% of CPU time) - After: 1.48s
Co-authored-by: Stan Ulbrych <stan@python.org>
…ctor loop into helpers (pythonGH-149032) No public API change. Lift the per-iteration select/read/write loop out of Popen._communicate (POSIX) into a module-level _communicate_io_posix(), with small _flush_stdin / _make_input_view / _translate_newlines helpers alongside it. Popen._communicate calls the helper and persists the returned input offset for resume-after-timeout. Retire the private Popen._remaining_time method in favor of module-level _deadline_remaining; all call sites (POSIX and Windows) updated. Defensive behavioural deltas: the stdin and stdout/stderr .close() calls in the I/O loop now swallow BrokenPipeError / OSError, matching __exit__ and the no-input path; previously these were bare. Adds test_communicate_timeout_resume_partial_write to cover _input_offset bookkeeping across TimeoutExpired/resume.
…sted (pythonGH-149001) Clarify in the Authentication keys section that the authkey handshake covers Listener/Client (addressable endpoints) only, not the anonymous pipes behind Pipe() and Queue, and that isolation between same-user processes must be arranged at the OS level.
…one (python#134312) * Specify boolean attribute behavior in parser * Tweak wording and example Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com> * Fix backticks --------- Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Fix the "multiple values for keyword argument" error message used when the function's `__qualname__` cannot be retrieved.
Constant added to Linux 6.16. See the LWN article: https://lwn.net/Articles/1023085/ Co-authored-by: Brian Schubert <brianm.schubert@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
pythonGH-148565) * Document that 's' and 'p' accept bytes and bytearray. * Fix some footnotes. * Clarify that "string" is a byte string. * Fix the module docstring.
… files on Windows (pythonGH-146591) Use ZipFile.extractall() to sanitize file names and extract files. Files with invalid names (e.g. absolute paths) are now skipped. Files containing ".." in the name are no longer skipped.
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com> Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
…to errors (python#137601) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
…dlib2.rst` (python#149036) Co-authored-by: Copilot <copilot@github.com>
…e execution (pythonGH-136212) ContextDecorator and AsyncContextDecorator (and therefore @contextmanager and @asynccontextmanager used as decorators) now detect generator, coroutine, and asynchronous generator functions and emit a wrapper of the matching kind, so the context manager spans iteration or await rather than just the call that constructs the lazy object. Wrapped generators are explicitly closed when iteration ends. For asynchronous generator wrappers, values passed via asend() and exceptions via athrow() are not forwarded to the wrapped generator. AsyncContextDecorator now also accepts synchronous functions and generators, returning an asynchronous wrapper; ContextDecorator remains the recommended choice for those. inspect.isgeneratorfunction(), iscoroutinefunction(), and isasyncgenfunction() now return True for the decorated result when the input is of that kind. --------- Co-authored-by: Gregory P. Smith <greg@krypto.org>
…le locking (pythonGH-137196) Make _find_and_load() acquire the module locks for the full dotted-name chain (parent before child) when loading a nested module, so both threads contend on the same first lock and serialise instead of deadlocking. When acquiring a parent's lock would itself deadlock with another thread that is loading that parent (cross-package circular imports), the parent's lock is skipped and the partially-initialised parent is accepted -- the same policy _lock_unlock_module() already applies on the existing code path -- so concurrent circular imports that worked before continue to work.
…ialized opcode families (pythonGH-148730) * Records the same objects for each member of family before execution * Records derived values when recording the trace * This makes sure that specialization, or deoptimization, does not cause invalid values to be recorded
Fix inverted flamegraph width The inverted view used thread presence as a proxy for self time. This missed self samples on C-level wrapper frames like _run_code, where the node's thread always appears in its children too. Those samples were silently dropped, causing the chart to render narrower than full width. Now uses the explicit self field on each node instead of the thread heuristic.
Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…sing (python#149120) Add note about sentinel objects not supporting subclassing Clarify that sentinel objects do not support subclassing.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
pythongh-149141: Fix test discovery failure when path to src tree contains symlink(s).
📚 Documentation preview 📚: https://cpython-previews--1.org.readthedocs.build/