summaryrefslogtreecommitdiff
path: root/Python/ceval.c
AgeCommit message (Collapse)AuthorLines
2011-01-06Issue #10655: Fix the build on PowerPC on Linux with GCC when building withDavid Malcolm-4/+5
timestamp profiling (--with-tsc): the preprocessor test for the PowerPC support now looks for "__powerpc__" as well as "__ppc__": the latter seems to only be present on OS X; the former is the correct one for Linux with GCC.
2010-12-03Merge branches/pep-0384.Martin v. Löwis-3/+4
2010-11-30Remove redundant includes of headers that are already included by Python.h.Georg Brandl-1/+0
2010-10-17make hashes always the size of pointers; introduce Py_hash_t #9778Benjamin Peterson-1/+1
2010-10-13ceval.c: catch recursion error on _PyUnicode_AsString(co->co_filename)Victor Stinner-0/+4
2010-09-25revert r85003, poorly considered; breaks testsBenjamin Peterson-1/+1
2010-09-25don't count keyword arguments as positional #9943Benjamin Peterson-1/+1
2010-09-13Issue #9828: Destroy the GIL in Py_Finalize(), so that it gets properlyAntoine Pitrou-4/+9
re-created on a subsequent call to Py_Initialize(). The problem (a crash) wouldn't appear in 3.1 or 2.7 where the GIL's structure is more trivial.
2010-09-10typoBenjamin Peterson-2/+2
2010-09-10use Py_REFCNTBenjamin Peterson-2/+2
2010-09-10remove gil_drop_request in --without-threadsBenjamin Peterson-4/+13
2010-09-10use DISPATCH() instead of continueBenjamin Peterson-1/+1
2010-09-10#4617: Previously it was illegal to delete a name from the localAmaury Forgeot d'Arc-16/+34
namespace if it occurs as a free variable in a nested block. This limitation of the compiler has been lifted, and a new opcode introduced (DELETE_DEREF). This sample was valid in 2.6, but fails to compile in 3.x without this change:: >>> def f(): ... def print_error(): ... print(e) ... try: ... something ... except Exception as e: ... print_error() ... # implicit "del e" here This sample has always been invalid in Python, and now works:: >>> def outer(x): ... def inner(): ... return x ... inner() ... del x There is no need to bump the PYC magic number: the new opcode is used for code that did not compile before.
2010-09-04Issue #9225: Remove the ROT_FOUR and DUP_TOPX opcode, the latter replacedAntoine Pitrou-38/+9
by the new (and simpler) DUP_TOP_TWO. Performance isn't changed, but our bytecode is a bit simplified. Patch by Demur Rumed.
2010-08-17Issue #9425: save/restore exception on filename encodingVictor Stinner-1/+6
_PyUnicode_AsString() raises an exception on unencodable filename.
2010-08-13Issue #9203: Computed gotos are now enabled by default on supportedAntoine Pitrou-4/+17
compilers (which are detected by the configure script). They can still be disable selectively by specifying --without-computed-gotos.
2010-07-20revert unintended changesBenjamin Peterson-8/+8
2010-07-20move test_trace.py so as not to conflict with future tests for the trace moduleBenjamin Peterson-8/+8
2010-07-10#3071: tell how many values were expected when unpacking too many.Georg Brandl-1/+2
2010-06-25only take into account positional arguments count in related error messagesBenjamin Peterson-3/+3
2010-06-23Issue #8930: Remaining indentation fixes after the Grand Unified Indenting.Stefan Krah-42/+42
2010-05-30use atomic structures in non-thread versionBenjamin Peterson-1/+1
2010-05-09Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou-3367/+3367
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-03read eval_breaker with atomic api with computed gotosBenjamin Peterson-1/+1
2010-05-03Make (most of) Python's tests pass under Thread Sanitizer.Jeffrey Yasskin-19/+44
http://code.google.com/p/data-race-test/wiki/ThreadSanitizer is a dynamic data race detector that runs on top of valgrind. With this patch, the binaries at http://code.google.com/p/data-race-test/wiki/ThreadSanitizer#Binaries pass many but not all of the Python tests. All of regrtest still passes outside of tsan. I've implemented part of the C1x atomic types so that we can explicitly mark variables that are used across threads, and get defined behavior as compilers advance. I've added tsan's client header and implementation to the codebase in dynamic_annotations.{h,c} (docs at http://code.google.com/p/data-race-test/wiki/DynamicAnnotations). Unfortunately, I haven't been able to get helgrind and drd to give sensible error messages, even when I use their client annotations, so I'm not supporting them.
2010-04-01Merged revisions 79555 via svnmerge fromAntoine Pitrou-12/+1
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79555 | antoine.pitrou | 2010-04-01 18:42:11 +0200 (jeu., 01 avril 2010) | 5 lines Issue #8276: PyEval_CallObject() is now only available in macro form. The function declaration, which was kept for backwards compatibility reasons, is now removed (the macro was introduced in 1997!). ........
2010-03-21nest if for clarityBenjamin Peterson-8/+8
2010-03-21count keyword only arguments as part of the totalBenjamin Peterson-2/+2
2010-03-21Merged revisions 78028 via svnmerge fromBenjamin Peterson-3/+0
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78028 | benjamin.peterson | 2010-02-06 13:40:18 -0600 (Sat, 06 Feb 2010) | 1 line remove pointless error checking ........
2010-03-21cleanup a bitBenjamin Peterson-24/+15
2010-03-21Merged revisions 79205,79219,79228,79230,79232-79233,79235,79237 via ↵Benjamin Peterson-18/+18
svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r79205 | benjamin.peterson | 2010-03-21 12:34:54 -0500 (Sun, 21 Mar 2010) | 1 line rewrite a bit ........ r79219 | benjamin.peterson | 2010-03-21 14:24:08 -0500 (Sun, 21 Mar 2010) | 1 line flatten condition ........ r79228 | benjamin.peterson | 2010-03-21 14:35:39 -0500 (Sun, 21 Mar 2010) | 1 line remove pointless condition ........ r79230 | benjamin.peterson | 2010-03-21 14:39:52 -0500 (Sun, 21 Mar 2010) | 1 line co_varnames is certainly a tuple, so let's not waste time finding out ........ r79232 | benjamin.peterson | 2010-03-21 14:54:56 -0500 (Sun, 21 Mar 2010) | 1 line fix import ........ r79233 | benjamin.peterson | 2010-03-21 14:56:37 -0500 (Sun, 21 Mar 2010) | 1 line don't write duplicate tests ........ r79235 | benjamin.peterson | 2010-03-21 15:21:00 -0500 (Sun, 21 Mar 2010) | 4 lines improve error message from passing inadequate number of keyword arguments #6474 Note this removes the "non-keyword" or "keyword" phrases from these messages. ........ r79237 | benjamin.peterson | 2010-03-21 15:30:30 -0500 (Sun, 21 Mar 2010) | 1 line take into account keyword arguments when passing too many args ........
2010-03-12Issue #6697: use %U format instead of _PyUnicode_AsString(), becauseVictor Stinner-2/+2
_PyUnicode_AsString() was not checked for error (NULL). The unicode string is no more truncated to 200 or 400 *bytes*.
2010-03-07prevent generator finalization from invalidating sys.exc_info() #7173Benjamin Peterson-1/+1
2010-02-11fix commentBenjamin Peterson-1/+1
2009-11-10Merge in the new GIL.Antoine Pitrou-61/+101
2009-10-31Merged revisions 75982 via svnmerge fromMark Dickinson-1/+19
svn+ssh://pythondev@svn.python.org/python/trunk ........ r75982 | mark.dickinson | 2009-10-31 10:11:28 +0000 (Sat, 31 Oct 2009) | 5 lines Issue #6603: Fix --with-tsc build failures on x86-64 that resulted from a gcc inline assembler peculiarity. (gcc's "A" constraint apparently means 'rax or rdx' in 64-bit mode, not edx:eax or rdx:rax as one might expect.) ........
2009-10-03silence with (void) two warnings about computed and unused value of POP()Ezio Melotti-2/+2
2009-07-21Merged revisions 73750 via svnmerge fromAlexandre Vassalotti-5/+4
svn+ssh://pythondev@svn.python.org/python/trunk ........ r73750 | benjamin.peterson | 2009-07-01 19:45:19 -0400 (Wed, 01 Jul 2009) | 1 line small optimization: avoid popping the current block until we have to ........
2009-07-21Merged revisions 72487-72488,72879 via svnmerge fromAlexandre Vassalotti-15/+12
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. ........
2009-06-28use stack altering macros hereBenjamin Peterson-7/+7
2009-06-28Merged revisions 73614-73615 via svnmerge fromBenjamin Peterson-2/+4
svn+ssh://pythondev@svn.python.org/python/trunk ........ r73614 | benjamin.peterson | 2009-06-28 11:08:02 -0500 (Sun, 28 Jun 2009) | 1 line add two generic macros for peeking and setting in the stack ........ r73615 | benjamin.peterson | 2009-06-28 11:14:07 -0500 (Sun, 28 Jun 2009) | 1 line use stack macros ........
2009-06-28this is better written as an assertionBenjamin Peterson-9/+3
2009-06-28update commentsBenjamin Peterson-5/+12
2009-06-28correctly rearrange the stack in the exception case of WITH_CLEANUPBenjamin Peterson-1/+12
2009-06-28Merged revisions 72912,72920,72940 via svnmerge fromBenjamin Peterson-7/+63
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72912 | benjamin.peterson | 2009-05-25 08:13:44 -0500 (Mon, 25 May 2009) | 5 lines add a SETUP_WITH opcode It speeds up the with statement and correctly looks up the special methods involved. ........ r72920 | benjamin.peterson | 2009-05-25 15:12:57 -0500 (Mon, 25 May 2009) | 1 line take into account the fact that SETUP_WITH pushes a finally block ........ r72940 | benjamin.peterson | 2009-05-26 07:49:59 -0500 (Tue, 26 May 2009) | 1 line teach the peepholer about SETUP_WITH ........
2009-05-30Merged revisions 73064 via svnmerge fromAntoine Pitrou-2/+16
svn+ssh://pythondev@svn.python.org/python/trunk ........ r73064 | antoine.pitrou | 2009-05-30 23:27:00 +0200 (sam., 30 mai 2009) | 4 lines Issue #5330: C functions called with keyword arguments were not reported by the various profiling modules (profile, cProfile). Patch by Hagen Fürstenau. ........
2009-02-26Merged revisions 69811,69947 via svnmerge fromBenjamin Peterson-1/+4
svn+ssh://pythondev@svn.python.org/python/trunk ........ r69811 | collin.winter | 2009-02-20 13:30:41 -0600 (Fri, 20 Feb 2009) | 2 lines Issue 5176: special-case string formatting in BINARY_MODULO implementation. This shows a modest (1-3%) speed-up in templating systems, for example. ........ r69947 | jeffrey.yasskin | 2009-02-24 16:48:34 -0600 (Tue, 24 Feb 2009) | 3 lines Tools/scripts/analyze_dxp.py, a module with some helper functions to analyze the output of sys.getdxp(). ........
2009-02-25http://bugs.python.org/issue4715Jeffrey Yasskin-15/+65
This patch by Antoine Pitrou optimizes the bytecode for conditional branches by merging the following "POP_TOP" instruction into the conditional jump. For example, the list comprehension "[x for x in l if not x]" produced the following bytecode: 1 0 BUILD_LIST 0 3 LOAD_FAST 0 (.0) >> 6 FOR_ITER 23 (to 32) 9 STORE_FAST 1 (x) 12 LOAD_FAST 1 (x) 15 JUMP_IF_TRUE 10 (to 28) 18 POP_TOP 19 LOAD_FAST 1 (x) 22 LIST_APPEND 2 25 JUMP_ABSOLUTE 6 >> 28 POP_TOP 29 JUMP_ABSOLUTE 6 >> 32 RETURN_VALUE but after the patch it produces the following bytecode: 1 0 BUILD_LIST 0 3 LOAD_FAST 0 (.0) >> 6 FOR_ITER 18 (to 27) 9 STORE_FAST 1 (x) 12 LOAD_FAST 1 (x) 15 POP_JUMP_IF_TRUE 6 18 LOAD_FAST 1 (x) 21 LIST_APPEND 2 24 JUMP_ABSOLUTE 6 >> 27 RETURN_VALUE Notice that not only the code is shorter, but the conditional jump (POP_JUMP_IF_TRUE) jumps right to the start of the loop instead of going through the JUMP_ABSOLUTE at the end. "continue" statements are helped similarly. Furthermore, the old jump opcodes (JUMP_IF_FALSE, JUMP_IF_TRUE) have been replaced by two new opcodes: - JUMP_IF_TRUE_OR_POP, which jumps if true and pops otherwise - JUMP_IF_FALSE_OR_POP, which jumps if false and pops otherwise
2009-01-25Issue #4753: By enabling a configure option named '--with-computed-gotos'Antoine Pitrou-188/+309
on compilers that support it (notably: gcc, SunPro, icc), the bytecode evaluation loop is compiled with a new dispatch mechanism which gives speedups of up to 20%, depending on the system, on various benchmarks.
2009-01-17fix compiler warningBenjamin Peterson-1/+1