Skip to content
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

New GitHub warning: 'ERROR': macro redefinition #100213

Closed
sobolevn opened this issue Dec 13, 2022 · 4 comments
Closed

New GitHub warning: 'ERROR': macro redefinition #100213

sobolevn opened this issue Dec 13, 2022 · 4 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Dec 13, 2022

I think that #100010 is the source.

Снимок экрана 2022-12-13 в 13 28 21

Example: e4ea33b

I think we should do #undef ERROR beforehand.
Will send a PR!

Linked PRs

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Dec 13, 2022
sobolevn added a commit to sobolevn/cpython that referenced this issue Dec 13, 2022
@markshannon
Copy link
Member

OOI, do we know where ERROR is previously defined?

@sobolevn
Copy link
Member Author

It is not in sources:

» ag '#define ERROR'
Python/compile.c
59:#define ERROR -1

Python/bytecodes.c
67:#define ERROR_IF(cond, labelname) ((void)0)

Python/modsupport.c
283:#define ERROR_NEED_PY_SSIZE_T_CLEAN \

Include/internal/pycore_token.h
76:#define ERRORTOKEN      60

Modules/cjkcodecs/multibytecodec.h
120:#define ERROR_STRICT            (PyObject *)(1)
121:#define ERROR_IGNORE            (PyObject *)(2)
122:#define ERROR_REPLACE           (PyObject *)(3)
123:#define ERROR_ISCUSTOM(p)       ((p) < ERROR_STRICT || ERROR_REPLACE < (p))
124:#define ERROR_DECREF(p)                             \

@kumaraditya303
Copy link
Contributor

Fixed by #100215

@eryksun
Copy link
Contributor

eryksun commented Dec 13, 2022

OOI, do we know where ERROR is previously defined?

The "windows.h" header includes "wingdi.h", which defines ERROR as a region flag with the value 0. This header gets included by "Include/internal/pycore_condvar.h":

/* include windows if it hasn't been done before */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

In turn, it's included by "Include/internal/pcore_gil.h", which is included by "Include/internal/pycore_runtime.h", which is included by many files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants