mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
Merged revisions 73376,73393,73398,73400,73404-73405,73409,73419-73421,73432,73457,73460,73485-73486,73488-73489,73501-73502,73513-73514 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r73376 | benjamin.peterson | 2009-06-11 17:29:23 -0500 (Thu, 11 Jun 2009) | 1 line remove check for case handled in sub-function ........ r73393 | alexandre.vassalotti | 2009-06-12 13:56:57 -0500 (Fri, 12 Jun 2009) | 2 lines Clear reference to the static PyExc_RecursionErrorInst in _PyExc_Fini. ........ r73398 | alexandre.vassalotti | 2009-06-12 15:57:12 -0500 (Fri, 12 Jun 2009) | 3 lines Add const qualifier to PyErr_SetFromErrnoWithFilename and to PyErr_SetFromErrnoWithUnicodeFilename. ........ r73400 | alexandre.vassalotti | 2009-06-12 16:43:47 -0500 (Fri, 12 Jun 2009) | 2 lines Delete outdated make file for building the parser with MSVC 6. ........ r73404 | benjamin.peterson | 2009-06-12 20:40:00 -0500 (Fri, 12 Jun 2009) | 1 line keep the slice.step field as NULL if no step expression is given ........ r73405 | benjamin.peterson | 2009-06-12 22:46:30 -0500 (Fri, 12 Jun 2009) | 1 line prevent import statements from assigning to None ........ r73409 | benjamin.peterson | 2009-06-13 08:06:21 -0500 (Sat, 13 Jun 2009) | 1 line allow importing from a module named None if it has an 'as' clause ........ r73419 | benjamin.peterson | 2009-06-13 11:19:19 -0500 (Sat, 13 Jun 2009) | 1 line set Print.values to NULL if there are no values ........ r73420 | benjamin.peterson | 2009-06-13 12:08:53 -0500 (Sat, 13 Jun 2009) | 1 line give a better error message when deleting () ........ r73421 | benjamin.peterson | 2009-06-13 15:23:33 -0500 (Sat, 13 Jun 2009) | 1 line when no module is given in a 'from' relative import, make ImportFrom.module NULL ........ r73432 | amaury.forgeotdarc | 2009-06-14 16:20:40 -0500 (Sun, 14 Jun 2009) | 3 lines #6227: Because of a wrong indentation, the test was not testing what it should. Ensure that the snippet in doctest_aliases actually contains aliases. ........ r73457 | benjamin.peterson | 2009-06-16 18:13:09 -0500 (Tue, 16 Jun 2009) | 1 line add underscores ........ r73460 | benjamin.peterson | 2009-06-16 22:23:04 -0500 (Tue, 16 Jun 2009) | 1 line remove unused 'encoding' member from the compiler struct ........ r73485 | benjamin.peterson | 2009-06-19 17:07:47 -0500 (Fri, 19 Jun 2009) | 1 line remove duplicate test ........ r73486 | benjamin.peterson | 2009-06-19 17:09:17 -0500 (Fri, 19 Jun 2009) | 1 line add missing assertion #6313 ........ r73488 | benjamin.peterson | 2009-06-19 17:16:28 -0500 (Fri, 19 Jun 2009) | 1 line show that this one isn't used ........ r73489 | benjamin.peterson | 2009-06-19 17:21:12 -0500 (Fri, 19 Jun 2009) | 1 line use closures ........ r73501 | benjamin.peterson | 2009-06-21 18:01:07 -0500 (Sun, 21 Jun 2009) | 1 line don't need to add the name 'lambda' as assigned ........ r73502 | benjamin.peterson | 2009-06-21 18:03:36 -0500 (Sun, 21 Jun 2009) | 1 line remove tmpname support since it's no longer used ........ r73513 | benjamin.peterson | 2009-06-22 20:18:57 -0500 (Mon, 22 Jun 2009) | 1 line fix grammar ........ r73514 | benjamin.peterson | 2009-06-22 22:01:56 -0500 (Mon, 22 Jun 2009) | 1 line remove some unused symtable constants ........
This commit is contained in:
parent
c609b6b04b
commit
78565b2216
20 changed files with 113 additions and 150 deletions
|
@ -117,7 +117,6 @@ struct compiler_unit {
|
|||
members, you can reach all early allocated blocks. */
|
||||
basicblock *u_blocks;
|
||||
basicblock *u_curblock; /* pointer to current block */
|
||||
int u_tmpname; /* temporary variables for list comps */
|
||||
|
||||
int u_nfblocks;
|
||||
struct fblockinfo u_fblock[CO_MAXBLOCKS];
|
||||
|
@ -146,7 +145,6 @@ struct compiler {
|
|||
|
||||
struct compiler_unit *u; /* compiler state for current block */
|
||||
PyObject *c_stack; /* Python list holding compiler_unit ptrs */
|
||||
char *c_encoding; /* source encoding (a borrowed reference) */
|
||||
PyArena *c_arena; /* pointer to memory allocation arena */
|
||||
};
|
||||
|
||||
|
@ -295,9 +293,6 @@ PyAST_Compile(mod_ty mod, const char *filename, PyCompilerFlags *flags,
|
|||
goto finally;
|
||||
}
|
||||
|
||||
/* XXX initialize to NULL for now, need to handle */
|
||||
c.c_encoding = NULL;
|
||||
|
||||
co = compiler_mod(&c, mod);
|
||||
|
||||
finally:
|
||||
|
@ -488,7 +483,6 @@ compiler_enter_scope(struct compiler *c, identifier name, void *key,
|
|||
}
|
||||
|
||||
u->u_blocks = NULL;
|
||||
u->u_tmpname = 0;
|
||||
u->u_nfblocks = 0;
|
||||
u->u_firstlineno = lineno;
|
||||
u->u_lineno = 0;
|
||||
|
@ -2154,6 +2148,13 @@ compiler_from_import(struct compiler *c, stmt_ty s)
|
|||
|
||||
PyObject *names = PyTuple_New(n);
|
||||
PyObject *level;
|
||||
static PyObject *empty_string;
|
||||
|
||||
if (!empty_string) {
|
||||
empty_string = PyUnicode_FromString("");
|
||||
if (!empty_string)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!names)
|
||||
return 0;
|
||||
|
@ -2171,23 +2172,24 @@ compiler_from_import(struct compiler *c, stmt_ty s)
|
|||
PyTuple_SET_ITEM(names, i, alias->name);
|
||||
}
|
||||
|
||||
if (s->lineno > c->c_future->ff_lineno) {
|
||||
if (!PyUnicode_CompareWithASCIIString(s->v.ImportFrom.module,
|
||||
"__future__")) {
|
||||
Py_DECREF(level);
|
||||
Py_DECREF(names);
|
||||
return compiler_error(c,
|
||||
"from __future__ imports must occur "
|
||||
if (s->lineno > c->c_future->ff_lineno && s->v.ImportFrom.module &&
|
||||
!PyUnicode_CompareWithASCIIString(s->v.ImportFrom.module, "__future__")) {
|
||||
Py_DECREF(level);
|
||||
Py_DECREF(names);
|
||||
return compiler_error(c, "from __future__ imports must occur "
|
||||
"at the beginning of the file");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ADDOP_O(c, LOAD_CONST, level, consts);
|
||||
Py_DECREF(level);
|
||||
ADDOP_O(c, LOAD_CONST, names, consts);
|
||||
Py_DECREF(names);
|
||||
ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names);
|
||||
if (s->v.ImportFrom.module) {
|
||||
ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names);
|
||||
}
|
||||
else {
|
||||
ADDOP_NAME(c, IMPORT_NAME, empty_string, names);
|
||||
}
|
||||
for (i = 0; i < n; i++) {
|
||||
alias_ty alias = (alias_ty)asdl_seq_GET(s->v.ImportFrom.names, i);
|
||||
identifier store_name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue