Skip to content

[pull] main from python:main #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 11, 2025
Merged

[pull] main from python:main #93

merged 7 commits into from
Mar 11, 2025

Conversation

pull[bot]
Copy link

@pull pull bot commented Mar 11, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Summary by Sourcery

Refactor the pathlib test suite to remove conditional Windows tests and add a new test suite for Windows-specific functionality.

Enhancements:

  • Refactor the pathlib test suite to remove conditional Windows tests.
  • Add a new test suite for Windows-specific functionality.
  • Add a new test suite for testing the read functionality of pathlib.

vstinner and others added 7 commits March 11, 2025 16:33
Use "PyObject*" for METH_O functions to fix an undefined behavior.
…ing.python… (#131096)

* Replace link to historical PEP with current document on typing.python.org

* Update Doc/library/typing.rst

Co-authored-by: Ned Batchelder <[email protected]>

---------

Co-authored-by: Ned Batchelder <[email protected]>
…131016)

Test Windows-flavoured `pathlib.types._JoinablePath` in a dedicated test
module. These tests cover `LexicalWindowsPath`, `PureWindowsPath` and
`WindowsPath`, where `LexicalWindowsPath` is a simple implementation of
`_JoinablePath` for use in tests.
Test `pathlib.types._ReadablePath` in a dedicated test module. These tests
cover `ReadableZipPath`, `ReadableLocalPath` and `Path`, where the former
two classes are implementations of `_ReadablePath` for use in tests.
@pull pull bot added the ⤵️ pull label Mar 11, 2025
@pull pull bot merged commit ad90c5f into webfutureiorepo:main Mar 11, 2025
Copy link

sourcery-ai bot commented Mar 11, 2025

Reviewer's Guide by Sourcery

This pull request includes several changes to the CPython codebase. It refactors clinic files, improves test coverage for pathlib and sys.setprofile, fixes garbage collection issues in asyncio, updates TSAN tests, removes an unnecessary file, and updates clinic tools to handle METH_O functions with custom return converters. It also removes a redundant check in legacy_tracing.c and adds a NEWS entry.

Updated class diagram for clinic function refactoring

classDiagram
    class PyObject {
        +PyObject *self
        +PyObject *arg
    }
    class TkappObject {
        +PyObject *self
        +PyObject *arg
    }
    class arrayobject {
        +PyObject *self
        +PyObject *unused
    }
    class TreeBuilderObject {
        +PyObject *self
        +PyObject *data
    }
    class XMLParserObject {
        +PyObject *self
        +PyObject *data
    }
    class PySetObject {
        +PyObject *so
        +PyObject *other
    }
    class TaskObj {
        +PyObject *self
        +PyObject *result
    }
    class bytesio {
        +PyObject *self
        +PyObject *b
    }
    class PyCursesWindowObject {
        +PyObject *self
        +PyObject *file
    }
    class EVPobject {
        +PyObject *self
        +PyObject *obj
    }
    class PyStructObject {
        +PyObject *self
        +PyObject *buffer
    }
    class PySSLContext {
        +PyObject *self
        +PyObject *filepath
    }
    class PyTypeObject {
        +PyObject *self
        +PyObject *instance
    }
    PyObject <|-- TkappObject
    PyObject <|-- arrayobject
    PyObject <|-- TreeBuilderObject
    PyObject <|-- XMLParserObject
    PyObject <|-- PySetObject
    PyObject <|-- TaskObj
    PyObject <|-- bytesio
    PyObject <|-- PyCursesWindowObject
    PyObject <|-- EVPobject
    PyObject <|-- PyStructObject
    PyObject <|-- PySSLContext
    PyObject <|-- PyTypeObject
Loading

File-Level Changes

Change Details Files
Refactors the clinic files to use _impl suffix for the implementation functions.
  • Renames the implementation functions in the clinic files to use the _impl suffix.
  • Updates the clinic files to call the implementation functions with the _impl suffix.
Modules/clinic/_tkinter.c.h
Modules/clinic/arraymodule.c.h
Modules/clinic/_elementtree.c.h
Modules/clinic/blake2module.c.h
Modules/clinic/bytesio.c.h
Modules/clinic/sha3module.c.h
Modules/clinic/sha1module.c.h
Modules/clinic/md5module.c.h
Modules/clinic/sha2module.c.h
Modules/clinic/_sre/sre.c.h
Modules/clinic/bytearrayobject.c.h
Modules/clinic/bytesobject.c.h
Modules/clinic/dictobject.c.h
Modules/clinic/exceptions.c.h
Modules/clinic/listobject.c.h
Modules/clinic/memoryobject.c.h
Modules/clinic/setobject.c.h
Modules/clinic/tupleobject.c.h
Modules/clinic/typeobject.c.h
Modules/clinic/typevarobject.c.h
Modules/clinic/_asynciomodule.c.h
Modules/clinic/_cursesmodule.c.h
Modules/clinic/_hashopenssl.c.h
Modules/clinic/_io/bufferedio.c.h
Modules/clinic/_io/stringio.c.h
Modules/clinic/_io/textio.c.h
Modules/clinic/_sqlite/connection.c.h
Modules/clinic/_sqlite/cursor.c.h
Modules/clinic/_struct.c.h
Modules/clinic/_ssl.c.h
Python/clinic/bltinmodule.c.h
Python/clinic/context.c.h
Modules/_tkinter.c
Modules/arraymodule.c
Modules/_elementtree.c
Modules/blake2module.c
Modules/_io/bytesio.c
Modules/sha3module.c
Modules/sha1module.c
Modules/md5module.c
Modules/sha2module.c
Modules/_sre/sre.c
Objects/bytearrayobject.c
Objects/bytesobject.c
Objects/dictobject.c
Objects/exceptions.c
Objects/listobject.c
Objects/memoryobject.c
Objects/setobject.c
Objects/tupleobject.c
Objects/typeobject.c
Objects/typevarobject.c
Modules/_asynciomodule.c
Modules/_cursesmodule.c
Modules/_hashopenssl.c
Modules/_io/bufferedio.c
Modules/_io/stringio.c
Modules/_io/textio.c
Modules/_sqlite/connection.c
Modules/_sqlite/cursor.c
Modules/_struct.c
Modules/_ssl.c
Python/bltinmodule.c
Python/context.c
Modules/clinic/_randommodule.c.h
Modules/_collectionsmodule.c
Objects/clinic/_collectionsmodule.c.h
Removes Windows-specific tests from test_pathlib_abc.py and consolidates them in a new file, test_join_windows.py.
  • Removes the test_join_windows and test_div_windows methods from test_pathlib_abc.py.
  • Removes the test_parts_windows, test_parent_windows, test_parents_windows, test_anchor_windows, test_name_windows, test_suffix_windows, test_suffixes_windows, test_stem_windows, test_with_name_windows, test_with_stem_windows, and test_with_suffix_windows methods from test_pathlib_abc.py.
  • Creates a new file, test_join_windows.py, containing the removed Windows-specific tests.
  • Adds tests for with_name and with_stem to test_pathlib.py to cover NTFS alternate data streams.
