Skip to content

use Py_SET_TYPE for compat with python 3.10#1131

Merged
dvarrazzo merged 1 commit intopsycopg:masterfrom
jouve:py3.10compat
Aug 24, 2020
Merged

use Py_SET_TYPE for compat with python 3.10#1131
dvarrazzo merged 1 commit intopsycopg:masterfrom
jouve:py3.10compat

Conversation

@jouve
Copy link
Copy Markdown
Contributor

@jouve jouve commented Jul 26, 2020

No description provided.

Comment thread psycopg/python.h
* 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
Copy Markdown
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
Copy Markdown
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