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

PEP 3121, 384 Refactoring applied to xxsubtype module #60052

Closed
RobinSchreiber mannequin opened this issue Sep 2, 2012 · 4 comments
Closed

PEP 3121, 384 Refactoring applied to xxsubtype module #60052

RobinSchreiber mannequin opened this issue Sep 2, 2012 · 4 comments
Labels
extension-modules C modules in the Modules dir performance Performance or resource usage

Comments

@RobinSchreiber
Copy link
Mannequin

RobinSchreiber mannequin commented Sep 2, 2012

BPO 15848
Nosy @abalkin, @vstinner
Files
  • xxsubtype_pep3121-384_v0.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-12-18.00:47:20.540>
    created_at = <Date 2012-09-02.14:29:27.256>
    labels = ['extension-modules', 'performance']
    title = 'PEP 3121, 384 Refactoring applied to xxsubtype module'
    updated_at = <Date 2020-12-18.00:47:20.539>
    user = 'https://bugs.python.org/RobinSchreiber'

    bugs.python.org fields:

    activity = <Date 2020-12-18.00:47:20.539>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-12-18.00:47:20.540>
    closer = 'vstinner'
    components = ['Extension Modules']
    creation = <Date 2012-09-02.14:29:27.256>
    creator = 'Robin.Schreiber'
    dependencies = []
    files = ['27097']
    hgrepos = []
    issue_num = 15848
    keywords = ['pep3121']
    message_count = 4.0
    messages = ['169701', '170069', '372082', '383281']
    nosy_count = 3.0
    nosy_names = ['belopolsky', 'vstinner', 'Robin.Schreiber']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'resource usage'
    url = 'https://bugs.python.org/issue15848'
    versions = ['Python 3.4']

    @RobinSchreiber
    Copy link
    Mannequin Author

    RobinSchreiber mannequin commented Sep 2, 2012

    Changes proposed in PEP-3121 and PEP-384 have now been applied to the xxsubtype module!

    @RobinSchreiber RobinSchreiber mannequin added extension-modules C modules in the Modules dir performance Performance or resource usage labels Sep 2, 2012
    @abalkin
    Copy link
    Member

    abalkin commented Sep 9, 2012

    It looks like your patch will result in reference leaks if type creation fails. I think you should add Py_DECREF(m) before error returns.

    @vstinner
    Copy link
    Member

    The PEP-3121 part is fixed by:

    commit d5cacbb
    Author: Nick Coghlan <ncoghlan@gmail.com>
    Date: Sat May 23 22:24:10 2015 +1000

    PEP-489: Multi-phase extension module initialization
    
    Known limitations of the current implementation:
    
    - documentation changes are incomplete
    - there's a reference leak I haven't tracked down yet
    
    The leak is most visible by running:
    
      ./python -m test -R3:3 test_importlib
    
    However, you can also see it by running:
    
      ./python -X showrefcount
    
    Importing the array or _testmultiphase modules, and
    then deleting them from both sys.modules and the local
    namespace shows significant increases in the total
    number of active references each cycle. By contrast,
    with _testcapi (which continues to use single-phase
    initialisation) the global refcounts stabilise after
    a couple of cycles.
    

    @vstinner
    Copy link
    Member

    See bpo-41111 "[C API] Convert a few stdlib extensions to the limited C API (PEP-384)" for the PEP-384 part.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants