summaryrefslogtreecommitdiffstats
path: root/Include/symtable.h
Commit message (Collapse)AuthorAgeFilesLines
* SF patch #872326: Generator expression implementationRaymond Hettinger2004-05-191-1/+4
| | | | | | | | | | | | | | (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.
* Fix for SF [ 734869 ] Lambda functions in list comprehensionsJeremy Hylton2003-05-211-1/+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.
* Constify filenames and scripts. Fixes #651362.Martin v. Löwis2002-12-111-2/+2
|
* Excise DL_EXPORT from Include.Mark Hammond2002-08-121-4/+4
| | | | Thanks to Skip Montanaro and Kalle Svensson for the patches.
* Remove st_nested_scopes from struct symtable,Jeremy Hylton2001-08-111-1/+0
| | | | | | | because nested scopes are always enabled. (Accidentally checked in one small change along this path yesterday, wreaking havoc in the Windows build.)
* Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters2001-06-181-0/+1
| | | | | Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
* Set the line number correctly for a nested function with an exec orJeremy Hylton2001-03-221-0/+1
| | | | import *. Mark the offending stmt rather than the function def line.
* add DEF_BOUNDJeremy Hylton2001-02-281-1/+3
|
* Improved __future__ parser; still more to doJeremy Hylton2001-02-271-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
* Preliminary support for future nested scopesJeremy Hylton2001-02-271-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Relax the rules for using 'from ... import *' and exec in the presenceJeremy Hylton2001-02-091-37/+27
| | | | | | | | | | | | | | | | | | | of nested functions. Either is allowed in a function if it contains no defs or lambdas or the defs and lambdas it contains have no free variables. If a function is itself nested and has free variables, either is illegal. Revise the symtable to use a PySymtableEntryObject, which holds all the revelent information for a scope, rather than using a bunch of st_cur_XXX pointers in the symtable struct. The changes simplify the internal management of the current symtable scope and of the stack. Added new C source file: Python/symtable.c. (Does the Windows build process need to be updated?) As part of these changes, the initial _symtable module interface introduced in 2.1a2 is replaced. A dictionary of PySymtableEntryObjects are returned.
* Fix symbol table pass to generation SyntaxError exceptions thatJeremy Hylton2001-02-021-0/+1
| | | | include the filename and line number.
* Move a bunch of definitions that were internal to compile.c toJeremy Hylton2001-02-021-0/+99
symtable.h, so that they can be used by external module. Improve error handling in symtable_enter_scope(), which return an error code that went unchecked by most callers. XXX The error handling in symtable code is sloppy in general. Modify symtable to record the line number that begins each scope. This can help to identify which code block is being referred to when multiple blocks are bound to the same name. Add st_scopes dict that is used to preserve scope info when PyNode_CompileSymtable() is called. Otherwise, this information is tossed as soon as it is no longer needed. Add Py_SymtableString() to pythonrun; analogous to Py_CompileString().