Lib/test/test_pathlib/test_pathlib_abc.py
Lib/test/test_pathlib/test_pathlib.py
Lib/test/test_pathlib/test_join_windows.py
Adds a new test file, test_read.py, to consolidate tests related to _ReadablePath.
  • Creates a new file, test_read.py, containing tests for _ReadablePath.
  • Adds ZipPathReadTest, LocalPathReadTest, and PathReadTest classes to test_read.py to test different implementations of _ReadablePath.
  • Removes the test_is_readable, test_magic_open, test_iterdir, test_iterdir_nodir, test_iterdir_info, test_glob_common, test_glob_posix, test_glob_windows, test_glob_empty_pattern, test_info_exists, test_info_is_dir, test_info_is_file, and test_info_is_symlink methods from test_pathlib_abc.py.
  • Removes the test_read_text_with_newlines method from test_pathlib_abc.py.
  • Removes the test_walk_topdown, test_walk_prune, and test_walk_bottom_up methods from test_pathlib_abc.py.
  • Removes the test_info_exists_caching, test_info_is_dir_caching, and test_info_is_file_caching methods from test_pathlib_abc.py.
  • Adds the test_info_exists_caching, test_info_is_dir_caching, and test_info_is_file_caching methods to test_pathlib.py.
Lib/test/test_pathlib/test_pathlib_abc.py
Lib/test/test_pathlib/test_pathlib.py
Lib/test/test_pathlib/test_read.py
Lib/test/test_pathlib/support/local_path.py
Lib/test/test_pathlib/support/zip_path.py
Fixes a bug in test_sys_setprofile.py related to CALL_FUNCTION_EX.
  • Adds a test case to test_sys_setprofile.py to cover CALL_FUNCTION_EX.
  • Updates the expected events in the test case to match the actual behavior of CALL_FUNCTION_EX.
Lib/test/test_sys_setprofile.py
Fixes a bug in test_asyncio/test_tasks.py related to garbage collection of tasks.
  • Adds coro.close() to test_tb_logger_not_called_after_cancel to prevent resource warnings.
  • Adds task._log_destroy_pending = False to test_task_context_break to prevent resource warnings.
Lib/test/test_asyncio/test_tasks.py
Adds test_asyncio.test_free_threading to the list of TSAN tests.
  • Adds test_asyncio.test_free_threading to TSAN_TESTS in Lib/test/libregrtest/tsan.py.
Lib/test/libregrtest/tsan.py
Removes the Doc/library/typing.rst file.
  • Removes the Doc/library/typing.rst file.
Doc/library/typing.rst
Updates the parse_args.py file in Tools/clinic to handle METH_O functions with custom return converters.
  • Updates the render_function method to use parser_parameters instead of impl_parameters for the parsing function when METH_O is used with a custom return converter.
  • Updates the render_function method to suppress the declaration of the implementation's parameters as variables in the parsing function when METH_O is used with a custom return converter.
  • Adds the use_pyobject_self method to the ParseArgsCodeGen class to check if the self parameter is a PyObject *.
Tools/clinic/libclinic/parse_args.py
Updates the clanguage.py file in Tools/clinic to handle METH_O functions with custom return converters.
  • Updates the render_function method to use parser_parameters instead of impl_parameters for the parsing function when METH_O is used with a custom return converter.
  • Updates the render_function method to suppress the declaration of the implementation's parameters as variables in the parsing function when METH_O is used with a custom return converter.
Tools/clinic/libclinic/clanguage.py
Updates the test.c file in Lib/test/clinic to handle METH_O functions with custom return converters.
  • Updates the Test_metho_not_default_return_converter function to handle METH_O functions with custom return converters.
Lib/test/clinic.test.c
Updates legacy_tracing.c to remove redundant check for C functions.
  • Removes the check for C functions within PyMethod_Type in sys_profile_call_or_return.
Python/legacy_tracing.c
Adds a NEWS entry for pythonGH-122029. Misc/NEWS.d/next/Core_and_Builtins/2025-03-05-21-52-20.gh-issue-122029.d_z93q.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants