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 — PyArg_ParseTupleAndKeywords doesn't take const char *keywords[] · Issue #65210 · python/cpython

PyArg_ParseTupleAndKeywords doesn't take const char *keywords[] #65210

New issue
Copy link
New issue
Copy link
Closed
Closed
PyArg_ParseTupleAndKeywords doesn't take const char *keywords[]#65210
Copy link
Labels
topic-C-APItype-featureA feature request or enhancementA feature request or enhancement

Description

hvenev
mannequin
opened on Mar 21, 2014
Issue body actions
BPO 21011
Nosy @methane, @serhiy-storchaka, @MojoVampire, @hvenev

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 = None
created_at = <Date 2014-03-21.16:45:16.140>
labels = ['extension-modules', 'type-feature', '3.8']
title = "PyArg_ParseTupleAndKeywords doesn't take const char *keywords[]"
updated_at = <Date 2018-07-03.09:45:24.075>
user = 'https://github.com/hvenev'

bugs.python.org fields:

activity = <Date 2018-07-03.09:45:24.075>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Extension Modules']
creation = <Date 2014-03-21.16:45:16.140>
creator = 'h.venev'
dependencies = []
files = []
hgrepos = []
issue_num = 21011
keywords = []
message_count = 4.0
messages = ['214388', '214857', '320945', '320952']
nosy_count = 4.0
nosy_names = ['methane', 'serhiy.storchaka', 'josh.r', 'h.venev']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue21011'
versions = ['Python 3.8']

Linked PRs

  • gh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords() #105958

Activity

  1. hvenev commented on Mar 21, 2014

    @hvenev
    hvenevmannequin
    on Mar 21, 2014
    MannequinAuthor
    More actions

    This really annoys me. I have to store the literals in char[] and then make a char*[] from them. It would be better if a simple array of string literals could be used. It would also require less data space because string literals could be merged by the compiler.

    I don't know why PyArg_ParseTupleAndKeywords would ever modify the keywords array so it makes absolutely no sense to me for the array not to be const char*[].

    In all cases I have seen PyArg_ParseTupleAndKeywords being used string literals were converted to char* (dropping const) which is far far worse than inefficient code.

  2. hvenev
    added
    performancePerformance or resource usagePerformance or resource usage
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    on Mar 21, 2014
  3. MojoVampire commented on Mar 25, 2014

    @MojoVampire
    MojoVampiremannequin
    on Mar 25, 2014
    Mannequin
    More actions

    This has come up before. Links to additional info:

    https://mail.python.org/pipermail/python-dev/2006-February/060689.html

    http://bugs.python.org/issue1772673

  4. methane commented on Jul 3, 2018

    @methane
    methane
    on Jul 3, 2018
    Member
    More actions

    I think we can't fix this until Python 4.
    May I close this issue as "won't fix" for now?

    Or can we add "Python 4" keyword to list backward incompatible changes we want to do in the future?

  5. methane
    added
    3.8 (EOL)end of lifeend of life
    on Jul 3, 2018
  6. serhiy-storchaka commented on Jul 3, 2018

    @serhiy-storchaka
    serhiy-storchaka
    on Jul 3, 2018
    Member
    More actions

    We can't change this API because this would break virtually all user code.

    But we can introduce a macro like PY_SSIZE_T_CLEAN. If it is defined before including Python.h, PyArg_ParseTupleAndKeywords() will take an array of const strings. This will help for compatibility with C++.

  7. serhiy-storchaka
    added
    type-featureA feature request or enhancementA feature request or enhancement
    and removed
    performancePerformance or resource usagePerformance or resource usage
    on Jul 3, 2018
  8. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  9. iritkatriel
    added
    topic-C-API
    and removed
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    3.8 (EOL)end of lifeend of life
    on May 14, 2023
  10. serhiy-storchaka
    added a commit that references this issue on Jun 21, 2023

    pythongh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords()

    80e37a9
  11. serhiy-storchaka commented on Jun 21, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Jun 21, 2023
    Member
    More actions

    We can fix this at least for C++, because in C++ the const char * const * declaration is compatible with arguments of type const char * const *, char * const *, const char **, and char **.

    Sad, it is not so in C, but we can provide a lever to control the declaration, and may change the default in distant future.

  12. serhiy-storchaka
    added a commit that references this issue on Dec 4, 2023

    gh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords() (GH…

    da6760b
  13. serhiy-storchaka
    closed this as completedon Dec 4, 2023
  14. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords…

    4fb94c8
  15. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords…

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-C-APItype-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.