python / cpython

The Python programming language
https://www.python.org/
Other
61.32k stars 29.56k forks source link

"Check if generated files are up to date" CI job fails. #114191

Open markshannon opened 6 months ago

markshannon commented 6 months ago

Bug report

Bug description:

Failing job: https://github.com/python/cpython/actions/runs/7555944526/job/20571965088?pr=114142

Problematic input:


static_assert(UOP_MAX_TRACE_LENGTH == 512, "COLD_EXITS must be regenerated");

static _PyColdExitObject COLD_EXITS[] = {
    [0] = { .base = { PyVarObject_HEAD_INIT(&_ColdExit_Type, 0) .vm_data = { 0 }, .trace = &COLD_EXITS[0].uop }, .uop.opcode = _COLD_EXIT, .uop.oparg = 0 },
    [1] = { .base = { PyVarObject_HEAD_INIT(&_ColdExit_Type, 0) .vm_data = { 0 }, .trace = &COLD_EXITS[1].uop }, .uop.opcode = _COLD_EXIT, .uop.oparg = 1 },
   ...

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

tomasr8 commented 6 months ago

Based on this comment in Tools/c-analyzer/c_parser/parser/__init__.py:

# We use defaults that cover most files.  Files with bigger declarations
# are covered elsewhere (MAX_SIZES in cpython/_parser.py).

I'm guessing it might be necessary to add the file to the MAX_SIZES dictionary: https://github.com/python/cpython/blob/78fcde039a33d8463e34356d5462fecee0f2831a/Tools/c-analyzer/cpython/_parser.py#L307-L345

edit: i.e. something like this seems to work for me:

_abs('Python/optimizer.c'): (100_000, 5_000),
markshannon commented 6 months ago

@tomasr8 Thanks for the workaround.