[issue37032] Add CodeType.replace() method
STINNER Victor
report at bugs.python.org
Fri May 24 07:39:29 EDT 2019
STINNER Victor <vstinner at redhat.com> added the comment:
It's not like Python 3.8 is the first type in Python history that code constructor changed.
The PyCode_New() function slowly growed from 3 parameters in 1990 to 16 paramters in 2019 :-)
History of PyCode_New().
New "posonlyargcount" parameter:
commit 8c77b8cb9188165a123f2512026e3629bf03dc9b
Author: Pablo Galindo <Pablogsal at gmail.com>
Date: Mon Apr 29 13:36:57 2019 +0100
bpo-36540: PEP 570 -- Implementation (GH-12701)
New "kwonlyargcount" parameter, bpo-1549670:
commit 4f72a78684bbfcdc43ceeabb240ceee54706c4b0
Author: Guido van Rossum <guido at python.org>
Date: Fri Oct 27 23:31:49 2006 +0000
Jiwon Seo's PEP 3102 implementation.
See SF#1549670.
The compiler package has not yet been updated.
New "freevars" and "cellvars" parameters, PEP 227:
commit 64949cb753f206c0ca1d83f55d07afd3c179b81a
Author: Jeremy Hylton <jeremy at alum.mit.edu>
Date: Thu Jan 25 20:06:59 2001 +0000
PEP 227 implementation
...
Include/compile.h
Add co_freevars and co_cellvars slots to code objects.
Update PyCode_New() to take freevars and cellvars as arguments
New "firstlineno" and "lnotab" parameters:
commit da4eb5c3b55df9b7d6957ddd0458313102f0a92e
Author: Guido van Rossum <guido at python.org>
Date: Fri Jan 24 03:43:35 1997 +0000
Instead of emitting SET_LINENO instructions, generate a line number
table which is incorporated in the code object. This way, the runtime
overhead to keep track of line numbers is only incurred when an
exception has to be reported.
New "stacksize" parameter:
commit 8b993a98db507cc3a75067af4c865ffc8afbada1
Author: Guido van Rossum <guido at python.org>
Date: Fri Jan 17 21:04:03 1997 +0000
Add co_stacksize field to codeobject structure, and stacksize argument
to PyCode_New() argument list. Move MAXBLOCKS constant to conpile.h.
Added accurate calculation of the actual stack size needed by the
generated code.
Also commented out all fprintf statements (except for a new one to
diagnose stack underflow, and one in #ifdef'ed out code), and added
some new TO DO suggestions (now that the stacksize is taken of the TO
DO list).
New "argcount", "nlocals", "flags" and "varnames" parameters:
commit 681d79aaf397850778608f35585d091fa7fe370a
Author: Guido van Rossum <guido at python.org>
Date: Tue Jul 18 14:51:37 1995 +0000
keyword arguments and faster calls
New "name" parameter:
commit 9bfef44d97d1ae24e03717e3d59024b44626a9de
Author: Guido van Rossum <guido at python.org>
Date: Mon Mar 29 10:43:31 1993 +0000
...
* Added function name to code object. Print it for code and function
objects. THIS MAKES THE .PYC FILE FORMAT INCOMPATIBLE (the version
number has changed accordingly)
...
New "filename" parameter:
commit 3f5da24ea304e674a9abbdcffc4d671e32aa70f1
Author: Guido van Rossum <guido at python.org>
Date: Thu Dec 20 15:06:42 1990 +0000
"Compiling" version
The very first version of the function was:
static codeobject *
newcodeobject(code, consts, names)
object *code;
object *consts;
object *names;
>From this commit:
commit 10dc2e8097e7a431367e72f46ddba91be93aa159
Author: Guido van Rossum <guido at python.org>
Date: Sun Nov 18 17:27:39 1990 +0000
Initial revision
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37032>
_______________________________________
More information about the Python-bugs-list
mailing list