-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
gh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords() #105958
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
Changes from 1 commit
80e37a9
1340934
040817e
910c5d2
0e4dc59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1104,6 +1104,18 @@ New Features | |||||||||
APIs accepting the format codes always use ``Py_ssize_t`` for ``#`` formats. | ||||||||||
(Contributed by Inada Naoki in :gh:`104922`.) | ||||||||||
|
||||||||||
* The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and | ||||||||||
:c:func:`PyArg_VaParseTupleAndKeywords` has now type :c:expr:`char * const *` | ||||||||||
in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char **`. | ||||||||||
It makes these functions compatible with argument of type | ||||||||||
:c:expr:`const char * const *`, :c:expr:`const char **` or | ||||||||||
:c:expr:`char * const *` in C++ and :c:expr:`char * const *` in C | ||||||||||
without explicit type cast. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Fix grammar error |
||||||||||
This can be overridden by defining the macro ``PY_CXX_CONST`` | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use this?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To note, while they both silence the warning, they have different semantics in the source and rendering in the output. However, with the changes suggested above, it is a moot point as you can link this and also simplify this What's New entry by referring readers to the macro description, which explains this (instead of duplicating the explanation here). |
||||||||||
before including :file:`Python.h` as ``const`` for the latter and as | ||||||||||
empty value for the former. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Now that this is documented, simply refer interested readers here directly instead of duplicating the whole explanation. |
||||||||||
(Contributed by Serhiy Storchaka in :gh:`65210`.) | ||||||||||
|
||||||||||
* Add :c:func:`PyImport_AddModuleRef`: similar to | ||||||||||
:c:func:`PyImport_AddModule`, but return a :term:`strong reference` instead | ||||||||||
of a :term:`borrowed reference`. | ||||||||||
|
@@ -1289,49 +1301,6 @@ Porting to Python 3.13 | |||||||||
platforms, the ``HAVE_STDDEF_H`` macro is only defined on Windows. | ||||||||||
(Contributed by Victor Stinner in :gh:`108765`.) | ||||||||||
|
||||||||||
Build Changes | ||||||||||
============= | ||||||||||
|
||||||||||
* Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate | ||||||||||
:file:`!configure`. | ||||||||||
(Contributed by Christian Heimes in :gh:`89886`.) | ||||||||||
|
||||||||||
* SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension module. | ||||||||||
(Contributed by Erlend Aasland in :gh:`105875`.) | ||||||||||
|
||||||||||
|
||||||||||
C API Changes | ||||||||||
============= | ||||||||||
|
||||||||||
New Features | ||||||||||
------------ | ||||||||||
|
||||||||||
* You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before including | ||||||||||
:file:`Python.h` when using ``#`` formats in | ||||||||||
:ref:`format codes <arg-parsing-string-and-buffers>`. | ||||||||||
APIs accepting the format codes always use ``Py_ssize_t`` for ``#`` formats. | ||||||||||
(Contributed by Inada Naoki in :gh:`104922`.) | ||||||||||
|
||||||||||
* The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and | ||||||||||
:c:func:`PyArg_VaParseTupleAndKeywords` has now type :c:expr:`char * const *` | ||||||||||
in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char **`. | ||||||||||
It makes these functions compatible with argument of type | ||||||||||
:c:expr:`const char * const *`, :c:expr:`const char **` or | ||||||||||
:c:expr:`char * const *` in C++ and :c:expr:`char * const *` in C | ||||||||||
without explicit type cast. | ||||||||||
This can be overridden by defining the macro ``PY_CXX_CONST`` | ||||||||||
before including :file:`Python.h` as ``const`` for the latter and as | ||||||||||
empty value for the former. | ||||||||||
(Contributed by Serhiy Storchaka in :gh:`65210`.) | ||||||||||
|
||||||||||
* Add :c:func:`PyImport_AddModuleRef`: similar to | ||||||||||
:c:func:`PyImport_AddModule`, but return a :term:`strong reference` instead | ||||||||||
of a :term:`borrowed reference`. | ||||||||||
(Contributed by Victor Stinner in :gh:`105922`.) | ||||||||||
|
||||||||||
|
||||||||||
Porting to Python 3.13 | ||||||||||
---------------------- | ||||||||||
|
||||||||||
Deprecated | ||||||||||
---------- | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix grammar error