Skip to content
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

PEP489 support: multi-phase module initialization, heap based types #307

Merged
merged 44 commits into from
Aug 5, 2024

Commits on May 23, 2024

  1. refactor: one static decl per line

    Sort the constant string decls from the ones to be moved to
    module state.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    f365aff View commit details
    Browse the repository at this point in the history
  2. feat: add struct for module state

    Include methods for initializing, traversing, and clearing it.
    
    Tidy up module method defs w/ constant docstrings.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    c2f31b1 View commit details
    Browse the repository at this point in the history
  3. feat: wire module state into module def

    Use named members for clarity.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    14a68b1 View commit details
    Browse the repository at this point in the history
  4. refactor: return state pointer from 'zic_state_init'

    Tidy spelings for pointer vars.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    7d003c1 View commit details
    Browse the repository at this point in the history
  5. refactor: outline multi-phase initialization

    - Store created objects in the module state first, then copy them
      where they are needed (in the future, into the module's __dict__
      so that Python can use them).
    
    - At this point, the module and the types are still all static.
    
    - Use 'PyModule_AddType' as a clearer statement of intent.  We are
      going to be creating the types on the heap later, and so will have
      their addresses to hand.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    61c3abb View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    de30f27 View commit details
    Browse the repository at this point in the history
  7. feat: add module-state version of 'import_declarations'

    - Stores imported values and flag on the module state struct, rather than
      in global statics.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    f2e6838 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7b092d9 View commit details
    Browse the repository at this point in the history
  9. refactor: use 'PyObject_GetAttrString'

    Drop statics previously used to call 'PyObject_GetAttr'.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    fc38083 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    4f5814d View commit details
    Browse the repository at this point in the history
  11. chore: restore compat w/ Python < 3.10

    The 'PyModule_AddType' API was added in that release.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    6fc0d08 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    6e1387e View commit details
    Browse the repository at this point in the history
  13. refactor: use 'PyDict_GetItemString'

    And remove the static used to call 'PyDict_GetItem'.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    2c4d70c View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    011a705 View commit details
    Browse the repository at this point in the history
  15. refactor: always pass the module to the module-scope functions

    Note that those functions are still ignoring that value:  this is prep
    for the next step, where they will use the '_zic_module_state' machinery
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    5638a90 View commit details
    Browse the repository at this point in the history
  16. refactor: move module-scope functions to end

    Leave forward decls behind FBO type methods.
    
    This step is in preparation for using the '_zic_module_state', rather
    than the global statics.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    f7b2889 View commit details
    Browse the repository at this point in the history
  17. fix: use API to get initialized module from spec

    This is a stopgap, for the statically-initialized module.  It will
    be replaced by 'PyType_GetModuleByDef' once we have multi-phase init
    and heap types in place.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    2b331f9 View commit details
    Browse the repository at this point in the history
  18. refactor: remove statics loaded from 'z.i.declarations'

    Instead, look them up via module state versions.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    8b55439 View commit details
    Browse the repository at this point in the history
  19. chore: cleanups

    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    02f56e0 View commit details
    Browse the repository at this point in the history
  20. refactor: remove global static 'adapter_hooks'

    Look it up instead from module state via type with a new helper,
    '_get_adapter_hooks'.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    c573b27 View commit details
    Browse the repository at this point in the history
  21. refactor: reorder statics above forwards

    Move actual explanatory comment for '_get_adapter_hooks' to its impl.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    80ed5e1 View commit details
    Browse the repository at this point in the history
  22. refactor: disuse static 'SpecificationBaseType'

    Look it up instead from from module state via the type with a new helper,
    '_get_specification_base_class'.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    baf7991 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    1c5e0ea View commit details
    Browse the repository at this point in the history
  24. refactor: multi-phase module init + heap types

    At least one bug remains (some interfaces return a 'member_descriptor'
    for their '__module__').
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    e3f947b View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    0e315d8 View commit details
    Browse the repository at this point in the history
  26. refactor: use 'Py_TPFLAGS_MANAGED_WEAKREF' everywhere

    Drop vestiges of manual 'weakreflist' management.
    
    Rename type structs and methods for consistency.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    4b3e9db View commit details
    Browse the repository at this point in the history
  27. refactor: macros for type flags

    Make them conditional, along with the manual weakreflist managerment,
    on Python < 3.12, which added the 'Py_TPFLAGS_MANAGED_WEAKREF' flag.
    
    Builds and tests pass on 3.11 with this change.
    tseaver committed May 23, 2024
    Configuration menu
    Copy the full SHA
    5de904c View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    c642bb0 View commit details
    Browse the repository at this point in the history

Commits on May 25, 2024

  1. Configuration menu
    Copy the full SHA
    8d9086c View commit details
    Browse the repository at this point in the history

Commits on May 26, 2024

  1. Configuration menu
    Copy the full SHA
    a03b255 View commit details
    Browse the repository at this point in the history

Commits on May 27, 2024

  1. Configuration menu
    Copy the full SHA
    45f086d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2bb0ee6 View commit details
    Browse the repository at this point in the history

Commits on May 28, 2024

  1. Configuration menu
    Copy the full SHA
    bcc27b7 View commit details
    Browse the repository at this point in the history
  2. perf: re-intern hot-path getattr names

    'PyObject_GetAttrString' creates new string objects from 'char*'.
    tseaver committed May 28, 2024
    Configuration menu
    Copy the full SHA
    bc55fcb View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2024

  1. refactor: limit special-case handling to 'InterfaceBase'

    Member descriptor behavior is tricky across Python versions, and across
    static vs. heap-allocated types.  The 'InterfaceBase' base type is a
    singleton, and has a known/desired "implements name".
    tseaver committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    61a84a1 View commit details
    Browse the repository at this point in the history

Commits on Aug 1, 2024

  1. Configuration menu
    Copy the full SHA
    e0558d7 View commit details
    Browse the repository at this point in the history
  2. chore: document version hex usage

    Co-authored-by: David Glick <[email protected]>
    tseaver and davisagli authored Aug 1, 2024
    Configuration menu
    Copy the full SHA
    e173384 View commit details
    Browse the repository at this point in the history
  3. chore: drop use of obscure acronym in comment

    Co-authored-by: David Glick <[email protected]>
    tseaver and davisagli authored Aug 1, 2024
    Configuration menu
    Copy the full SHA
    ee3efff View commit details
    Browse the repository at this point in the history
  4. chore: another acronym bites the dust

    Co-authored-by: David Glick <[email protected]>
    tseaver and davisagli authored Aug 1, 2024
    Configuration menu
    Copy the full SHA
    743903d View commit details
    Browse the repository at this point in the history
  5. chore: fix typos in comments

    Co-authored-by: David Glick <[email protected]>
    tseaver and davisagli authored Aug 1, 2024
    Configuration menu
    Copy the full SHA
    d6f5640 View commit details
    Browse the repository at this point in the history
  6. Merge branch 'tseaver-rework_pep_489' of github.com:zopefoundation/zo…

    …pe.interface into tseaver-rework_pep_489
    tseaver committed Aug 1, 2024
    Configuration menu
    Copy the full SHA
    21603e6 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    25d664a View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    6bb37a5 View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2024

  1. Configuration menu
    Copy the full SHA
    c35f95e View commit details
    Browse the repository at this point in the history