summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* add DEF_BOUNDJeremy Hylton2001-02-281-1/+3
|
* Add declaration for PyErr_WarnExplicit().Guido van Rossum2001-02-281-0/+2
|
* Improve SyntaxErrors for bad future statements. Set file and locationJeremy Hylton2001-02-281-0/+4
| | | | | | | for errors raised in future.c. Move some helper functions from compile.c to errors.c and make them API functions: PyErr_SyntaxLocation() and PyErr_ProgramText().
* Presumed correct compiler pass for future statementsJeremy Hylton2001-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | XXX still need to integrate into symtable API compile.h: Remove ff_n_simple_stmt; obsolete. Add ff_found_docstring used internally to skip one and only one string at the beginning of a module. compile.c: Add check for from __future__ imports to far into the file. In symtable_global() check for -1 returned from symtable_lookup(), which signifies name not defined. Add missing DECERF in symtable_add_def. Free c->c_future. future.c: Add special handling for multiple statements joined on a single line using one or more semicolons; this form can include an illegal future statement that would otherwise be hard to detect. Add support for detecting and skipping doc strings.
* Improved __future__ parser; still more to doJeremy Hylton2001-02-272-3/+14
| | | | | | | | | | | | | | | 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
* Add Vladimir Marangozov's object allocator. It is disabled by default. ThisNeil Schemenauer2001-02-271-0/+7
| | | | closes SF patch #401229.
* Preliminary support for future nested scopesJeremy Hylton2001-02-272-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* The return value from PyObject_ClearWeakRefs() is no longer meaningful,Fred Drake2001-02-261-1/+1
| | | | so make it void.
* _Py_ReleaseInternedStrings(): Private API function to decref andBarry Warsaw2001-02-231-0/+2
| | | | | | release the interned string dictionary. This is useful for memory use debugging because it eliminates a huge source of noise from the reports. Only defined when INTERN_STRINGS is defined.
* 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.
* Superseded by $(srcdir)/Makefile.pre.in.Neil Schemenauer2001-02-031-12/+0
|
* bump to 2.1a2Jeremy Hylton2001-02-021-3/+3
|
* 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-022-0/+100
| | | | | | | | | | | | | | | | | | 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().
* Use a type flag to determine the applicability of the tp_weaklistoffsetFred Drake2001-02-022-1/+10
| | | | | field. This should avoid binary incompatibility problems with older modules that have not been recompiled.
* Allow 'continue' inside 'try' clauseJeremy Hylton2001-02-011-0/+1
| | | | SF patch 102989 by Thomas Wouters
* Undo recent change that banned using import to bind a global, as perJeremy Hylton2001-02-011-0/+3
| | | | | | | | | | | discussion on python-dev. 'from mod import *' is still banned except at the module level. Fix value for special NOOPT entry in symtable. Initialze to 0 instead of None, so that later uses of PyInt_AS_LONG() are valid. (Bug reported by Donn Cave.) replace local REPR macros with PyObject_REPR in object.h
* PEP 205, Weak References -- initial checkin.Fred Drake2001-02-013-4/+17
|
* Remove f_closure slot of frameobject and use f_localsplus instead.Jeremy Hylton2001-01-291-1/+3
| | | | | | | | | | | | This change eliminates an extra malloc/free when a frame with free variables is created. Any cell vars or free vars are stored in f_localsplus after the locals and before the stack. eval_code2() fills in the appropriate values after handling initialization of locals. To track the size the frame has an f_size member that tracks the total size of f_localsplus. It used to be implicitly f_nlocals + f_stacksize.
* Added prototype for PyInstance_NewRaw().Fred Drake2001-01-281-0/+1
|
* It's unclear whether PyMarshal_XXX() are part of the public or private API.Tim Peters2001-01-281-0/+1
| | | | | | | | | | They're named as if public, so I did a Bad Thing by changing PyMarshal_ReadObjectFromFile() to suck up the remainder of the file in one gulp: anyone who counted on that leaving the file pointer merely at the end of the next object would be screwed. So restored PyMarshal_ReadObjectFromFile() to its earlier state, renamed the new greedy code to PyMarshal_ReadLastObjectFromFile(), and changed Python internals to call the latter instead.
* The addition of new parameters to functions in the Python/C API requiresFred Drake2001-01-251-2/+5
| | | | that PYTHON_API_VERSION be incremented.
* PEP 227 implementationJeremy Hylton2001-01-254-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The majority of the changes are in the compiler. The mainloop changes primarily to implement the new opcodes and to pass a function's closure to eval_code2(). Frames and functions got new slots to hold the closure. Include/compile.h Add co_freevars and co_cellvars slots to code objects. Update PyCode_New() to take freevars and cellvars as arguments Include/funcobject.h Add func_closure slot to function objects. Add GetClosure()/SetClosure() functions (and corresponding macros) for getting at the closure. Include/frameobject.h PyFrame_New() now takes a closure. Include/opcode.h Add four new opcodes: MAKE_CLOSURE, LOAD_CLOSURE, LOAD_DEREF, STORE_DEREF. Remove comment about old requirement for opcodes to fit in 7 bits. compile.c Implement changes to code objects for co_freevars and co_cellvars. Modify symbol table to use st_cur_name (string object for the name of the current scope) and st_cur_children (list of nested blocks). Also define st_nested, which might more properly be called st_cur_nested. Add several DEF_XXX flags to track def-use information for free variables. New or modified functions of note: com_make_closure(struct compiling *, PyCodeObject *) Emit LOAD_CLOSURE opcodes as needed to pass cells for free variables into nested scope. com_addop_varname(struct compiling *, int, char *) Emits opcodes for LOAD_DEREF and STORE_DEREF. get_ref_type(struct compiling *, char *name) Return NAME_CLOSURE if ref type is FREE or CELL symtable_load_symbols(struct compiling *) Decides what variables are cell or free based on def-use info. Can now raise SyntaxError if nested scopes are mixed with exec or from blah import *. make_scope_info(PyObject *, PyObject *, int, int) Helper functions for symtable scope stack. symtable_update_free_vars(struct symtable *) After a code block has been analyzed, it must check each of its children for free variables that are not defined in the block. If a variable is free in a child and not defined in the parent, then it is defined by block the enclosing the current one or it is a global. This does the right logic. symtable_add_use() is now a macro for symtable_add_def() symtable_assign(struct symtable *, node *) Use goto instead of for (;;) Fixed bug in symtable where name of keyword argument in function call was treated as assignment in the scope of the call site. Ex: def f(): g(a=2) # a was considered a local of f ceval.c eval_code2() now take one more argument, a closure. Implement LOAD_CLOSURE, LOAD_DEREF, STORE_DEREF, MAKE_CLOSURE> Also: When name error occurs for global variable, report that the name was global in the error mesage. Objects/frameobject.c Initialize f_closure to be a tuple containing space for cellvars and freevars. f_closure is NULL if neither are present. Objects/funcobject.c Add support for func_closure. Python/import.c Change the magic number. Python/marshal.c Track changes to code objects.
* PEP 227 implementationJeremy Hylton2001-01-252-0/+29
| | | | | | A cell contains a reference to a single PyObject. It could be implemented as a mutable, one-element sequence, but the separate type has less overhead.
* Add a flag to indicate the presence of the tp_richcompare field, andGuido van Rossum2001-01-241-2/+7
| | | | add it to the default flags.
* PyGC_Dump() -> _PyGC_Dump()Barry Warsaw2001-01-241-1/+1
|
* PyObject_Dump() -> _PyObject_Dump()Barry Warsaw2001-01-241-1/+1
|
* Add prototype for PyGC_Dump() -- but only inside the #ifdefBarry Warsaw2001-01-231-0/+2
| | | | WITH_CYCLE_GC.
* Add prototype for PyObject_Dump().Barry Warsaw2001-01-231-0/+1
|
* Add a new API, PyThreadState_DeleteCurrent() that combinesGuido van Rossum2001-01-231-0/+3
| | | | | PyThreadState_Delete() and PyEval_ReleaseLock(). It is only defined if WITH_THREAD is defined.
* Remove include-file-dependant half-prototype of clnt_create().Thomas Wouters2001-01-221-3/+0
|
* Move declaration of 'clnt_create()' NIS function to pyport.h, as it'sThomas Wouters2001-01-211-0/+3
| | | | | | supposed to be declared in system include files (with a proper prototype.) Should be moved to a platform-specific block if anyone finds out which broken platforms need it :-)
* Fix comment.Neil Schemenauer2001-01-201-2/+2
|
* refactored the unicodeobject/ucnhash interface, to hide theFredrik Lundh2001-01-191-18/+27
| | | | | | | implementation details inside the ucnhash module. also cleaned up the unicode copyright blurb a little; Secret Labs' internal revision history isn't that interesting...
* Move distributed and duplicated config for stat() and fstat() into pyport.h.Tim Peters2001-01-181-2/+34
|
* Get rid of the declaration for _PyCompareState_Key.Guido van Rossum2001-01-171-3/+0
|
* This patch adds a new builtin unistr() which behaves like str()Marc-André Lemburg2001-01-172-0/+13
| | | | | | | | | | except that it always returns Unicode objects. A new C API PyObject_Unicode() is also provided. This closes patch #101664. Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
* Rich comparisons: ensure that LT == Py_LT, etc.Guido van Rossum2001-01-171-1/+2
|
* Introduction to rich comparisons:Guido van Rossum2001-01-171-12/+22
| | | | | | | | | | | | | | - Removed the nb_add slot from the PyNumberMethods struct. - Renamed Py_TPFLAGS_NEWSTYLENUMBER to Py_TPFLAGS_CHECKTYPES. - Added typedef richcmpfunc. - Added tp_richcompare slot to PyTypeObject (replacing spare tp_xxx7). - Added APIs PyObject_RichCompare() and PyObject_RichCompareBool(). - Added rich comparison operators Py_LT through Py_GE.
* Bump version to 2.1a1. (To be released Friday.)Guido van Rossum2001-01-171-4/+4
|
* Committing PEP 232, function attribute feature, approved by Guido.Barry Warsaw2001-01-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes SF patch #103123. funcobject.h: PyFunctionObject: add the func_dict slot. funcobject.c: PyFunction_New(): Initialize the func_dict slot to NULL. func_getattr(): Rename to func_getattro() and change the signature. It's more efficient to use attro methods and dig the C string out than it is to re-convert a C string to a PyString. Also, add support for getting the __dict__ (a.k.a. func_dict) attribute, and for getting an arbitrary function attribute. func_setattr(): Rename to func_setattro() and change the signature for the same reason. Also add support for setting __dict__ (a.k.a. func_dict) and any arbitrary function attribute. func_dealloc(): Be sure to DECREF the func_dict slot. func_traverse(): Be sure to traverse func_dict too. PyFunction_Type: make the necessary func_?etattro() changes. classobject.c: instancemethod_memberlist: Add __dict__ instancemethod_setattro(): New method to set arbitrary attributes on methods (really the underlying im_func). Raise TypeError when the instance is bound or when you're trying to set one of the reserved im_* attributes. instancemethod_getattr(): Renamed to instancemethod_getattro() since that's what it really is. Also, added support fo getting arbitrary attributes through the im_func. PyMethod_Type: Do the ?etattr{,o} dance.
* Change LONG_BIT error warning to mention glibc, too, since this is reallyAndrew M. Kuchling2001-01-121-1/+1
| | | | a glibc, not a gcc, problem.
* - Add nb_cmp slot for new style nubmers.Neil Schemenauer2001-01-041-0/+22
| | | | | - Define type flag for new style numbers. - Add Py_NotImplemented.
* Remove PyInstance_*BinOp functions.Neil Schemenauer2001-01-041-8/+0
|
* Added header file for C API exported by _cursesmodule.cAndrew M. Kuchling2000-12-221-0/+133
|
* Add declarations for PySys_ResetWarnOptions() andGuido van Rossum2000-12-151-0/+3
| | | | PySys_AddWarnOption().
* Add declarations for standard warning category classes (PyExc_WarningGuido van Rossum2000-12-151-0/+10
| | | | etc.) and the PyErr_Warn() function.
* Move our own getopt() implementation to _PyOS_GetOpt(), and use itThomas Wouters2000-11-031-0/+17
| | | | | | | | | regardless of whether the system getopt() does what we want. This avoids the hassle with prototypes and externs, and the check to see if the system getopt() does what we want. Prefix optind, optarg and opterr with _PyOS_ to avoid name clashes. Add new include file to define the right symbols. Fix Demo/pyserv/pyserv.c to include getopt.h itself, instead of relying on Python to provide it.
* getting closeJeremy Hylton2000-10-131-3/+3
|
* Use suggested workaround for PyOS_CheckStack causing failure of test_[s]re.pyTrent Mick2000-10-111-1/+1
| | | | | | on Win64. This closes bug http://sourceforge.net/bugs/?func=detailbug&group_id=5470&bug_id=116516