GeezerVison is showing github.com — bpo-39355: making Python.h compatible with C++20 compilers by AliyevH · Pull Request #31282 · python/cpython
bpo-39355: making Python.h compatible with C++20 compilers
#31282
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
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from all commits
Commits
File filter
Filter by extension
.h
(4)
.rst
(2)
All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
There are no files selected for viewing
Original file line number
Diff line number
Diff line change
Expand Up
@@ -787,6 +787,9 @@ Build Changes
* The :mod:`tkinter` package now requires Tcl/Tk version 8.5.12 or newer.
(Contributed by Serhiy Storchaka in :issue:`46996`.)
* Python.h is now compatible with C++20 compilers. (Contributed by by Hasan
Aliyev in :issue:`39355`.)
C API Changes
=============
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -7,8 +7,8 @@ PyMODINIT_FUNC PyInit__imp(void);
PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *);
PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(_Py_Identifier *name);
PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module );
PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module );
PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *mod );
PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject *mod );
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -7,13 +7,13 @@ PyAPI_FUNC(int) PyErr_WarnExplicitObject(
PyObject *message,
PyObject *filename,
int lineno,
PyObject *module ,
PyObject *mod ,
PyObject *registry);
PyAPI_FUNC(int) PyErr_WarnExplicitFormat(
PyObject *category,
const char *filename, int lineno,
const char *module , PyObject *registry,
const char *mod , PyObject *registry,
const char *format, ...);
// DEPRECATED: Use PyErr_WarnEx() instead.
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -156,7 +156,7 @@ PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
/* New in 3.9 */
PyAPI_FUNC(int) PyModule_AddType(PyObject *module , PyTypeObject *type);
PyAPI_FUNC(int) PyModule_AddType(PyObject *mod , PyTypeObject *type);
#endif /* Py_LIMITED_API */
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
Expand All
@@ -165,7 +165,7 @@ PyAPI_FUNC(int) PyModule_AddType(PyObject *module, PyTypeObject *type);
/* New in 3.5 */
PyAPI_FUNC(int) PyModule_SetDocString(PyObject *, const char *);
PyAPI_FUNC(int) PyModule_AddFunctions(PyObject *, PyMethodDef *);
PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module , PyModuleDef *def);
PyAPI_FUNC(int) PyModule_ExecDef(PyObject *mod , PyModuleDef *def);
#endif
#define Py_CLEANUP_SUPPORTED 0x20000
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -29,7 +29,7 @@ PyAPI_FUNC(int) PyErr_WarnExplicit(
const char *message, /* UTF-8 encoded string */
const char *filename, /* decoded from the filesystem encoding */
int lineno,
const char *module , /* UTF-8 encoded string */
const char *mod , /* UTF-8 encoded string */
PyObject *registry);
#ifndef Py_LIMITED_API
Expand Down
Original file line number
Diff line number
Diff line change
@@ -0,0 +1 @@
Make Python.h compatible with C++20 compilers.
Comment thread
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 .
Would you mind to explain that the change is to avoid the usage of "module" which became a keyword in C++20?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
erlend-aasland reacted with thumbs up emoji
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 .
Yes @vstinner , you are right!
I have mentioned in bugs.python.org, about this change.
After making a little research, i realized that this "module" keyword has meaning with "export"
Sorry i am not c++ expert )) If somebody have knowledge about it, share it plz :)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 .
I don't understand your comment. Do you mean that https://bugs.python.org/issue39355 is not a bug and the Python C API is compatible with C++20?
If there is an issue, please explain the change in NEWS entry. "Make Python.h compatible with C++20 compilers." is not enough.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 .
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 .
@vstinner it was interesting for me, if "module" keyword has meaning with "export" how gcc will treat "module" without "export" keyword ?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 .
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 .
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 .
You're welcome. I'm now considering serious to convert #32175 to a real unit test to make sure that the Python C API is compatible with C++.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 .
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.