This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients pablogsal, vstinner
Date 2019-05-24.11:39:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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 <>
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 <>
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 <>
Date:   Thu Jan 25 20:06:59 2001 +0000

    PEP 227 implementation
        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 <>
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 <>
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 <>
Date:   Tue Jul 18 14:51:37 1995 +0000

    keyword arguments and faster calls

New "name" parameter:

commit 9bfef44d97d1ae24e03717e3d59024b44626a9de
Author: Guido van Rossum <>
Date:   Mon Mar 29 10:43:31 1993 +0000

    * Added function name to code object.  Print it for code and function
      number has changed accordingly)

New "filename" parameter:

commit 3f5da24ea304e674a9abbdcffc4d671e32aa70f1
Author: Guido van Rossum <>
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 <>
Date:   Sun Nov 18 17:27:39 1990 +0000

    Initial revision
Date User Action Args
2019-05-24 11:39:29vstinnersetrecipients: + vstinner, pablogsal
2019-05-24 11:39:29vstinnersetmessageid: <>
2019-05-24 11:39:29vstinnerlinkissue37032 messages
2019-05-24 11:39:29vstinnercreate