Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PyTuple_SET_ITEM fails to compile in C++ source #93442

Closed
Assignees
vstinner
Labels
3.11only security fixes3.12only security fixestopic-C-APItype-bugAn unexpected behavior, bug, or error
@nascheme

Description

@nascheme
  • CPython versions tested on: 3.11b3
  • Operating system and architecture: Debian Linux, GCC 10.2.1-6

The kiwisolver extension doesn't compile with beta 3. The error is:

/usr/local/python3.11.0b3/include/python3.11/pyport.h:47:24: error: invalid ‘static_cast’ from type ‘int’ to type ‘_object*’   47 |                 return static_cast<type>(const_cast<expr_type &>(expr));      |                        ^~~~~

This seems to be an issue with the new inline functions for things that used to be macros. E.g. PyTuple_SET_ITEM. The C++ code triggering the issue is:

--- a/py/src/symbolics.h+++ b/py/src/symbolics.h@@ -123,7 +123,7 @@ PyObject* BinaryMul::operator()( Expression* first, double second )                return 0;        Py_ssize_t end = PyTuple_GET_SIZE( first->terms );        for( Py_ssize_t i = 0; i < end; ++i )  // memset 0 for safe error return-               PyTuple_SET_ITEM( terms.get(), i, 0 );+               PyTuple_SetItem( terms.get(), i, 0 );        for( Py_ssize_t i = 0; i < end; ++i )        {                PyObject* item = PyTuple_GET_ITEM( first->terms, i );

Replacing the macro with the function version seems to allow the extension to compile.

This seems related to#92898

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12only security fixestopic-C-APItype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp