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

solved PyType_Slot *slots; bug in Python.h include command#342

Open
shrita2000 wants to merge 1 commit into
lava:master from
shrita2000:master
Open

solved PyType_Slot *slots; bug in Python.h include command #342
shrita2000 wants to merge 1 commit into
lava:master from
shrita2000:master

Conversation

@shrita2000

@shrita2000 shrita2000 commented Apr 6, 2023

Copy link
Copy Markdown

Compiling a project using this library sometimes throws the following error: "expected unqualified-id before ‘;’ token
190 | PyType_Slot *slots; "
Since Qt uses slots as a reserved keyword there is a clash with the declaration of the slots member of the PyType_Slot struct in Python.h. To avoid the conflict regarding 'slots', without the need for deactivating the keywords signals/slots/emit (which may be undesirable for large Qt projects), the code edit locally "parks" the offending keyword while Python.h is included, and then reassigns it.

alex-miftek reacted with thumbs up emoji

Copy link
Copy Markdown

For anyone wondering who stumbled upon this issue like I did, here is how you would "park" the definition of "slots":

#pragma push_macro("slots")
#undef slots
#include <Python.h>
#pragma pop_macro("slots")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /