From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "enum" |
|---|
| subject | "Format:Marshal (Python)" |
|---|
| claim | "co_flags bits stored in marshalled code objects: CO_OPTIMIZED 0x1, CO_NEWLOCALS 0x2, CO_VARARGS 0x4, CO_VARKEYWORDS 0x8, CO_NESTED 0x10, CO_GENERATOR 0x20, CO_COROUTINE 0x80, CO_ITERABLE_COROUTINE 0x100, CO_ASYNC_GENERATOR 0x200, the __future__ flags 0x20000-0x1000000 (CO_FUTURE_ANNOTATIONS 0x1000000), CO_NO_MONITORING_EVENTS 0x2000000, CO_HAS_DOCSTRING 0x4000000, CO_METHOD 0x8000000 (the last three in recent versions only)." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Marshal (Python)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "co_flags" |
|---|
| underlying_type | "uint32_t" |
|---|
| values | | CO_OPTIMIZED | 1 |
|---|
| CO_NEWLOCALS | 2 |
|---|
| CO_VARARGS | 4 |
|---|
| CO_VARKEYWORDS | 8 |
|---|
| CO_NESTED | 16 |
|---|
| CO_GENERATOR | 32 |
|---|
| CO_COROUTINE | 128 |
|---|
| CO_ITERABLE_COROUTINE | 256 |
|---|
| CO_ASYNC_GENERATOR | 512 |
|---|
| CO_FUTURE_DIVISION | 131072 |
|---|
| CO_FUTURE_ABSOLUTE_IMPORT | 262144 |
|---|
| CO_FUTURE_WITH_STATEMENT | 524288 |
|---|
| CO_FUTURE_PRINT_FUNCTION | 1048576 |
|---|
| CO_FUTURE_UNICODE_LITERALS | 2097152 |
|---|
| CO_FUTURE_BARRY_AS_BDFL | 4194304 |
|---|
| CO_FUTURE_GENERATOR_STOP | 8388608 |
|---|
| CO_FUTURE_ANNOTATIONS | 16777216 |
|---|
| CO_NO_MONITORING_EVENTS | 33554432 |
|---|
| CO_HAS_DOCSTRING | 67108864 |
|---|
| CO_METHOD | 134217728 |
|---|
|
|---|
| complete | true |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "#define CO_* flags" |
|---|
| repo | "https://github.com/python/cpython" |
|---|
| commit | "010bebbf9fd12bba1e3f40bdbddacd51a9c2bf20" |
|---|
| path | "Include/cpython/code.h" |
|---|
| lines | "122-157" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "3.11.15/3.12.8: def f(a,/,b,*args,c=4,**kw) has flags 0x0F; a nested function 0x13; an async generator 0x203; 323 stdlib module code objects of 3.11 have 0x1000000" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Code object flags (CO_*)" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T05:12:30.144Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T07:49:21.799Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read Include/cpython/code.h at cpython 010bebbf lines 122-157: all 20 CO_* values match, including the 3.9+ future flags 0x20000-0x1000000 and the three recent ones." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T17:39:59.192Z" |
|---|
| summary | "Mark complete: code.h has CO_OPTIMIZED..CO_METHOD, 6+3+8 future flags+3 = 20 flags, all listed (CO_MAXBLOCKS is not a flag)" |
|---|
| changed | |
|---|
|
|
|---|