
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2022-04-06 13:56 byvstinner, last changed2022-04-11 14:59 byadmin.
| Messages (1) | |||
|---|---|---|---|
| msg416869 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2022-04-06 13:56 | |
The PyCodeObject structure is documented at:https://docs.python.org/dev/c-api/code.htmlThe structured evolved a lot in Python 3.11 to optimizePython/ceval.c performance:* read-only co_code (object) was replaced with modifiable co_code_adaptive (char[])* co_varnames, co_freevars and co_cellvars were removed: merged into co_localsplusnames with co_localspluskinds* co_cell2arg was removed* co_zombieframe ("free list") was removed* co_opcache, co_opcache_map, co_opcache_flag and co_opcache_size were removed: seePEP 659https://peps.python.org/pep-0659/New members:* co_exceptiontable* co_warmup, co_code_adaptive* co_nlocalsplus, co_nplaincellvars, co_ncellvars, co_nfreevars* co_localsplusnames, co_localspluskinds* co_qualname* co_endlinetable, co_columntableThe PyCodeObject structure should be made opaque in the public C API and only accessed with function calls.In Python 3.11, the PyFrameObject structure was made opaque (bpo-46836) and multiple getters were added (bpo-40421). The idea is similar, but it might be too late to do that in Python 3.11 (beta1 feature freeze is close).---By the way, it was proposed multiple times on python-dev to mark the PyCode_New() function as "unstable" since its API changed often.PEP 670 "Python Positional-Only Parameters" caused a lot of troubles in Cython when it added a new parameter to PyCode_New(). The change was reverted: instead, a new PyCode_NewWithPosOnlyArgs() function was added.* PyCode_New() has 19 parameters!* PyCode_NewWithPosOnlyArgs() has 20 parameters!!On Python 3.11a1 and newer, Cython uses the code.replace() method (added to Python 3.8) to build new code objects. Otherwise, it just calls directly PyCode_New().https://docs.python.org/dev/library/types.html#types.CodeType.replace | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:58 | admin | set | github: 91397 |
| 2022-04-06 13:56:37 | vstinner | create | |