GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Isolate the itertools extension module · Issue #101277 · python/cpython

Isolate the itertools extension module #101277

New issue
Copy link
New issue
Copy link
Closed
Closed
Isolate the itertools extension module#101277
Copy link
Assignees
erlend-aasland
Labels
type-featureA feature request or enhancementA feature request or enhancement

Description

@erlend-aasland
erlend-aasland
opened on Jan 24, 2023
Issue body actions

Feature or enhancement

Following https://github.com/ericsnowcurrently/multi-core-python/wiki/0-The-Plan we need to convert the itertools extension module to use module state.

There are multiple static global type objects:

cpython/Tools/c-analyzer/cpython/globals-to-fix.tsv

Lines 338 to 359 in e244401

Modules/itertoolsmodule.c - _grouper_type -
Modules/itertoolsmodule.c - accumulate_type -
Modules/itertoolsmodule.c - batched_type -
Modules/itertoolsmodule.c - chain_type -
Modules/itertoolsmodule.c - combinations_type -
Modules/itertoolsmodule.c - compress_type -
Modules/itertoolsmodule.c - count_type -
Modules/itertoolsmodule.c - cwr_type -
Modules/itertoolsmodule.c - cycle_type -
Modules/itertoolsmodule.c - dropwhile_type -
Modules/itertoolsmodule.c - filterfalse_type -
Modules/itertoolsmodule.c - groupby_type -
Modules/itertoolsmodule.c - islice_type -
Modules/itertoolsmodule.c - pairwise_type -
Modules/itertoolsmodule.c - permutations_type -
Modules/itertoolsmodule.c - product_type -
Modules/itertoolsmodule.c - repeat_type -
Modules/itertoolsmodule.c - starmap_type -
Modules/itertoolsmodule.c - takewhile_type -
Modules/itertoolsmodule.c - tee_type -
Modules/itertoolsmodule.c - teedataobject_type -
Modules/itertoolsmodule.c - ziplongest_type -

We need to convert these to heap types, add module state, and implement multi-phase init.

See also PEP-687.

I've got an old PR (#24065) that I'm planning on resurrecting. I'll re-submit it as multiple PRs; this is going to be a large change.

For this particular module, it could make sense to add a module state pointer to each type context, for easy and cheap state access.

Linked PRs

  • gh-101277: Isolate itertools, add group and _grouper types to module state #101302
  • gh-101277: Isolate itertools, part 2/4 #101303
  • gh-101277: Isolate itertools, part 3/4 #101304
  • gh-101277: Finalise isolating itertools #101305

Activity

Next
  1. erlend-aasland
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Jan 24, 2023
  2. erlend-aasland
    self-assigned this
    on Jan 24, 2023
  3. sobolevn commented on Jan 24, 2023

    @sobolevn
    sobolevn
    on Jan 24, 2023
    Member
    More actions

    cc @rhettinger as the module owner.

    Reacted by Erlend E. Aasland
  4. erlend-aasland
    added 12 commits that reference this issue on Jan 24, 2023

    pythongh-101277: establish global state

    99406f8

    pythongh-101277: Add groupby and _grouper types to module state

    50410bf

    pythongh-101277: Add cycle type to module state

    98636d2

    pythongh-101277: Add dropwhile type to module state

    54c43a4

    pythongh-101277: Add takewhile type to module state

    2ede7ad

    pythongh-101277: Add starmap type to module state

    aca9ef5

    pythongh-101277: Add combinations and cwr types to module state

    64be5ab

    pythongh-101277: Add permutations type to module state

    8a063a7

    pythongh-101277: Add accumulate type to module state

    19d43d8

    pythongh-101277: Add compress type to module state

    446b751

    pythongh-101277: Add count type to module state

    1d2d93c

    pythongh-101277: Add pairwise type to module state

    38bf6e5
  5. 42 remaining items

  6. erlend-aasland
    added 11 commits that reference this issue on Feb 3, 2023

    pythongh-101277: Add compress type to module state

    e42e834

    pythongh-101277: Add count type to module state

    ecb447f

    pythongh-101277: Add pairwise type to module state

    fb0e18d

    pythongh-101277: Add ziplongest type to module state

    5a27550

    pythongh-101277: Add product type to module state

    8baf0e1

    gh-101277: Port more itertools static types to heap types (#101304)

    de3669e

    pythongh-101277: Add repeat type to module state

    9a4b14c

    pythongh-101277: Add islice type to module state

    a66b888

    pythongh-101277: Add chain type to module state

    d18169b

    pythongh-101277: Add tee type to module state

    e574de1

    pythongh-101277: Add tee data object type to module state

    053b759
  7. carljm
    added a commit that references this issue on Feb 9, 2023

    Merge branch 'main' into inlinecomp2

    be3becc
  8. miss-islington
    added a commit that references this issue on Feb 10, 2023

    gh-101277: Finalise isolating itertools (GH-101305)

    826bf0e
  9. erlend-aasland
    closed this as completedon Feb 10, 2023
  10. carljm
    added a commit that references this issue on Feb 10, 2023

    Merge branch 'main' into inlinecomp2

    36b2917
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @erlend-aasland
    erlend-aasland

Labels

type-featureA feature request or enhancementA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.