summaryrefslogtreecommitdiff
path: root/Python/symtable.c
AgeCommit message (Collapse)AuthorLines
2010-05-09Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou-1150/+1150
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. ........
2009-11-20Merged revisions 76423-76424 via svnmerge fromBenjamin Peterson-3/+2
svn+ssh://pythondev@svn.python.org/python/trunk ........ r76423 | benjamin.peterson | 2009-11-19 19:15:53 -0600 (Thu, 19 Nov 2009) | 1 line provide line number for lambdas ........ r76424 | benjamin.peterson | 2009-11-19 19:16:58 -0600 (Thu, 19 Nov 2009) | 1 line genexps have linenos ........
2009-04-02Merged revisions 71026 via svnmerge fromBenjamin Peterson-4/+7
svn+ssh://pythondev@svn.python.org/python/trunk ........ r71026 | benjamin.peterson | 2009-04-01 21:52:46 -0500 (Wed, 01 Apr 2009) | 1 line fix error handling ........
2009-03-31Merged revisions 70801,70809 via svnmerge fromJeremy Hylton-22/+101
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70801 | jeremy.hylton | 2009-03-31 09:17:03 -0400 (Tue, 31 Mar 2009) | 3 lines Add is_declared_global() which distinguishes between implicit and explicit global variables. ........ r70809 | jeremy.hylton | 2009-03-31 09:48:15 -0400 (Tue, 31 Mar 2009) | 14 lines Global statements from one function leaked into parallel functions. Re http://bugs.python.org/issue4315 The symbol table used the same name dictionaries to recursively analyze each of its child blocks, even though the dictionaries are modified during analysis. The fix is to create new temporary dictionaries via the analyze_child_block(). The only information that needs to propagate back up is the names of the free variables. Add more comments and break out a helper function. This code doesn't get any easier to understand when you only look at it once a year. ........
2008-08-17uhh PySTEntry->ste_unoptimized has to be exposed tooBenjamin Peterson-0/+1
2008-08-17expose PySTEntry.nested so the symtable module will workBenjamin Peterson-0/+1
2008-08-16PySTEntry's constructor is static; there's no point in a fancy API nameBenjamin Peterson-4/+4
2008-08-16include filename and line number in SyntaxErrorBenjamin Peterson-0/+3
2008-06-09This reverts r63675 based on the discussion in this thread:Gregory P. Smith-14/+14
http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
2008-05-26Renamed PyString to PyBytesChristian Heimes-14/+14
2008-03-30Patch #2511: Give the "excepthandler" AST item proper attributes by making ↵Georg Brandl-5/+5
it a Sum.
2008-03-15Handle memory allocation failure. Found by Adam OlsenNeal Norwitz-2/+3
2008-02-23Patch #1759: Backport of PEP 3129 class decoratorsChristian Heimes-2/+4
with some help from Georg
2007-07-21PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis-2/+1
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
2006-08-19Handle PyString_FromInternedString() failing (unlikely, but possible).Neal Norwitz-9/+8
Klocwork #325 (I'm not backporting this, but if someone wants to, feel free.)
2006-08-12Klocwork made another run and found a bunch more problems.Neal Norwitz-1/+6
This is the first batch of fixes that should be easy to verify based on context. This fixes problem numbers: 220 (ast), 323-324 (symtable), 321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree).
2006-07-23Handle more mem alloc issues found with failmallocNeal Norwitz-0/+2
2006-07-22Fix more memory allocation issues found with failmalloc.Neal Norwitz-1/+1
2006-07-21Handle more memory allocation failures without crashing.Neal Norwitz-2/+10
2006-06-04Patch #1346214: correctly optimize away "if 0"-style stmtsGeorg Brandl-1/+20
(thanks to Neal for review)
2006-04-12Make symtable.c safe for C++ compilers. Changed macros in the same way asAnthony Baxter-11/+13
compile.c to add a cast.
2006-02-28No need to export PySTEntry_New, it is only used in symtable.cNeal Norwitz-1/+2
2006-02-27PEP 343 -- the with-statement.Guido van Rossum-14/+30
This was started by Mike Bland and completed by Guido (with help from Neal). This still needs a __future__ statement added; Thomas is working on Michael's patch for that aspect. There's a small amount of code cleanup and refactoring in ast.c, compile.c and ceval.c (I fixed the lltrace behavior when EXT_POP is used -- however I had to make lltrace a static global).
2006-02-27PEP 308 implementation, including minor refdocs and some testcases. ItThomas Wouters-0/+5
breaks the parser module, because it adds the if/else construct as well as two new grammar rules for backward compatibility. If no one else fixes parsermodule, I guess I'll go ahead and fix it later this week. The TeX code was checked with texcheck.py, but not rendered. There is actually a slight incompatibility: >>> (x for x in lambda:0) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: iteration over non-sequence changes into >>> (x for x in lambda: 0) File "<stdin>", line 1 (x for x in lambda: 0) ^ SyntaxError: invalid syntax Since there's no way the former version can be useful, it's probably a bugfix ;)
2006-02-16Use Py_ssize_t to count theMartin v. Löwis-1/+1
2006-02-15Merge ssize_t branch.Martin v. Löwis-3/+5
2006-01-08analyze_cells(): This no longer compiled under VC 7.1.Tim Peters-1/+2
Move declaration of local `flags` to top of block.
2006-01-08Fix icc warnings: conversion from "long" to "int" may lose significant bitsNeal Norwitz-10/+11
2006-01-07Fix icc warnings: shadowing local variable (i) and complex is set but not ↵Neal Norwitz-3/+2
used, so remove
2005-12-19Bug #889500, fix line number on SyntaxWarning for global declarations.Neal Norwitz-7/+10
2005-11-24Fix a few more ref leaks. Backport candidateNeal Norwitz-1/+3
2005-11-19Last batch of ref leaks in new AST code.Neal Norwitz-4/+8
Also converted a bunch of assert(0) to SystemError's. There are still printfs, etc that need to be cleaned up.
2005-11-16Bring handling of genexpr in line with other anonymous scope namesNick Coghlan-4/+3
2005-11-13Fix a lot of memory and ref leaks in error paths.Neal Norwitz-33/+75
(Call symtable_exit_block or compiler_exit_scope as appropriate) Use PyMem_Free on c_future since it was allocated with PyMem_Malloc
2005-10-24Do not pollute name block_ty, prefix with _Py_Neal Norwitz-3/+3
2005-10-23Fix check_unoptimized() function. The only optimized namespaces areNeil Schemenauer-1/+1
in function blocks. This elimiates spurious warnings about "import *" and related statements at the class level.
2005-10-23Fix private name mangling. The symtable also must do mangles so thatNeil Schemenauer-14/+30
the scope of names can be correctly determined.
2005-10-21Fix a bunch of imports to use code.h instead of compile.h.Jeremy Hylton-1/+0
Remove duplicate declarations from compile.h
2005-10-21ANSI-C-ify the placement of local var declarations.Armin Rigo-2/+4
2005-10-20Merge ast-branch to headJeremy Hylton-63/+1178
This change implements a new bytecode compiler, based on a transformation of the parse tree to an abstract syntax defined in Parser/Python.asdl. The compiler implementation is not complete, but it is in stable enough shape to run the entire test suite excepting two disabled tests.
2004-05-19SF patch #872326: Generator expression implementationRaymond Hettinger-0/+2
(Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release.
2003-05-21Fix for SF [ 734869 ] Lambda functions in list comprehensionsJeremy Hylton-0/+1
The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module. Repair by move tmpname into the symtable entry. Bugfix candidate.
2001-12-10Add a comment explaining the st_symbols cache.Jeremy Hylton-1/+15
2001-12-08PySymtableEntry_New(): I'm not sure what this routine is doing, but itTim Peters-0/+1
was obviously leaking an int object when whatever the heck it's looking for was found. Repaired that. This accounts for why entering function and class definitions at an interactive prompt leaked a reference to the integer 1 each time. Bugfix candidate.
2001-12-04SF bug #488687 reported by Neal NorwitzJeremy Hylton-0/+1
The error for assignment to __debug__ used ste->ste_opt_lineno instead of n->n_lineno. The latter was at best incorrect; often the slot was uninitialized. Two fixes here: Use the correct lineno for the error. Initialize ste_opt_lineno in PySymtable_New(); while there are no current cases where it is referenced unless it has already been assigned to, there is no harm in initializing it.
2001-11-28ste_repr(): Conversion of sprintf() to PyOS_snprintf() for bufferBarry Warsaw-4/+5
overrun avoidance.
2001-09-20Add optional docstrings to member descriptors. For backwardsGuido van Rossum-9/+20
compatibility, this required all places where an array of "struct memberlist" structures was declared that is referenced from a type's tp_members slot to change the type of the structure to PyMemberDef; "struct memberlist" is now only used by old code that still calls PyMember_Get/Set. The code in PyObject_GenericGetAttr/SetAttr now calls the new APIs PyMember_GetOne/SetOne, which take a PyMemberDef argument. As examples, I added actual docstrings to the attributes of a few types: file, complex, instance method, super, and xxsubtype.spamlist. Also converted the symtable to new style getattr.
2001-06-18Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters-0/+1
Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
2001-02-27Improved __future__ parser; still more to doJeremy Hylton-0/+1
Makefile.pre.in: add target future.o Include/compile.h: define PyFutureFeaters and PyNode_Future() add c_future slot to struct compiling Include/symtable.h: add st_future slot to struct symtable Python/future.c: implementation of PyNode_Future() Python/compile.c: use PyNode_Future() for nested_scopes support Python/symtable.c: include compile.h to pick up PyFutureFeatures decl
2001-02-27Preliminary support for future nested scopesJeremy Hylton-1/+1
compile.h: #define NESTED_SCOPES_DEFAULT 0 for Python 2.1 __future__ feature name: "nested_scopes" symtable.h: Add st_nested_scopes slot. Define flags to track exec and import star. Lib/test/test_scope.py: requires nested scopes compile.c: Fiddle with error messages. Reverse the sense of ste_optimized flag on PySymtableEntryObjects. If it is true, there is an optimization conflict. Modify get_ref_type to respect st_nested_scopes flags. Refactor symtable_load_symbols() into several smaller functions, which use struct symbol_info to share variables. In new function symtable_update_flags(), raise an error or warning for import * or bare exec that conflicts with nested scopes. Also, modify handle for free variables to respect st_nested_scopes flag. In symtable_init() assign st_nested_scopes flag to NESTED_SCOPES_DEFAULT (defined in compile.h). Add preliminary and often incorrect implementation of symtable_check_future(). Add symtable_lookup() helper for future use.