summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_code.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] GH-97779: Ensure that *all* frame objects are backed by "complete" ↵Miss Islington (bot)2022-10-051-0/+33
| | | | | | | frames (GH-97886) (cherry picked from commit 0ff8fd65838f9f9ed90d7a055d26a2ce9fc0ce85) Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
* GH-95150: Use position and exception tables for code hashing and equality ↵Miss Islington (bot)2022-08-011-0/+21
| | | | | | | (GH-95509) (cherry picked from commit c7e5bbaee88a71dc6e633e3cd451ed1798436382) Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* [3.11] gh-94485: Set line number of module's RESUME instruction to 0 as ↵Łukasz Langa2022-07-051-1/+0
| | | | | | | | | specified by PEP 626 (GH-94552) (GH-94562) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Mark Shannon <mark@hotpy.org> (cherry picked from commit 324d01944d16868b07df9e8eef6987766a31a36d)
* gh-84461: Fix ctypes and test_ctypes on Emscripten (GH-94142)Miss Islington (bot)2022-06-241-0/+2
| | | | | | | | - c_longlong and c_longdouble need experimental WASM bigint. - Skip tests that need threading - Define ``CTYPES_MAX_ARGCOUNT`` for Emscripten. libffi-emscripten 2022-06-23 supports up to 1000 args. (cherry picked from commit 8625802d854ec0152177a6ff0ac092e0e3ff98a5) Co-authored-by: Christian Heimes <christian@python.org>
* [3.11] GH-93662: Make sure that column offsets are correct in multi-line ↵Irit Katriel2022-06-161-1/+30
| | | | | method calls. (GH-93673) (#93895) Co-authored-by: Mark Shannon <mark@hotpy.org>
* GH-88116: Document that PyCodeNew is dangerous, and make PyCode_NewEmpty ↵Mark Shannon2022-04-211-0/+3
| | | | less dangerous. (GH-91790)
* GH-88116: Use a compact format to represent end line and column offsets. ↵Mark Shannon2022-04-211-39/+130
| | | | | | | | | | | | (GH-91666) * Stores all location info in linetable to conform to PEP 626. * Remove column table from code objects. * Remove end-line table from code objects. * Document new location table format
* bpo-46841: Use *inline* caching for `BINARY_OP` (GH-31543)Brandt Bucher2022-02-251-1/+1
|
* bpo-45923: Handle call events in bytecode (GH-30364)Mark Shannon2022-01-061-4/+11
| | | | * Add a RESUME instruction to handle "call" events.
* bpo-46202: Remove opcode POP_EXCEPT_AND_RERAISE (GH-30302)Irit Katriel2022-01-041-1/+3
| | | | | | * bpo-46202: remove opcode POP_EXCEPT_AND_RERAISE * do not assume that an exception group is truthy
* bpo-44525: Copy free variables in bytecode to allow calls to inner functions ↵Mark Shannon2021-11-231-1/+3
| | | | | | | | | | | to be specialized (GH-29595) * Make internal APIs that take PyFrameConstructor take a PyFunctionObject instead. * Add reference to function to frame, borrow references to builtins and globals. * Add COPY_FREE_VARS instruction to allow specialization of calls to inner functions.
* bpo-45229: Use doctest.DocTestSuite instead of run_doctest (GH-28468)Serhiy Storchaka2021-09-201-9/+7
| | | Alo use load_tests() for adding tests.
* bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005)Serhiy Storchaka2021-08-291-1/+3
|
* bpo-44980: fix test_constructor to return None value (GH-27898)andrei kulakov2021-08-231-1/+1
|
* Fix a SystemError in code.replace() (#27771)Guido van Rossum2021-08-161-0/+9
| | | | | | | While the comment said 'We don't bother resizing localspluskinds', this would cause .replace() to crash when it happened. (Also types.CodeType(), but testing that is tedious, and this tests all code paths.)
* Remove __cleanenv from PEP-657 tests (GH-27060)Ammar Askar2021-07-071-2/+2
|
* bpo-43950: Add option to opt-out of PEP-657 (GH-27023)Ammar Askar2021-07-071-1/+29
| | | | | Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com> Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
* bpo-44530: Add co_qualname field to PyCodeObject (GH-26941)Gabriele N. Tornetta2021-07-071-1/+9
|
* bpo-43950: use 0-indexed column offsets for bytecode positions (GH-27011)Batuhan Taskaya2021-07-041-1/+1
|
* bpo-43950: Add code.co_positions (PEP 657) (GH-26955)Pablo Galindo2021-07-021-0/+83
| | | | | | | | | | | | | | | This PR is part of PEP 657 and augments the compiler to emit ending line numbers as well as starting and ending columns from the AST into compiled code objects. This allows bytecodes to be correlated to the exact source code ranges that generated them. This information is made available through the following public APIs: * The `co_positions` method on code objects. * The C API function `PyCode_Addr2Location`. Co-authored-by: Batuhan Taskaya <isidentical@gmail.com> Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
* bpo-43693 Get rid of CO_NOFREE -- it's unused (GH-26839)Guido van Rossum2021-06-231-9/+5
| | | | | | All uses of this flag are either setting it or in doc or tests for it. So we should be able to get rid of it completely.
* bpo-43693: Clean up the PyCodeObject fields. (GH-26364)Eric Snow2021-05-261-2/+44
| | | | | | | | | | * Move up the comment about fields using in hashing/comparision. * Group the fields more clearly. * Add co_ncellvars and co_nfreevars. * Raise ValueError if nlocals != len(varnames), rather than aborting.
* bpo-40222: "Zero cost" exception handling (GH-25729)Mark Shannon2021-05-071-0/+1
| | | | | | | | "Zero cost" exception handling. * Uses a lookup table to determine how to handle exceptions. * Removes SETUP_FINALLY and POP_TOP block instructions, eliminating (most of) the runtime overhead of try statements. * Reduces the size of the frame object by about 60%.
* bpo-42739: Don't use sentinels to mark end of line table. (GH-25657)Mark Shannon2021-04-291-0/+6
| | | | | * 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.
* bpo-42246: Partial implementation of PEP 626. (GH-23113)Mark Shannon2020-11-121-1/+1
| | | * Implement new line number table format, as defined in PEP 626.
* bpo-40443: Remove unused imports in tests (GH-19804)Victor Stinner2020-04-301-1/+0
|
* Cleanup exit code for interpreter. (GH-17756)Mark Shannon2020-01-131-36/+0
|
* bpo-38839: Fix some unused functions in tests (GH-17189)Adam Johnson2019-11-191-1/+1
|
* bpo-37122: Make co->co_argcount represent the total number of positonal ↵Pablo Galindo2019-06-011-1/+1
| | | | arguments in the code object (GH-13726)
* bpo-37032: Add CodeType.replace() method (GH-13542)Victor Stinner2019-05-241-6/+60
|
* bpo-36851: Clean the frame stack if the execution ends with a return and the ↵Pablo Galindo2019-05-091-0/+38
| | | | stack is not empty (GH-13191)
* bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-291-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* bpo-32176: Set CO_NOFREE in the code object constructor (GH-4675)Nick Coghlan2017-12-031-0/+45
| | | | | | | | 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.
* bpo-30604: Skip CoExtra tests if ctypes is missing (#2356)Victor Stinner2017-06-231-3/+6
|
* bpo-30604: clean up co_extra support (#2144)Dino Viehland2017-06-211-3/+100
| | | bpo-30604: port fix from 3.6 dropping binary compatibility tweaks
* Issue #28350: String constants with null character no longer interned.Serhiy Storchaka2016-10-041-3/+17
|
* Issue #27942: String constants now interned recursively in tuples and ↵Serhiy Storchaka2016-09-301-1/+39
| | | | frozensets.
* Issue #20532: Tests which use _testcapi now are marked as CPython only.Serhiy Storchaka2014-02-071-2/+3
|
* PEP 3155 / issue #13448: Qualified name for classes and functions.Antoine Pitrou2011-11-251-1/+1
|
* #9424: Replace deprecated assert* methods in the Python test suite.Ezio Melotti2010-11-201-3/+3
|
* Merged revisions 79060 via svnmerge fromCollin Winter2010-03-181-2/+29
| | | | | | | | | | | | 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! ........
* Merged revisions 72487-72488,72879 via svnmerge fromAlexandre Vassalotti2009-07-211-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r72487 | jeffrey.yasskin | 2009-05-08 17:51:06 -0400 (Fri, 08 May 2009) | 7 lines PyCode_NewEmpty: Most uses of PyCode_New found by http://www.google.com/codesearch?q=PyCode_New are trying to build an empty code object, usually to put it in a dummy frame object. This patch adds a PyCode_NewEmpty wrapper which lets the user specify just the filename, function name, and first line number, instead of also requiring lots of code internals. ........ r72488 | jeffrey.yasskin | 2009-05-08 18:23:21 -0400 (Fri, 08 May 2009) | 13 lines Issue 5954, PyFrame_GetLineNumber: Most uses of PyCode_Addr2Line (http://www.google.com/codesearch?q=PyCode_Addr2Line) are just trying to get the line number of a specified frame, but there's no way to do that directly. Forcing people to go through the code object makes them know more about the guts of the interpreter than they should need. The remaining uses of PyCode_Addr2Line seem to be getting the line from a traceback (for example, http://www.google.com/codesearch/p?hl=en#u_9_nDrchrw/pygame-1.7.1release/src/base.c&q=PyCode_Addr2Line), which is replaced by the tb_lineno field. So we may be able to deprecate PyCode_Addr2Line entirely for external use. ........ r72879 | jeffrey.yasskin | 2009-05-23 19:23:01 -0400 (Sat, 23 May 2009) | 14 lines Issue #6042: lnotab-based tracing is very complicated and isn't documented very well. There were at least 3 comment blocks purporting to document co_lnotab, and none did a very good job. This patch unifies them into Objects/lnotab_notes.txt which tries to completely capture the current state of affairs. I also discovered that we've attached 2 layers of patches to the basic tracing scheme. The first layer avoids jumping to instructions that don't start a line, to avoid problems in if statements and while loops. The second layer discovered that jumps backward do need to trace at instructions that don't start a line, so it added extra lnotab entries for 'while' and 'for' loops, and added a special case for backward jumps within the same line. I replaced these patches by just treating forward and backward jumps differently. ........
* #2621 rename test.test_support to test.supportBenjamin Peterson2008-05-201-1/+1
|
* Merged revisions 62090-62091,62096,62100,62102,62110-62114 via svnmerge fromBenjamin Peterson2008-04-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r62090 | brett.cannon | 2008-04-01 07:37:43 -0500 (Tue, 01 Apr 2008) | 3 lines Generalize test.test_support.test_stdout() with a base context manager so that it is easy to capture stderr if desired. ........ r62091 | brett.cannon | 2008-04-01 07:46:02 -0500 (Tue, 01 Apr 2008) | 3 lines Add ``if __name__ == '__main__'`` to some test files where it didn't take a lot of effort to do so. ........ r62096 | amaury.forgeotdarc | 2008-04-01 17:52:48 -0500 (Tue, 01 Apr 2008) | 4 lines Newly enabled test appears to leak: it registers the same codec on each iteration. Do it only once at load time. ........ r62100 | amaury.forgeotdarc | 2008-04-01 19:55:04 -0500 (Tue, 01 Apr 2008) | 4 lines A DocTestSuite cannot run multiple times: it clears its globals dictionary after the first run. Rebuild the DocTestSuite on each iteration. ........ r62102 | jeffrey.yasskin | 2008-04-01 23:07:44 -0500 (Tue, 01 Apr 2008) | 3 lines Try to make test_signal less flaky. I still see some flakiness in test_itimer_prof. ........ r62110 | vinay.sajip | 2008-04-02 16:09:27 -0500 (Wed, 02 Apr 2008) | 1 line Fix: #2315, #2316, #2317: TimedRotatingFileHandler - changed logic to better handle daylight savings time, deletion of old log files, and fixed a bug in calculating rollover when no logging occurs for a longer interval than the rollover period. ........ r62111 | vinay.sajip | 2008-04-02 16:10:23 -0500 (Wed, 02 Apr 2008) | 1 line Added updates with respect to recent changes to TimedRotatingFileHandler. ........ r62112 | vinay.sajip | 2008-04-02 16:17:25 -0500 (Wed, 02 Apr 2008) | 1 line Added updates with respect to recent changes to TimedRotatingFileHandler. ........ r62113 | amaury.forgeotdarc | 2008-04-02 16:18:46 -0500 (Wed, 02 Apr 2008) | 2 lines Remove debug prints; the buildbot now passes the tests ........ r62114 | benjamin.peterson | 2008-04-02 16:20:35 -0500 (Wed, 02 Apr 2008) | 2 lines Suggested proposed changes to Python be considered on some mailing lists first ........
* Change all the function attributes from func_* -> __*__. This gets ridNeal Norwitz2007-02-251-6/+6
| | | | | of func_name, func_dict and func_doc as they already exist as __name__, __dict__ and __doc__.
* * Remove PRINT_ITEM(_TO), PRINT_NEWLINE(_TO) opcodes.Georg Brandl2007-02-091-1/+1
| | | | | | | * Fix some docstrings and one Print -> print. * Fix test_{class,code,descrtut,dis,extcall,parser,popen,pkg,subprocess,syntax,traceback}. These were the ones that generated code with a print statement. In most remaining failing tests there's an issue with the soft space.
* Fix a bunch of doctests with the -d option of refactor.py.Guido van Rossum2007-02-091-3/+3
| | | | We still have 27 failing tests (down from 39).
* Fix most trivially-findable print statements.Guido van Rossum2007-02-091-2/+2
| | | | | | | | | There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.)
* Rip out 'long' and 'L'-suffixed integer literals.Guido van Rossum2007-01-151-1/+1
| | | | (Rough first cut.)
* Jiwon Seo's PEP 3102 implementation.Guido van Rossum2006-10-271-2/+24
| | | | | See SF#1549670. The compiler package has not yet been updated.