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

Derby #15: Convert 50 sites to Argument Clinic across 9 files #64351

Closed
brettcannon opened this issue Jan 6, 2014 · 35 comments
Closed

Derby #15: Convert 50 sites to Argument Clinic across 9 files #64351

brettcannon opened this issue Jan 6, 2014 · 35 comments
Assignees
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@brettcannon
Copy link
Member

BPO 20152
Nosy @loewis, @brettcannon, @larryhastings, @serhiy-storchaka
Files
  • import_ac.diff
  • grp_derby.diff: grp module converted to Argument Clinic
  • spwd_derby.diff: spwd converted to Argument Clinic
  • pwd_derby.diff: pwd converted to Argument Clinic
  • fcntl_derby.diff: fcntl converted to Argument Clinic (except for ioctl)
  • pyexpat_derby.diff: pyexpat converted, relying on default self converter
  • multibytecodec_derby.diff: multibytecodec with default self converter
  • array_derby.diff: array module converted to AC
  • cmath_derby.diff: all of cmath converted
  • fcntl_derby.diff
  • 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 = 'https://github.com/brettcannon'
    closed_at = <Date 2014-11-10.01:26:34.392>
    created_at = <Date 2014-01-06.20:18:13.317>
    labels = ['extension-modules', 'type-feature']
    title = 'Derby #15: Convert 50 sites to Argument Clinic across 9 files'
    updated_at = <Date 2014-11-10.01:26:34.391>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2014-11-10.01:26:34.391>
    actor = 'brett.cannon'
    assignee = 'brett.cannon'
    closed = True
    closed_date = <Date 2014-11-10.01:26:34.392>
    closer = 'brett.cannon'
    components = ['Extension Modules']
    creation = <Date 2014-01-06.20:18:13.317>
    creator = 'brett.cannon'
    dependencies = []
    files = ['33351', '33511', '33513', '33515', '33591', '33828', '33829', '33831', '33839', '37144']
    hgrepos = []
    issue_num = 20152
    keywords = ['patch']
    message_count = 35.0
    messages = ['207474', '207598', '207625', '207641', '207808', '207809', '208347', '208351', '208353', '208357', '208653', '208668', '209788', '209789', '209826', '224141', '224142', '225678', '225679', '225680', '225681', '225691', '225692', '225694', '225695', '229035', '229036', '229362', '230819', '230822', '230857', '230858', '230859', '230927', '230930']
    nosy_count = 5.0
    nosy_names = ['loewis', 'brett.cannon', 'larry', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue20152'
    versions = ['Python 3.5']

    @brettcannon
    Copy link
    Member Author

    Since _imp isn't directly exposed it isn't a priority to do the conversion, but for maintenance and such it should still occur.

    @brettcannon brettcannon self-assigned this Jan 6, 2014
    @brettcannon brettcannon added the extension-modules C modules in the Modules dir label Jan 6, 2014
    @larryhastings
    Copy link
    Contributor

    I'm normalizing the names of these issues so they're easier to read and to search for.

    @larryhastings larryhastings changed the title Use Argument Clinic with _imp Derby: Convert the _imp module to use Argument Clinic Jan 7, 2014
    @brettcannon
    Copy link
    Member Author

    I have attached my conversion of import.c. Larry, can you look it over to make sure I did it as expected? I tried to not have to write my own converter for O& as the docs seem to suggest object(converter='...') should work, but I got an error instead.

    @larryhastings
    Copy link
    Contributor

    (Brett: in order to avoid creating 129 differet issues on the tracker, I'm bundling files together into groups of 50 sites. You don't have to tackle the whole list if you don't want to.)

    This issue is part of the Great Argument Clinic Conversion Derby,
    where we're trying to convert as much of Python 3.4 to use
    Argument Clinic as we can before Release Candidate 1 on January 19.

    This issue asks you to change the following bundle of files:
    Python/import.c: 8 sites
    Modules/cmathmodule.c: 8 sites
    Modules/cjkcodecs/multibytecodec.c: 8 sites
    Modules/arraymodule.c: 8 sites
    Modules/pyexpat.c: 7 sites
    Modules/fcntlmodule.c: 7 sites
    Modules/pwdmodule.c: 2 sites
    Modules/spwdmodule.c: 1 sites
    Modules/grpmodule.c: 1 sites

    Talk to me (larry) if you only want to attack part of a bundle.

    For instructions on how to convert a function to work with Argument
    Clinic, read the "howto":
    http://docs.python.org/dev/howto/clinic.html

    @larryhastings larryhastings changed the title Derby: Convert the _imp module to use Argument Clinic Derby #15: Convert 50 sites to Argument Clinic across 9 files Jan 8, 2014
    @larryhastings larryhastings added the type-feature A feature request or enhancement label Jan 8, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jan 10, 2014

    New changeset 1f3242fb0c9c by Brett Cannon in branch 'default':
    Issue bpo-20152: import.c now uses Argument Clinic.
    http://hg.python.org/cpython/rev/1f3242fb0c9c

    @brettcannon
    Copy link
    Member Author

    Now it's:

    [Modules/cmathmodule.c](https://github.com/python/cpython/blob/main/Modules/cmathmodule.c): 8 sites
    [Modules/cjkcodecs/multibytecodec.c](https://github.com/python/cpython/blob/main/Modules/cjkcodecs/multibytecodec.c): 8 sites
    [Modules/arraymodule.c](https://github.com/python/cpython/blob/main/Modules/arraymodule.c): 8 sites
    [Modules/pyexpat.c](https://github.com/python/cpython/blob/main/Modules/pyexpat.c): 7 sites
    [Modules/fcntlmodule.c](https://github.com/python/cpython/blob/main/Modules/fcntlmodule.c): 7 sites
    [Modules/pwdmodule.c](https://github.com/python/cpython/blob/main/Modules/pwdmodule.c): 2 sites
    [Modules/spwdmodule.c](https://github.com/python/cpython/blob/main/Modules/spwdmodule.c): 1 sites
    [Modules/grpmodule.c](https://github.com/python/cpython/blob/main/Modules/grpmodule.c): 1 sites
    

    @brettcannon
    Copy link
    Member Author

    I'm going to start tackling some of these today and checking them in directly. If I don't finish I will update the bug with what I didn't get to.

    @brettcannon brettcannon self-assigned this Jan 17, 2014
    @brettcannon
    Copy link
    Member Author

    Patch for multibytecodec.c.

    Not sure how you calculated locations, Larry, but this file had 11 things to change, so some other work divisions might be off.

    @brettcannon
    Copy link
    Member Author

    After finding out that the initial site counts were off I went through and manually counted each file in this Derby group to get a more accurate idea of how much work each file would be.

    [Modules/cmathmodule.c](https://github.com/python/cpython/blob/main/Modules/cmathmodule.c): 8 sites
    [Modules/arraymodule.c](https://github.com/python/cpython/blob/main/Modules/arraymodule.c): 27 sites
    [Modules/pyexpat.c](https://github.com/python/cpython/blob/main/Modules/pyexpat.c): 11 sites
    [Modules/fcntlmodule.c](https://github.com/python/cpython/blob/main/Modules/fcntlmodule.c): 4 sites
    [Modules/pwdmodule.c](https://github.com/python/cpython/blob/main/Modules/pwdmodule.c): 3 sites
    [Modules/spwdmodule.c](https://github.com/python/cpython/blob/main/Modules/spwdmodule.c): 2 sites
    [Modules/grpmodule.c](https://github.com/python/cpython/blob/main/Modules/grpmodule.c): 3 sites
    

    @brettcannon
    Copy link
    Member Author

    Might pick this up later today (or never), but taking a break for now.

    Larry, I have patches for grp, spwd, _multibytecodec, and pwd I'd like you to give a once-over to make sure I didn't miss anything.

    The only one that I think has an obvious improvement is in pwd where there is custom logic to deal with a PyArg_ParseTuple() failure. Does Argument Clinic have a way to specify custom logic in that instance?

    With these patches the TODO for this derby group is:

    [Modules/cmathmodule.c](https://github.com/python/cpython/blob/main/Modules/cmathmodule.c): 8 sites
    [Modules/arraymodule.c](https://github.com/python/cpython/blob/main/Modules/arraymodule.c): 27 sites
    [Modules/pyexpat.c](https://github.com/python/cpython/blob/main/Modules/pyexpat.c): 11 sites
    [Modules/fcntlmodule.c](https://github.com/python/cpython/blob/main/Modules/fcntlmodule.c): 4 sites
    

    cmath might not be worth doing, though, for 3.4 as it already has custom macros to create function definitions.

    @brettcannon
    Copy link
    Member Author

    Here is fcntl converted. I didn't do fcntl.ioctl as it has a crazy set of possible signatures which I simply didn't want to deal with.

    @brettcannon
    Copy link
    Member Author

    Here is pyexpat converted. Couldn't do ErrorString as the 'l' format isn't supported; issue bpo-20332.

    @brettcannon
    Copy link
    Member Author

    Here is pyexpat updated with ErrorString converted (and generally updated to manage changes now required by AC for class definitions).

    @brettcannon
    Copy link
    Member Author

    Should only have two modules left to convert:

    [Modules/cmathmodule.c](https://github.com/python/cpython/blob/main/Modules/cmathmodule.c): 8 sites
    [Modules/arraymodule.c](https://github.com/python/cpython/blob/main/Modules/arraymodule.c): 27 sites
    

    I have already started arraymodule.c; it's just taking a while.

    @brettcannon
    Copy link
    Member Author

    It took a bit of finessing but I managed to convert cmath in a way that didn't make it worse compared to before AC.

    I now consider this part of the derby done and ready for Larry to review.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jul 27, 2014

    multibytecodec_derby.diff looks fine, please apply.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jul 27, 2014

    The cmath patch fails to apply; please update it.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 22, 2014

    New changeset c2d71f9afa0b by Brett Cannon in branch 'default':
    Issue bpo-20152: Convert _multibytecodecs to Argument Clinic.
    http://hg.python.org/cpython/rev/c2d71f9afa0b

    @brettcannon
    Copy link
    Member Author

    To make it easier to track what is left to commit:

    • grp
    • spwd
    • fcntl
    • pyexpat
    • array
    • cmath [Martin says this no longer applies cleanly]

    I should also mention all of these patches probably need to shift to output preset file as well.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 22, 2014

    New changeset 2617db7e43a3 by Brett Cannon in branch 'default':
    Issue bpo-20152: Convert the grp module to Argument Clinic.
    http://hg.python.org/cpython/rev/2617db7e43a3

    @brettcannon
    Copy link
    Member Author

    To make it easier to track what is left to commit:

    • spwd
    • fcntl
    • pyexpat
    • array
    • cmath [Martin says this no longer applies cleanly]

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 22, 2014

    New changeset b3aa30f474c4 by Brett Cannon in branch 'default':
    Issue bpo-20152: Port the spwd module to Argument Clinic.
    http://hg.python.org/cpython/rev/b3aa30f474c4

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 22, 2014

    New changeset c48980af7df2 by Brett Cannon in branch 'default':
    Issue bpo-20152: Port the pwd module to Argument Clinic.
    http://hg.python.org/cpython/rev/c48980af7df2

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 22, 2014

    New changeset 0c2792a8f9db by Brett Cannon in branch 'default':
    Issue bpo-20152: Port pyexpat to Argument Clinic.
    http://hg.python.org/cpython/rev/0c2792a8f9db

    @brettcannon
    Copy link
    Member Author

    To make it easier to track what is left to commit:

    • fcntl [does not apply cleanly
    • array
    • cmath [Martin says this no longer applies cleanly]

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 10, 2014

    New changeset f7ab0884467e by Brett Cannon in branch 'default':
    Issue bpo-20152: Port the array module to Argument Clinic.
    https://hg.python.org/cpython/rev/f7ab0884467e

    @brettcannon
    Copy link
    Member Author

    Only ones left are:

    • fcntl
    • cmath

    Both no longer apply cleanly.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 14, 2014

    New changeset 5e8b94397f81 by Brett Cannon in branch 'default':
    Issue bpo-20152: Convert the cmath module to Argument Clinic.
    https://hg.python.org/cpython/rev/5e8b94397f81

    @brettcannon
    Copy link
    Member Author

    Here is a new patch for fcntl. I would like a review since I had to get a bit tricky to handle the polymorphic arguments for fcntl and ioctl and I don't think the test suite is that thorough for this module.

    @serhiy-storchaka
    Copy link
    Member

    I found bugs or doubtful code in the fcntl module. They should be fixed before converting to Argument Clinic.

    @brettcannon
    Copy link
    Member Author

    So I disagree that the code needs to be tweaked before converting to Argument Clinic. If the Clinic conversion is not adding to the problem then the code churn is just going to make applying this patch that much harder.

    Thanks for the code review regardless, though!

    @serhiy-storchaka
    Copy link
    Member

    If first convert to Argument Clinic then fixing bugs will be much harder.

    @serhiy-storchaka
    Copy link
    Member

    About argument names. You have changed argument names and docstrings in any case (e.g. was "op", now "code"). Why not conform with standard documentation? This wouldn't add additional code churn if change it now. But will add if change it later.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 10, 2014

    New changeset 6e6532d313a1 by Brett Cannon in branch 'default':
    bpo-20152, 22821: Port the fcntl module to Argument Clinic.
    https://hg.python.org/cpython/rev/6e6532d313a1

    @brettcannon
    Copy link
    Member Author

    Finally finished!

    I am never trusting Larry to count anything ever again. ;)

    @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 type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants