summaryrefslogtreecommitdiff
path: root/Objects/codeobject.c
AgeCommit message (Collapse)AuthorLines
2018-07-16bpo-24618: Add a check in the code constructor. (GH-8283)Miss Islington (bot)-3/+15
Check that the size of the varnames tuple is enough at least for all arguments. (cherry picked from commit bd47384e07bde38a8f18b90b4cea02a505d95c75) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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
2015-12-19Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.Serhiy Storchaka-1/+1
This allows sys.getsize() to work correctly with their subclasses with __slots__ defined.
2013-10-10Issue #18874: PyCode_New() now ensures that the filename is a ready UnicodeVictor Stinner-0/+5
string. This change does nothing is most cases, but it is useful on Windows in some cases.
2012-07-26Issue #15456: Fix code __sizeof__ after #12399 change.Martin v. Löwis-1/+17
Patch by Serhiy Storchaka.
2011-12-12Make PyUnicode_Copy() private => _PyUnicode_Copy()Victor Stinner-1/+1
Undocument the function. Make also decode_utf8_errors() as private (static).
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.
2011-10-11Reuse PyUnicode_Copy() in validate_and_copy_tuple()Victor Stinner-3/+1
2011-09-28Implement PEP 393.Martin v. Löwis-6/+9
2011-08-10Replace Py_NotImplemented returns with the macro form Py_RETURN_NOTIMPLEMENTED.Brian Curtin-2/+1
The macro was introduced in #12724.
2011-06-25map cells to arg slots at code creation time (closes #12399)Benjamin Peterson-29/+65
This removes nested loops in PyEval_EvalCodeEx.
2011-01-05Remove arbitrary string length limitsVictor Stinner-2/+2
PyUnicode_FromFormat() and PyErr_Format() allocates a buffer of the needed size, it is no more a fixed-buffer of 500 bytes.
2011-01-04Issue #9566: use Py_ssize_t instead of intVictor Stinner-2/+3
2010-10-17make hashes always the size of pointers; introduce Py_hash_t #9778Benjamin Peterson-2/+2
2010-10-15Remove unused label.Georg Brandl-4/+0
2010-10-15Use locale encoding if Py_FileSystemDefaultEncoding is not setVictor Stinner-13/+0
* PyUnicode_EncodeFSDefault(), PyUnicode_DecodeFSDefaultAndSize() and PyUnicode_DecodeFSDefault() use the locale encoding instead of UTF-8 if Py_FileSystemDefaultEncoding is NULL * redecode_filenames() functions and _Py_code_object_list (issue #9630) are no more needed: remove them
2010-09-29Issue #9630: Redecode filenames when setting the filesystem encodingVictor Stinner-0/+17
Redecode the filenames of: - all modules: __file__ and __path__ attributes - all code objects: co_filename attribute - sys.path - sys.meta_path - sys.executable - sys.path_importer_cache (keys) Keep weak references to all code objects until initfsencoding() is called, to be able to redecode co_filename attribute of all code objects.
2010-05-09Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou-431/+431
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
2010-05-07code_repr(): use %U to format the filenameVictor Stinner-8/+12
Avoid useless unicode decoding/recoding of the filename.
2010-03-18Merged revisions 79060 via svnmerge fromCollin Winter-1/+4
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79060 | collin.winter | 2010-03-18 14:54:01 -0700 (Thu, 18 Mar 2010) | 4 lines Add support for weak references to code objects. This will be used by an optimization in the incoming Python 3 JIT. Patch by Reid Kleckner! ........