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

Add constantness to PyStructSequence_UnnamedField #82831

Closed
serhiy-storchaka opened this issue Oct 30, 2019 · 4 comments
Closed

Add constantness to PyStructSequence_UnnamedField #82831

serhiy-storchaka opened this issue Oct 30, 2019 · 4 comments
Labels
3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@serhiy-storchaka
Copy link
Member

BPO 38650
Nosy @ericsnowcurrently, @serhiy-storchaka, @corona10
PRs
  • bpo-38650: Constify PyStructSequence_UnnamedField. #17005
  • 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 2019-11-16.17:22:45.452>
    created_at = <Date 2019-10-30.20:01:43.091>
    labels = ['interpreter-core', '3.9']
    title = 'Add constantness to PyStructSequence_UnnamedField'
    updated_at = <Date 2019-11-22.19:51:57.606>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2019-11-22.19:51:57.606>
    actor = 'eric.snow'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-11-16.17:22:45.452>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2019-10-30.20:01:43.091>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38650
    keywords = ['patch']
    message_count = 4.0
    messages = ['355731', '356755', '356757', '357318']
    nosy_count = 3.0
    nosy_names = ['eric.snow', 'serhiy.storchaka', 'corona10']
    pr_nums = ['17005']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue38650'
    versions = ['Python 3.9']

    @serhiy-storchaka
    Copy link
    Member Author

    Currently the variable PyStructSequence_UnnamedField has type "char *". It is used as a special value for setting to the name field of PyStructSequence_Field. But the type of the name field is "const char *".

    I propose to change the declaration of PyStructSequence_UnnamedField to "const char * const". Makes it referring to immutable character string and make it itself immutable.

    It is binary compatible change, but some user code can complain at compilation time if it uses PyStructSequence_UnnamedField in unusual way (assigns to the "char *" variable, etc). It is very unlikely.

    @serhiy-storchaka serhiy-storchaka added 3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Oct 30, 2019
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset bd44a7e by Serhiy Storchaka in branch 'master':
    bpo-38650: Constify PyStructSequence_UnnamedField. (GH-17005)
    bd44a7e

    @corona10
    Copy link
    Member

    Looks like

    Objects/structseq.c - PyStructSequence_UnnamedField variable char *PyStructSequence_UnnamedField
    should be updated also.
    What do you think?

    @ericsnowcurrently
    Copy link
    Member

    I wouldn't worry about the c-analyzer stuff for now. I plan on re-generating the file in the near future.

    @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
    3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants