Skip to content

[3.11] gh-93442: Make C++ version of _Py_CAST work with 0/NULL. (GH-93500) - #93507

Merged
corona10 merged 1 commit into
python:3.11from
miss-islington:backport-8bcc3fa-3.11
Jun 5, 2022
Merged

corona10 merged 1 commit into
python:3.11from
miss-islington:backport-8bcc3fa-3.11

Conversation

@miss-islington

Copy link
Copy Markdown
Contributor

Add C++ overloads for _Py_CAST_impl() to handle 0/NULL. This will allow
C++ extensions that pass 0 or NULL to macros using _Py_CAST() to
continue to compile. Without this, you get an error like:

invalid ‘static_cast’ from type ‘int’ to type ‘_object*’

The modern way to use a NULL value in C++ is to use nullptr. However,
we want to not break extensions that do things the old way.

Co-authored-by: serge-sans-paille
(cherry picked from commit 8bcc3fa)

Co-authored-by: Neil Schemenauer nas-github@arctrix.com

…nGH-93500)

Add C++ overloads for _Py_CAST_impl() to handle 0/NULL.  This will allow
C++ extensions that pass 0 or NULL to macros using _Py_CAST() to
continue to compile.  Without this, you get an error like:

    invalid ‘static_cast’ from type ‘int’ to type ‘_object*’

The modern way to use a NULL value in C++ is to use nullptr.  However,
we want to not break extensions that do things the old way.

Co-authored-by: serge-sans-paille
(cherry picked from commit 8bcc3fa)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
@ghost

ghost commented Jun 5, 2022

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

Click the button to sign:
CLA not signed

@miss-islington

Copy link
Copy Markdown
Contributor Author

@nascheme: Status check is done, and it's a failure ❌ .

@miss-islington

Copy link
Copy Markdown
Contributor Author

@nascheme: Status check is done, and it's a failure ❌ .

1 similar comment
@miss-islington

Copy link
Copy Markdown
Contributor Author

@nascheme: Status check is done, and it's a failure ❌ .

@corona10 corona10 left a comment

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.

lgtm bot

@corona10
corona10 merged commit d97e2c5 into python:3.11 Jun 5, 2022
@miss-islington
miss-islington deleted the backport-8bcc3fa-3.11 branch June 5, 2022 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants