summaryrefslogtreecommitdiff
path: root/Objects/codeobject.c
AgeCommit message (Collapse)AuthorLines
2022-08-23[3.10] GH-96187: Prevent _PyCode_GetExtra to return garbage for negative ↵Pablo Galindo Salgado-1/+1
indexes (GH-96188). (#96210) (cherry picked from commit 16ebae4cd4029205d932751f26c719c6cb8a6e92) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-06-12[3.10] Add more const modifiers. (GH-26691). (GH-26692)Serhiy Storchaka-3/+3
(cherry picked from commit be8b631b7a587aa781245e14c8cca32970e1be5b) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-04-29bpo-42739: Don't use sentinels to mark end of line table. (GH-25657)Mark Shannon-20/+21
* Add length parameter to PyLineTable_InitAddressRange and doen't use sentinel values at end of table. Makes the line number table more robust. * Update PyCodeAddressRange to match PEP 626.
2021-04-01bpo-27129: Use instruction offsets, not byte offsets, in bytecode and ↵Mark Shannon-1/+1
internally. (GH-25069) * Use instruction offset, rather than bytecode offset. Streamlines interpreter dispatch a bit, and removes most EXTENDED_ARGs for jumps. * Change some uses of PyCode_Addr2Line to PyFrame_GetLineNumber
2021-01-30bpo-40455: Fix gcc10+ warning about writing into a section of offset 0 ↵Pablo Galindo-2/+2
(GH-24384)
2021-01-05bpo-42823: Fix frame lineno when frame.f_trace is set (GH-24099)Mark Shannon-1/+2
* Add test for frame.f_lineno with/without tracing. * Make sure that frame.f_lineno is correct regardless of whether frame.f_trace is set. * Update importlib * Add NEWS
2020-12-01bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587)Victor Stinner-1/+1
No longer use deprecated aliases to functions: * Replace PyObject_MALLOC() with PyObject_Malloc() * Replace PyObject_REALLOC() with PyObject_Realloc() * Replace PyObject_FREE() with PyObject_Free() * Replace PyObject_Del() with PyObject_Free() * Replace PyObject_DEL() with PyObject_Free()
2020-12-01bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)Victor Stinner-8/+8
No longer use deprecated aliases to functions: * Replace PyMem_MALLOC() with PyMem_Malloc() * Replace PyMem_REALLOC() with PyMem_Realloc() * Replace PyMem_FREE() with PyMem_Free() * Replace PyMem_Del() with PyMem_Free() * Replace PyMem_DEL() with PyMem_Free() Modify also the PyMem_DEL() macro to use directly PyMem_Free().
2020-11-12bpo-42246: Partial implementation of PEP 626. (GH-23113)Mark Shannon-76/+310
* Implement new line number table format, as defined in PEP 626.
2020-10-20bpo-42093: Add opcode cache for LOAD_ATTR (GH-22803)Pablo Galindo-2/+2
2020-07-10bpo-41263: Convert code.__new__ to Argument Clinic (GH-21426)Serhiy Storchaka-37/+36
2020-06-22bpo-41078: Rename pycore_tupleobject.h to pycore_tuple.h (GH-21056)Victor Stinner-2/+2
2020-06-11Restrict co_code to be under INT_MAX in codeobject (GH-20628)Ammar Askar-0/+8
2020-04-15bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner-1/+1
If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
2020-04-14bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)Victor Stinner-3/+3
Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET() for consistency with _PyThreadState_GET() and to have a shorter name (help to fit into 80 columns). Add also "assert(tstate != NULL);" to the function.
2020-04-14bpo-40268: Include explicitly pycore_interp.h (GH-19505)Victor Stinner-1/+2
pycore_pystate.h no longer includes pycore_interp.h: it's now included explicitly in files accessing PyInterpreterState.
2020-04-08bpo-40170: PyObject_NEW() becomes an alias to PyObject_New() (GH-19379)Victor Stinner-1/+1
The PyObject_NEW() macro becomes an alias to the PyObject_New() macro, and the PyObject_NEW_VAR() macro becomes an alias to the PyObject_NewVar() macro, to hide implementation details. They no longer access directly the PyTypeObject.tp_basicsize member. Exclude _PyObject_SIZE() and _PyObject_VAR_SIZE() macros from the limited C API. Replace PyObject_NEW() with PyObject_New() and replace PyObject_NEW_VAR() with PyObject_NewVar().
2020-02-07bpo-39573: Use Py_TYPE() macro in Objects directory (GH-18392)Victor Stinner-1/+1
Replace direct access to PyObject.ob_type with Py_TYPE().
2020-01-27bpo-38631: Avoid Py_FatalError() in PyCode_New() (GH-18215)Victor Stinner-26/+46
intern_strings() now raises a SystemError, rather than calling Py_FatalError(). intern_string_constants() now reports exceptions to the caller, rather than ignoring silently exceptions.
2020-01-01Document CodeType.replace (GH-17776)Anthony Sottile-2/+2
2019-11-26bpo-38922: Raise code.__new__ audit event when code object replace() is ↵Steve Dower-0/+7
called (GH-17394)
2019-07-01bpo-37221: Add PyCode_NewWithPosOnlyArgs to be used internally and set ↵Pablo Galindo-15/+31
PyCode_New as a compatibility wrapper (GH-13959) Add PyCode_NewEx to be used internally and set PyCode_New as a compatibility wrapper
2019-06-12bpo-26219: Fix compiler warning in _PyCode_InitOpcache() (GH-13997)Victor Stinner-1/+1
Fix MSVC warning: objects\codeobject.c(285): warning C4244: '=': conversion from 'Py_ssize_t' to 'unsigned char', possible loss of data
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.