Skip to content

[pull] main from python:main #66

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 6 commits into from
Apr 5, 2025
Merged

[pull] main from python:main #66

merged 6 commits into from
Apr 5, 2025

Conversation

pull[bot]
Copy link

@pull pull bot commented Apr 5, 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 types module to improve type handling and module structure, with changes to both Python and C implementations

New Features:

  • Add support for importing types from _types module with a fallback mechanism
  • Expand the range of exported type definitions

Enhancements:

  • Restructure the types module to use a more flexible import mechanism from _types
  • Improve type definition and export strategy in both Python and C implementations

Tests:

  • Add comprehensive tests to verify type consistency between C and Python implementations

Chores:

  • Update LLVM version in CI workflows
  • Modify debug offset handling in internal headers

📚 Documentation preview 📚: https://cpython-previews--66.org.readthedocs.build/

@pull pull bot added the ⤵️ pull label Apr 5, 2025
@pull pull bot merged commit ad6a032 into Futurist-Forever:main Apr 5, 2025
Copy link

sourcery-ai bot commented Apr 5, 2025

Reviewer's Guide by Sourcery

This pull request includes several enhancements and fixes across different parts of the CPython project. It refactors the types module for better structure and error handling, implements freelists for PyCFunctionObject and PyCMethodObject to improve performance, updates the LLVM version in the tail-call workflow, filters out POT-Creation-Date lines in msgfmt.py, and adds a debug section for asyncio module offsets. Additionally, it includes minor updates to test files and build configurations.

Updated class diagram for types module

classDiagram
    class types {
        FunctionType
        LambdaType
        CodeType
        MappingProxyType
        SimpleNamespace
        CellType
        GeneratorType
        CoroutineType
        AsyncGeneratorType
        MethodType
        BuiltinFunctionType
        BuiltinMethodType
        WrapperDescriptorType
        MethodWrapperType
        MethodDescriptorType
        ClassMethodDescriptorType
        ModuleType
        TracebackType
        FrameType
        GetSetDescriptorType
        MemberDescriptorType
        GenericAlias
        UnionType
        EllipsisType
        NoneType
        NotImplementedType
        CapsuleType
    }
    note for types "Refactored types module with better structure and error handling."
Loading

File-Level Changes

Change Details Files
Refactors the types.py module to improve its structure and error handling.
  • Adds a try-except block to handle ImportError when importing _types.
  • Defines fallback implementations for various types when _types is not available.
  • Removes unnecessary del statements.
  • Ensures all type definitions are available regardless of the presence of _types.
  • Adds NoneType and NotImplementedType to the list of exported names.
Lib/types.py
Exports static types from the _types module in C.
  • Exports various static types such as AsyncGeneratorType, BuiltinFunctionType, CapsuleType, etc.
  • Uses EXPORT_STATIC_TYPE macro to add type objects to the module.
  • Includes necessary header files for type definitions.
  • Adds assertions to ensure the types are immortal.
Modules/_typesmodule.c
Adds a test case to verify the names in the types module.
  • Adds a test case test_names to Lib/test/test_types.py.
  • Imports the types module twice, once with _types fresh and once with _types blocked.
  • Asserts that the attributes are the same between the c and python implementations.
  • Asserts that all names are accounted for.
Lib/test/test_types.py
Implements a freelist for PyCFunctionObject and PyCMethodObject to improve performance.
  • Adds freelist pop and free operations for PyCFunctionObject and PyCMethodObject.
  • Modifies PyCMethod_New to use the freelist.
  • Modifies meth_dealloc to use the freelist.
  • Updates _PyObject_ClearFreeLists to clear the new freelists.
  • Adds max freelist defines for the new freelists.
Objects/methodobject.c
Include/internal/pycore_freelist_state.h
Objects/object.c
Updates the LLVM version in the tail-call workflow and fixes a macOS runner issue.
  • Updates the LLVM version to 20 in .github/workflows/tail-call.yml.
  • Updates the LLVM version to 20 in the macOS job.
  • Updates the LLVM version to 20 in the Linux job.
  • Updates the LLVM version to 20 in the Windows job.
  • Updates the homebrew path for llvm.
.github/workflows/tail-call.yml
Filters out POT-Creation-Date lines in msgfmt.py to address issue python#131852.
  • Modifies make function in Tools/i18n/msgfmt.py to filter out POT-Creation-Date lines from msgstr.
  • Adds a conditional check to remove lines starting with POT-Creation-Date:.
Tools/i18n/msgfmt.py
Adds a debug section for asyncio module offsets.
  • Adds a Py_AsyncioModuleDebugOffsets struct in Modules/_asynciomodule.c.
  • Defines a GENERATE_DEBUG_SECTION for AsyncioDebug.
  • Includes offsetof definitions for task_name, task_context, and task_state.
Modules/_asynciomodule.c

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.

6 participants