Skip to content

use Py_SET_TYPE for compat with python 3.10 #1131

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

Merged
merged 1 commit into from
Aug 24, 2020
Merged

use Py_SET_TYPE for compat with python 3.10 #1131

merged 1 commit into from
Aug 24, 2020

Conversation

jouve
Copy link
Contributor

@jouve jouve commented Jul 26, 2020

No description provided.

* https://docs.python.org/3.10/whatsnew/3.10.html#id2
*/
#if PY_VERSION_HEX < 0x030900A4
#define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the contribution!

I wonder why is the (void)0 idiom preferred to the classic do { ... } while (0): I have seen it accepted but not discussed in the ticket.

Copy link
Contributor Author

@jouve jouve Jul 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dvarrazzo dvarrazzo merged commit 3aadece into psycopg:master Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants