Skip to content

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

Description

@sobolevn

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

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    on Dec 13, 2022
  2. added a commit that references this issue on Dec 13, 2022
  3. markshannon commented on Dec 13, 2022

    @markshannon
    Member

    OOI, do we know where ERROR is previously defined?

  4. sobolevn commented on Dec 13, 2022

    @sobolevn
    MemberAuthor

    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)                             \
    
    
  5. kumaraditya303 commented on Dec 13, 2022

    @kumaraditya303
    Contributor

    Fixed by #100215

  6. eryksun commented on Dec 13, 2022

    @eryksun
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions