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 — 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.

Sign up for GitHub

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

Closed
AliyevH wants to merge 7 commits into python:main from AliyevH:main

Uh oh!

There was an error while loading. Please reload this page.

Closed

bpo-39355: making Python.h compatible with C++20 compilers #31282

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
7 commits
Select commit Hold shift + click to select a range
31708f4
bpo-39355: making Python.h compatible with C++20 compilers
AliyevH Feb 11, 2022
75e9690
📜🤖 Added by blurb_it.
blurb-it[bot] Feb 11, 2022
cb7c264
Update 2022-02-11-18-51-11.bpo-39355.rcUPdT.rst
AliyevH Feb 11, 2022
2f4c9f0
bpo-39355: added a note in What's New - Make Python.h compatible with…
AliyevH Feb 11, 2022
fd84525
Merge branch 'main' into main
AliyevH Feb 28, 2022
c9c587f
Merge branch 'main' into main
AliyevH Mar 28, 2022
f7d973b
Update 3.11.rst
AliyevH Mar 28, 2022
File filter
Filter by extension

Clear filters
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
Diff view

There are no files selected for viewing

3 changes: 3 additions & 0 deletions 3 Doc/whatsnew/3.11.rst
Show comments
View file
Open in desktop
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
4 changes: 2 additions & 2 deletions 4 Include/cpython/import.h
Show comments
View file
Open in desktop
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
4 changes: 2 additions & 2 deletions 4 Include/cpython/warnings.h
Show comments
View file
Open in desktop
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
4 changes: 2 additions & 2 deletions 4 Include/modsupport.h
Show comments
View file
Open in desktop
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
2 changes: 1 addition & 1 deletion 2 Include/warnings.h
Show comments
View file
Open in desktop
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
1 change: 1 addition & 0 deletions 1 Misc/NEWS.d/next/Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make Python.h compatible with C++20 compilers.
Comment thread

@vstinner vstinner Feb 28, 2022

Copy link
Copy Markdown
Member

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
All reactions
  • 👍 1 reaction

@AliyevH AliyevH Mar 4, 2022

Copy link
Copy Markdown
Contributor Author

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.

All reactions

@vstinner vstinner Mar 7, 2022

Copy link
Copy Markdown
Member

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.

All reactions

@AliyevH AliyevH Mar 7, 2022

Copy link
Copy Markdown
Contributor Author

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 I asked question ))

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@AliyevH AliyevH Mar 7, 2022

Copy link
Copy Markdown
Contributor Author

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.

All reactions

@vstinner vstinner Mar 29, 2022

Copy link
Copy Markdown
Member

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.

So far, I failed to reproduce https://bugs.python.org/issue39355 issue: using the Python C API in C++ doesn't emit any compiler warning or compiler error. See my test: https://bugs.python.org/issue39355#msg416256

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@AliyevH AliyevH Mar 30, 2022

Copy link
Copy Markdown
Contributor Author

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 thanks for great investigation!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner Mar 30, 2022

Copy link
Copy Markdown
Member

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.

All reactions

@vstinner vstinner Mar 30, 2022

Copy link
Copy Markdown
Member

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.

First step: https://bugs.python.org/issue47164

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
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.
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.