summaryrefslogtreecommitdiffstats
path: root/Python/future.c
Commit message (Collapse)AuthorAgeFilesLines
* move unprefixed error into .c fileBenjamin Peterson2008-10-301-0/+2
|
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-2/+2
| | | | | | | 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.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-2/+2
|
* Patch #2477: Added from __future__ import unicode_literalsChristian Heimes2008-03-261-0/+2
| | | | The new PyParser_*Ex() functions are based on Neal's suggestion and initial patch. The new __future__ feature makes all '' and r'' unicode strings. b'' and br'' stay (byte) strings.
* Backport of the print function, using a __future__ import.Eric Smith2008-03-181-0/+2
| | | | | | | | This work is substantially Anthony Baxter's, from issue 1633807. I just freshened it, made a few minor tweaks, and added the test cases. I also created issue 2412, which is to check for 2to3's behavior with the print function. I also added myself to ACKS.
* #1755: typo.Georg Brandl2008-01-071-1/+1
|
* Handle more mem alloc issues found with failmallocNeal Norwitz2006-07-231-1/+3
|
* more low-hanging fruit to make code compile under a C++ compiler. NotAnthony Baxter2006-04-111-2/+2
| | | | | entirely happy with the two new VISIT macros in compile.c, but I couldn't see a better approach.
* Use PyObject_* allocator since FutureFeatures is smallNeal Norwitz2006-04-101-2/+2
|
* Don't abbreviate ABS, use long name ABSOLUTE.Neal Norwitz2006-04-031-2/+2
|
* from __future__ import with_statement addon for 'with', mostly written byThomas Wouters2006-02-281-0/+2
| | | | Neal.
* SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters2006-02-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | - IMPORT_NAME takes an extra argument from the stack: the relativeness of the import. Only passed to __import__ when it's not -1. - __import__() takes an optional 5th argument for the same thing; it __defaults to -1 (old semantics: try relative, then absolute) - 'from . import name' imports name (be it module or regular attribute) from the current module's *package*. Likewise, 'from .module import name' will import name from a sibling to the current module. - Importing from outside a package is not allowed; 'from . import sys' in a toplevel module will not work, nor will 'from .. import sys' in a (single-level) package. - 'from __future__ import absolute_import' will turn on the new semantics for import and from-import: imports will be absolute, except for from-import with dots. Includes tests for regular imports and importhooks, parser changes and a NEWS item, but no compiler-package changes or documentation changes.
* Reduce scope of featureNeal Norwitz2005-12-061-2/+1
|
* Remove unused macro, check is done elsewhereNeal Norwitz2005-12-061-1/+0
|
* Prevent name pollution by making lots of internal functions static.Neal Norwitz2005-11-131-1/+1
|
* Merge ast-branch to headJeremy Hylton2005-10-201-202/+74
| | | | | | | | | | 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.
* Fix bug that allowed future statements virtually anywhere in a module.Jeremy Hylton2005-02-041-2/+1
| | | | | | | If we exit via the break here, we need to set ff_last_lineno or FUTURE_POSSIBLE() will remain true. The bug affected statements containing a variety of expressions, but not all expressions. It has been present since Python 2.2.
* SF patch #1007189, multi-line imports, for instance:Anthony Baxter2004-08-311-12/+13
| | | | | "from blah import (foo, bar baz, bongo)"
* Constify filenames and scripts. Fixes #651362.Martin v. Löwis2002-12-111-4/+4
|
* Removed more hair in support of future-generator stmts.Tim Peters2002-04-121-1/+1
|
* Fix SF bug [ #450245 ] Error in parsing future stmtsJeremy Hylton2001-08-201-3/+18
| | | | | | | | | Check return value from future_parse() in for loop for file_input to accomodate multiple future statements on separate lines. Add several comments explaining how the code works. Remove out-dated XXX comment.
* Refactor future feature handlingJeremy Hylton2001-08-101-6/+4
| | | | | | | | | | | Replace uses of PyCF_xxx with CO_xxx. Replace individual feature slots in PyFutureFeatures with single bitmask ff_features. When flags must be transfered among the three parts of the interpreter that care about them -- the pythonrun layer, the compiler, and the future feature parser -- can simply or (|) the definitions.
* Implement PEP 238 in its (almost) full glory.Guido van Rossum2001-08-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This introduces: - A new operator // that means floor division (the kind of division where 1/2 is 0). - The "future division" statement ("from __future__ import division) which changes the meaning of the / operator to implement "true division" (where 1/2 is 0.5). - New overloadable operators __truediv__ and __floordiv__. - New slots in the PyNumberMethods struct for true and floor division, new abstract APIs for them, new opcodes, and so on. I emphasize that without the future division statement, the semantics of / will remain unchanged until Python 3.0. Not yet implemented are warnings (default off) when / is used with int or long arguments. This has been on display since 7/31 as SF patch #443474. Flames to /dev/null.
* future.c: insert a cosmetic space.Tim Peters2001-07-161-1/+1
| | | | | pythonrun.c, run_pyc_file(): repair semantic error wrt CO_GENERATOR vs CO_GENERATOR_ALLOWED.
* Part way to allowing "from __future__ import generators" to communicateTim Peters2001-07-161-1/+2
| | | | | | | | | | that info to code dynamically compiled *by* code compiled with generators enabled. Doesn't yet work because there's still no way to tell the parser that "yield" is OK (unlike nested_scopes, the parser has its fingers in this too). Replaced PyEval_GetNestedScopes by a more-general PyEval_MergeCompilerFlags. Perhaps I should not have? I doubted it was *intended* to be part of the public API, so just did.
* Preliminary support for "from __future__ import generators" to enableGuido van Rossum2001-07-151-0/+2
| | | | | | | | the yield statement. I figure we have to have this in before I can release 2.2a1 on Wednesday. Note: test_generators is currently broken, I'm counting on Tim to fix this.
* When iterating over the names imported in a future statement, ignore theFred Drake2001-03-101-1/+1
| | | | | | commas in the concrete syntax; checking those causes a segfault. This fixes SF bug #407394.
* Improve SyntaxErrors for bad future statements. Set file and locationJeremy Hylton2001-02-281-10/+24
| | | | | | | 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().
* Need to support single_input explicitly so from __future__ importsJeremy Hylton2001-02-281-0/+8
| | | | | are legal at the interactive interpreter prompt. They don't do anything yet...
* Presumed correct compiler pass for future statementsJeremy Hylton2001-02-281-25/+98
| | | | | | | | | | | | | | | | | | | | | | | | | 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-271-0/+146
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