summaryrefslogtreecommitdiff
path: root/Objects/codeobject.c
AgeCommit message (Collapse)AuthorLines
2019-12-31Document CodeType.replace (GH-17776)Miss Islington (bot)-2/+2
(cherry picked from commit 22424c02e51fab3b62cbe255d0b87d1b55b9a6c3) Co-authored-by: Anthony Sottile <asottile@umich.edu>
2019-11-26bpo-38922: Raise code.__new__ audit event when code object replace() is ↵Miss Islington (bot)-0/+7
called (GH-17394) (cherry picked from commit c7c01ab1e5415b772c68e15f1aba51e520010830) Co-authored-by: Steve Dower <steve.dower@python.org>
2019-07-01bpo-37221: Add PyCode_NewWithPosOnlyArgs to be used internally and set ↵Miss Islington (bot)-15/+31
PyCode_New as a compatibility wrapper (GH-13959) (#14505) Add PyCode_NewEx to be used internally and set PyCode_New as a compatibility wrapper (cherry picked from commit 4a2edc34a405150d0b23ecfdcb401e7cf59f4650) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-06-12bpo-26219: Fix compiler warning in _PyCode_InitOpcache() (GH-13997) (GH-14000)Miss Islington (bot)-1/+1
Fix MSVC warning: objects\codeobject.c(285): warning C4244: '=': conversion from 'Py_ssize_t' to 'unsigned char', possible loss of data (cherry picked from commit 376ce9852eec4e97745c723f0dd0fe64383c6cd3) Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-04bpo-26219: Fix compiler warning in _PyCode_InitOpcache() (GH-13809)Victor Stinner-1/+2
Fix this MSVC warning: objects\codeobject.c(264): warning C4244: '=': conversion from 'Py_ssize_t' to 'unsigned char', possible loss of data
2019-06-03bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884)Inada Naoki-0/+65
This patch implements per opcode cache mechanism, and use it in only LOAD_GLOBAL opcode. Based on Yury's opcache3.patch in bpo-26219.
2019-06-01bpo-36842: Pass positional only parameters to code_new audit hook (GH-13707)Pablo Galindo-3/+3
2019-06-01bpo-37122: Make co->co_argcount represent the total number of positonal ↵Pablo Galindo-6/+5
arguments in the code object (GH-13726)
2019-05-30bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer-2/+2
(GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
2019-05-24bpo-37032: Add CodeType.replace() method (GH-13542)Victor Stinner-4/+75
2019-05-23bpo-36842: Implement PEP 578 (GH-12613)Steve Dower-0/+6
Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
2019-04-29bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo-29/+44
This commit contains the implementation of PEP570: Python positional-only parameters. * Update Grammar/Grammar with new typedarglist and varargslist * Regenerate grammar files * Update and regenerate AST related files * Update code object * Update marshal.c * Update compiler and symtable * Regenerate importlib files * Update callable objects * Implement positional-only args logic in ceval.c * Regenerate frozen data * Update standard library to account for positional-only args * Add test file for positional-only args * Update other test files to account for positional-only args * Add News entry * Update inspect module and related tests
2018-11-25bpo-35081: Add Include/internal/pycore_tupleobject.h (GH-10705)Victor Stinner-0/+1
Move _PyTuple_ITEMS() to a new header file: Include/internal/pycore_tupleobject.h
2018-11-12bpo-35081: Rename internal headers (GH-10275)Victor Stinner-1/+1
Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
2018-11-09bpo-35199: Add an internal _PyTuple_ITEMS() macro (GH-10434)Victor Stinner-1/+1
* _PyTuple_ITEMS() gives access to the tuple->ob_item field and cast the first argument to PyTupleObject*. This internal macro is only usable if Py_BUILD_CORE is defined. * Replace &PyTuple_GET_ITEM(ob, 0) with _PyTuple_ITEMS(ob). * Replace PyTuple_GET_ITEM(op, 1) with &_PyTuple_ITEMS(ob)[1].
2018-11-01bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner-1/+1
* Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
2018-08-03bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)Victor Stinner-2/+3
sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
2018-07-16bpo-24618: Add a check in the code constructor. (GH-8283)Serhiy Storchaka-3/+15
Check that the size of the varnames tuple is enough at least for all arguments.
2018-04-19bpo-33299: Return an object itself for some types in _PyCode_ConstantKey(). ↵Serhiy Storchaka-4/+11
(GH-6513)
2017-12-03bpo-32176: Set CO_NOFREE in the code object constructor (GH-4675)Nick Coghlan-1/+9
Previously, CO_NOFREE was set in the compiler, which meant it could end up being set incorrectly when code objects were created directly. Setting it in the constructor based on freevars and cellvars ensures it is always accurate, regardless of how the code object is defined.
2017-09-08replace custom table with pyctype (#3456)Benjamin Peterson-12/+1
2017-09-08bpo-31393: Fix the use of PyUnicode_READY(). (#3451)Serhiy Storchaka-1/+5
2017-09-07update all_name_chars comment after 9020ac7cce97dddad51b285fffc31fe4ddf60898 ↵Benjamin Peterson-2/+1
(#3452)
2017-09-07optimize all_name_chars (#3442)Benjamin Peterson-14/+14
Remove redundant PyUnicode_Check call. Use a static table for checking chars.
2017-07-04bpo-30789: Use a single memory block for co_extra. (#2555)Serhiy Storchaka-39/+15
* bpo-30789: Use a single memory block for co_extra. * Address review comments.
2017-06-28bpo-30704, bpo-30604: Fix memleak in code_dealloc() (#2455)Victor Stinner-1/+2
Free also co_extra->ce_extras, not only co_extra.
2017-06-21bpo-30604: clean up co_extra support (#2144)Dino Viehland-12/+18
bpo-30604: port fix from 3.6 dropping binary compatibility tweaks
2017-04-20bpo-12414: Update code_sizeof() to take in account co_extra memory. (#1168)Dong-hee Na-2/+6
2017-03-02bpo-29683 - Fixes to _PyCode_SetExtra when co_extra->ce->extras is (#376)Brian Coleman-10/+14
allocated. On PyMem_Realloc failure, _PyCode_SetExtra should free co_extra if co_extra->ce_extras could not be allocated. On PyMem_Realloc success, _PyCode_SetExtra should set all unused slots in co_extra->ce_extras to NULL.
2017-01-24Issue #29337: Fixed possible BytesWarning when compare the code objects.Serhiy Storchaka-3/+3
Warnings could be emitted at compile time.
2017-01-24Issue #29337: Fixed possible BytesWarning when compare the code objects.Serhiy Storchaka-3/+3
Warnings could be emitted at compile time.
2017-01-24Issue #29337: Fixed possible BytesWarning when compare the code objects.Serhiy Storchaka-3/+3
Warnings could be emitted at compile time.
2016-12-16Issue #18896: Python function can now have more than 255 parameters.Serhiy Storchaka-7/+13
collections.namedtuple() now supports tuples with more than 255 elements.
2016-11-20Issue #19569: Compiler warnings are now emitted if use most of deprecatedSerhiy Storchaka-3/+2
functions.
2016-11-09Merge 3.5 (issue #27942)Yury Selivanov-0/+2
2016-11-09ssue #27942: Fix memory leak in codeobject.cYury Selivanov-0/+2
2016-10-04Issue #28350: String constants with null character no longer interned.Serhiy Storchaka-8/+8
2016-10-04Issue #28350: String constants with null character no longer interned.Serhiy Storchaka-8/+8
2016-09-30Issue #27942: String constants now interned recursively in tuples and ↵Serhiy Storchaka-7/+45
frozensets.
2016-09-30Issue #27942: String constants now interned recursively in tuples and ↵Serhiy Storchaka-7/+45
frozensets.
2016-09-07Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Martin Panter-1/+1
2016-09-07Make PyCodeObject.co_extra even more private to force users through the ↵Brett Cannon-23/+31
proper API.
2016-09-07Change error return value to be more consistent with the rest of PythonBrett Cannon-5/+5
2016-09-07use a the bool type for a boolean variableBenjamin Peterson-2/+4
2016-09-07Add the co_extra field and accompanying APIs to code objects.Brett Cannon-0/+91
This completes PEP 523.
2016-08-30Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger-1/+1
2016-04-15Issue #15984: Merge PyUnicode doc from 3.5Martin Panter-1/+1
2016-04-15Correct “an” → “a” with “Unicode”, “user”, “UTF”, etcMartin Panter-1/+1
This affects documentation, code comments, and a debugging messages.
2016-01-22code_richcompare() now uses the constants typesVictor Stinner-1/+138
Issue #25843: When compiling code, don't merge constants if they are equal but have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now correctly compiled to two different functions: f1() returns 1 (int) and f2() returns 1.0 (int), even if 1 and 1.0 are equal. Add a new _PyCode_ConstantKey() private function.
2016-01-20co_lnotab supports negative line number deltaVictor Stinner-4/+7
Issue #26107: The format of the co_lnotab attribute of code objects changes to support negative line number delta. Changes: * assemble_lnotab(): if line number delta is less than -128 or greater than 127, emit multiple (offset_delta, lineno_delta) in co_lnotab * update functions decoding co_lnotab to use signed 8-bit integers - dis.findlinestarts() - PyCode_Addr2Line() - _PyCode_CheckLineNumber() - frame_setlineno() * update lnotab_notes.txt * increase importlib MAGIC_NUMBER to 3361 * document the change in What's New in Python 3.6 * cleanup also PyCode_Optimize() to use better variable names