diff options
author | Guido van Rossum <guido@python.org> | 2007-06-06 23:52:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-06-06 23:52:48 (GMT) |
commit | e7ba4956272a7105ea90dd505f70e5947aa27161 (patch) | |
tree | b28c14ab345faf72d32ae96639f8e1d2629e1761 /Python | |
parent | 0e41148c4bdb3b1af157a9bf55df4bc27474f1e8 (diff) | |
download | cpython-e7ba4956272a7105ea90dd505f70e5947aa27161.zip cpython-e7ba4956272a7105ea90dd505f70e5947aa27161.tar.gz cpython-e7ba4956272a7105ea90dd505f70e5947aa27161.tar.bz2 |
Merged revisions 55631-55794 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55636 | neal.norwitz | 2007-05-29 00:06:39 -0700 (Tue, 29 May 2007) | 149 lines
Merged revisions 55506-55635 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55507 | georg.brandl | 2007-05-22 07:28:17 -0700 (Tue, 22 May 2007) | 2 lines
Remove the "panel" module doc file which has been ignored since 1994.
........
r55522 | mark.hammond | 2007-05-22 19:04:28 -0700 (Tue, 22 May 2007) | 4 lines
Remove definition of PY_UNICODE_TYPE from pyconfig.h, allowing the
definition in unicodeobject.h to be used, giving us the desired
wchar_t in place of 'unsigned short'. As discussed on python-dev.
........
r55525 | neal.norwitz | 2007-05-22 23:35:32 -0700 (Tue, 22 May 2007) | 6 lines
Add -3 option to the interpreter to warn about features that are
deprecated and will be changed/removed in Python 3.0.
This patch is mostly from Anthony. I tweaked some format and added
a little doc.
........
r55527 | neal.norwitz | 2007-05-22 23:57:35 -0700 (Tue, 22 May 2007) | 1 line
Whitespace cleanup
........
r55528 | neal.norwitz | 2007-05-22 23:58:36 -0700 (Tue, 22 May 2007) | 1 line
Add a bunch more deprecation warnings for builtins that are going away in 3.0
........
r55549 | georg.brandl | 2007-05-24 09:49:29 -0700 (Thu, 24 May 2007) | 2 lines
shlex.split() now has an optional "posix" parameter.
........
r55550 | georg.brandl | 2007-05-24 10:33:33 -0700 (Thu, 24 May 2007) | 2 lines
Fix parameter passing.
........
r55555 | facundo.batista | 2007-05-24 10:50:54 -0700 (Thu, 24 May 2007) | 6 lines
Added an optional timeout parameter to urllib.ftpwrapper, with tests
(for this and a basic one, because there weren't any). Changed also
NEWS, but didn't find documentation for this function, assumed it
wasn't public...
........
r55563 | facundo.batista | 2007-05-24 13:01:59 -0700 (Thu, 24 May 2007) | 4 lines
Removed the .recv() in the test, is not necessary, and was
causing problems that didn't have anything to do with was
actually being tested...
........
r55564 | facundo.batista | 2007-05-24 13:51:19 -0700 (Thu, 24 May 2007) | 5 lines
Let's see if reading exactly what is written allow this live
test to pass (now I know why there were so few tests in ftp,
http, etc, :( ).
........
r55567 | facundo.batista | 2007-05-24 20:10:28 -0700 (Thu, 24 May 2007) | 4 lines
Trying to make the tests work in Windows and Solaris, everywhere
else just works
........
r55568 | facundo.batista | 2007-05-24 20:47:19 -0700 (Thu, 24 May 2007) | 4 lines
Fixing stupid error, and introducing a sleep, to see if the
other thread is awakened and finish sending data.
........
r55569 | facundo.batista | 2007-05-24 21:20:22 -0700 (Thu, 24 May 2007) | 4 lines
Commenting out the tests until find out who can test them in
one of the problematic enviroments.
........
r55570 | neal.norwitz | 2007-05-24 22:13:40 -0700 (Thu, 24 May 2007) | 2 lines
Get test passing again by commenting out the reference to the test class.
........
r55575 | vinay.sajip | 2007-05-25 00:05:59 -0700 (Fri, 25 May 2007) | 1 line
Updated docstring for SysLogHandler (#1720726).
........
r55576 | vinay.sajip | 2007-05-25 00:06:55 -0700 (Fri, 25 May 2007) | 1 line
Updated documentation for SysLogHandler (#1720726).
........
r55592 | brett.cannon | 2007-05-25 13:17:15 -0700 (Fri, 25 May 2007) | 3 lines
Remove direct call's to file's constructor and replace them with calls to
open() as ths is considered best practice.
........
r55601 | kristjan.jonsson | 2007-05-26 12:19:50 -0700 (Sat, 26 May 2007) | 1 line
Remove the rgbimgmodule from PCBuild8
........
r55602 | kristjan.jonsson | 2007-05-26 12:31:39 -0700 (Sat, 26 May 2007) | 1 line
Include <windows.h> after python.h, so that WINNT is properly set before windows.h is included. Fixes warnings in PC builds.
........
r55603 | walter.doerwald | 2007-05-26 14:04:13 -0700 (Sat, 26 May 2007) | 2 lines
Fix typo.
........
r55604 | peter.astrand | 2007-05-26 15:18:20 -0700 (Sat, 26 May 2007) | 1 line
Applied patch 1669481, slightly modified: Support close_fds on Win32
........
r55606 | neal.norwitz | 2007-05-26 21:08:54 -0700 (Sat, 26 May 2007) | 2 lines
Add the new function object attribute names from py3k.
........
r55617 | lars.gustaebel | 2007-05-27 12:49:30 -0700 (Sun, 27 May 2007) | 20 lines
Added errors argument to TarFile class that allows the user to
specify an error handling scheme for character conversion. Additional
scheme "utf-8" in read mode. Unicode input filenames are now
supported by design. The values of the pax_headers dictionary are now
limited to unicode objects.
Fixed: The prefix field is no longer used in PAX_FORMAT (in
conformance with POSIX).
Fixed: In read mode use a possible pax header size field.
Fixed: Strip trailing slashes from pax header name values.
Fixed: Give values in user-specified pax_headers precedence when
writing.
Added unicode tests. Added pax/regtype4 member to testtar.tar all
possible number fields in a pax header.
Added two chapters to the documentation about the different formats
tarfile.py supports and how unicode issues are handled.
........
r55618 | raymond.hettinger | 2007-05-27 22:23:22 -0700 (Sun, 27 May 2007) | 1 line
Explain when groupby() issues a new group.
........
r55634 | martin.v.loewis | 2007-05-28 21:01:29 -0700 (Mon, 28 May 2007) | 2 lines
Test pre-commit hook for a link to a .py file.
........
r55635 | martin.v.loewis | 2007-05-28 21:02:03 -0700 (Mon, 28 May 2007) | 2 lines
Revert 55634.
........
................
r55639 | neal.norwitz | 2007-05-29 00:58:11 -0700 (Tue, 29 May 2007) | 1 line
Remove sys.exc_{type,exc_value,exc_traceback}
................
r55641 | neal.norwitz | 2007-05-29 01:03:50 -0700 (Tue, 29 May 2007) | 1 line
Missed one sys.exc_type. I wonder why exc_{value,traceback} were already gone
................
r55642 | neal.norwitz | 2007-05-29 01:08:33 -0700 (Tue, 29 May 2007) | 1 line
Missed more doc for sys.exc_* attrs.
................
r55643 | neal.norwitz | 2007-05-29 01:18:19 -0700 (Tue, 29 May 2007) | 1 line
Remove sys.exc_clear()
................
r55665 | guido.van.rossum | 2007-05-29 19:45:43 -0700 (Tue, 29 May 2007) | 4 lines
Make None, True, False keywords.
We can now also delete all the other places that explicitly forbid
assignment to None, but I'm not going to bother right now.
................
r55666 | guido.van.rossum | 2007-05-29 20:01:51 -0700 (Tue, 29 May 2007) | 3 lines
Found another place that needs check for forbidden names.
Fixed test_syntax.py accordingly (it helped me find that one).
................
r55668 | guido.van.rossum | 2007-05-29 20:41:48 -0700 (Tue, 29 May 2007) | 2 lines
Mark None, True, False as keywords.
................
r55673 | neal.norwitz | 2007-05-29 23:28:25 -0700 (Tue, 29 May 2007) | 3 lines
Get the dis module working on modules again after changing dicts
to not return lists and also new-style classes. Add a test.
................
r55674 | neal.norwitz | 2007-05-29 23:35:45 -0700 (Tue, 29 May 2007) | 1 line
Umm, it helps to add the module that the test uses
................
r55675 | neal.norwitz | 2007-05-29 23:53:05 -0700 (Tue, 29 May 2007) | 4 lines
Try to fix up all the other places that were assigning to True/False.
There's at least one more problem in test.test_xmlrpc. I have other
changes in that file and that should be fixed soon (I hope).
................
r55679 | neal.norwitz | 2007-05-30 00:31:55 -0700 (Wed, 30 May 2007) | 1 line
Fix up another place that was assigning to True/False.
................
r55688 | brett.cannon | 2007-05-30 14:19:47 -0700 (Wed, 30 May 2007) | 2 lines
Ditch MimeWriter.
................
r55692 | brett.cannon | 2007-05-30 14:52:00 -0700 (Wed, 30 May 2007) | 2 lines
Remove the mimify module.
................
r55707 | guido.van.rossum | 2007-05-31 05:08:45 -0700 (Thu, 31 May 2007) | 2 lines
Backport the addition of show_code() to dis.py -- it's too handy.
................
r55708 | guido.van.rossum | 2007-05-31 06:22:57 -0700 (Thu, 31 May 2007) | 7 lines
Fix a fairly long-standing bug in the check for assignment to None (and other
keywords, these days). In 2.5, you could write foo(None=1) without getting
a SyntaxError (although foo()'s definition would have to use **kwds to avoid
getting a runtime error complaining about an unknown keyword of course).
This ought to be backported to 2.5.2 or at least 2.6.
................
r55724 | brett.cannon | 2007-05-31 19:32:41 -0700 (Thu, 31 May 2007) | 2 lines
Remove the cfmfile.
................
r55727 | neal.norwitz | 2007-05-31 22:19:44 -0700 (Thu, 31 May 2007) | 1 line
Remove reload() builtin.
................
r55729 | neal.norwitz | 2007-05-31 22:51:30 -0700 (Thu, 31 May 2007) | 59 lines
Merged revisions 55636-55728 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55637 | georg.brandl | 2007-05-29 00:16:47 -0700 (Tue, 29 May 2007) | 2 lines
Fix rst markup.
........
r55638 | neal.norwitz | 2007-05-29 00:51:39 -0700 (Tue, 29 May 2007) | 1 line
Fix typo in doc
........
r55671 | neal.norwitz | 2007-05-29 21:53:41 -0700 (Tue, 29 May 2007) | 1 line
Fix indentation (whitespace only).
........
r55676 | thomas.heller | 2007-05-29 23:58:30 -0700 (Tue, 29 May 2007) | 1 line
Fix compiler warnings.
........
r55677 | thomas.heller | 2007-05-30 00:01:25 -0700 (Wed, 30 May 2007) | 2 lines
Correct the name of a field in the WIN32_FIND_DATAA and WIN32_FIND_DATAW structures.
Closes bug #1726026.
........
r55686 | brett.cannon | 2007-05-30 13:46:26 -0700 (Wed, 30 May 2007) | 2 lines
Have MimeWriter raise a DeprecationWarning as per PEP 4 and its documentation.
........
r55690 | brett.cannon | 2007-05-30 14:48:58 -0700 (Wed, 30 May 2007) | 3 lines
Have mimify raise a DeprecationWarning. The docs and PEP 4 have listed the
module as deprecated for a while.
........
r55696 | brett.cannon | 2007-05-30 15:24:28 -0700 (Wed, 30 May 2007) | 2 lines
Have md5 raise a DeprecationWarning as per PEP 4.
........
r55705 | neal.norwitz | 2007-05-30 21:14:22 -0700 (Wed, 30 May 2007) | 1 line
Add some spaces in the example code.
........
r55716 | brett.cannon | 2007-05-31 12:20:00 -0700 (Thu, 31 May 2007) | 2 lines
Have the sha module raise a DeprecationWarning as specified in PEP 4.
........
r55719 | brett.cannon | 2007-05-31 12:40:42 -0700 (Thu, 31 May 2007) | 2 lines
Cause buildtools to raise a DeprecationWarning.
........
r55721 | brett.cannon | 2007-05-31 13:01:11 -0700 (Thu, 31 May 2007) | 2 lines
Have cfmfile raise a DeprecationWarning as per PEP 4.
........
r55726 | neal.norwitz | 2007-05-31 21:56:47 -0700 (Thu, 31 May 2007) | 1 line
Mail if there is an installation failure.
........
................
r55730 | neal.norwitz | 2007-05-31 23:22:07 -0700 (Thu, 31 May 2007) | 2 lines
Remove the code that was missed in rev 55303.
................
r55738 | neal.norwitz | 2007-06-01 19:10:43 -0700 (Fri, 01 Jun 2007) | 1 line
Fix doc breakage
................
r55741 | neal.norwitz | 2007-06-02 00:41:58 -0700 (Sat, 02 Jun 2007) | 1 line
Remove timing module (plus some remnants of other modules).
................
r55742 | neal.norwitz | 2007-06-02 00:51:44 -0700 (Sat, 02 Jun 2007) | 1 line
Remove posixfile module (plus some remnants of other modules).
................
r55744 | neal.norwitz | 2007-06-02 10:18:56 -0700 (Sat, 02 Jun 2007) | 1 line
Fix doc breakage.
................
r55745 | neal.norwitz | 2007-06-02 11:32:16 -0700 (Sat, 02 Jun 2007) | 1 line
Make a whatsnew 3.0 template.
................
r55754 | neal.norwitz | 2007-06-03 23:24:18 -0700 (Sun, 03 Jun 2007) | 1 line
SF #1730441, os._execvpe raises UnboundLocal due to new try/except semantics
................
r55755 | neal.norwitz | 2007-06-03 23:26:00 -0700 (Sun, 03 Jun 2007) | 1 line
Get rid of extra whitespace
................
r55794 | guido.van.rossum | 2007-06-06 15:29:22 -0700 (Wed, 06 Jun 2007) | 3 lines
Make this compile in GCC 2.96, which does not allow interspersing
declarations and code.
................
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 39 | ||||
-rw-r--r-- | Python/bltinmodule.c | 12 | ||||
-rw-r--r-- | Python/ceval.c | 9 | ||||
-rw-r--r-- | Python/dynload_win.c | 2 | ||||
-rw-r--r-- | Python/graminit.c | 122 | ||||
-rw-r--r-- | Python/import.c | 5 | ||||
-rw-r--r-- | Python/sysmodule.c | 35 |
7 files changed, 98 insertions, 126 deletions
diff --git a/Python/ast.c b/Python/ast.c index 65527ba..e0bd18e 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -324,6 +324,29 @@ get_operator(const node *n) } } +static const char* FORBIDDEN[] = { + "None", + "True", + "False", + NULL, +}; + +static int +forbidden_name(expr_ty e, const node *n) +{ + const char *id; + const char **p; + assert(PyString_Check(e->v.Name.id)); + id = PyString_AS_STRING(e->v.Name.id); + for (p = FORBIDDEN; *p; p++) { + if (strcmp(*p, id) == 0) { + ast_error(n, "assignment to keyword"); + return 1; + } + } + return 0; +} + /* Set the context ctx for expr_ty e, recursively traversing e. Only sets context for expr kinds that "can appear in assignment context" @@ -366,9 +389,9 @@ set_context(expr_ty e, expr_context_ty ctx, const node *n) return 0; break; case Name_kind: - if (ctx == Store && - !strcmp(PyString_AS_STRING(e->v.Name.id), "None")) { - return ast_error(n, "assignment to None"); + if (ctx == Store) { + if (forbidden_name(e, n)) + return 0; /* forbidden_name() calls ast_error() */ } e->v.Name.ctx = ctx; break; @@ -1227,6 +1250,7 @@ ast_for_atom(struct compiling *c, const node *n) { /* atom: '(' [yield_expr|testlist_comp] ')' | '[' [testlist_comp] ']' | '{' [dictmaker|testlist_comp] '}' | NAME | NUMBER | STRING+ + | '...' | 'None' | 'True' | 'False' */ node *ch = CHILD(n, 0); int bytesmode = 0; @@ -1894,7 +1918,9 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func) } else if (e->kind != Name_kind) { ast_error(CHILD(ch, 0), "keyword can't be an expression"); return NULL; - } + } else if (forbidden_name(e, ch)) { + return NULL; + } key = e->v.Name.id; e = ast_for_expr(c, CHILD(ch, 2)); if (!e) @@ -1981,11 +2007,8 @@ ast_for_expr_stmt(struct compiling *c, const node *n) "expression not possible"); return NULL; case Name_kind: { - const char *var_name = PyString_AS_STRING(expr1->v.Name.id); - if (var_name[0] == 'N' && !strcmp(var_name, "None")) { - ast_error(ch, "assignment to None"); + if (forbidden_name(expr1, ch)) return NULL; - } break; } case Attribute_kind: diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 43bbea9..97b2c5e 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1698,17 +1698,6 @@ If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError.\n\ On Unix, GNU readline is used if enabled. The prompt string, if given,\n\ is printed without a trailing newline before reading."); -static PyObject * -builtin_reload(PyObject *self, PyObject *v) -{ - return PyImport_ReloadModule(v); -} - -PyDoc_STRVAR(reload_doc, -"reload(module) -> module\n\ -\n\ -Reload the module. The module must have been successfully imported before."); - static PyObject * builtin_repr(PyObject *self, PyObject *v) @@ -2006,7 +1995,6 @@ static PyMethodDef builtin_methods[] = { {"ord", builtin_ord, METH_O, ord_doc}, {"pow", builtin_pow, METH_VARARGS, pow_doc}, {"print", (PyCFunction)builtin_print, METH_VARARGS | METH_KEYWORDS, print_doc}, - {"reload", builtin_reload, METH_O, reload_doc}, {"repr", builtin_repr, METH_O, repr_doc}, {"round", (PyCFunction)builtin_round, METH_VARARGS | METH_KEYWORDS, round_doc}, {"setattr", builtin_setattr, METH_VARARGS, setattr_doc}, diff --git a/Python/ceval.c b/Python/ceval.c index 37659f8..710a0d1 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2939,10 +2939,6 @@ set_exc_info(PyThreadState *tstate, Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); - /* For b/w compatibility */ - PySys_SetObject("exc_type", type); - PySys_SetObject("exc_value", value); - PySys_SetObject("exc_traceback", tb); } static void @@ -2973,11 +2969,6 @@ reset_exc_info(PyThreadState *tstate) Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); - /* For b/w compatibility */ - PySys_SetObject("exc_type", frame->f_exc_type); - PySys_SetObject("exc_value", frame->f_exc_value); - PySys_SetObject("exc_traceback", frame->f_exc_traceback); - /* Clear the frame's exception info. */ tmp_type = frame->f_exc_type; tmp_value = frame->f_exc_value; diff --git a/Python/dynload_win.c b/Python/dynload_win.c index 1c3b3ab..fc641b9 100644 --- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -1,7 +1,6 @@ /* Support for dynamic loading of extension modules */ -#include <windows.h> #ifdef HAVE_DIRECT_H #include <direct.h> #endif @@ -9,6 +8,7 @@ #include "Python.h" #include "importdl.h" +#include <windows.h> const struct filedescr _PyImport_DynLoadFiletab[] = { #ifdef _DEBUG diff --git a/Python/graminit.c b/Python/graminit.c index ba2686f..c1c070b 100644 --- a/Python/graminit.c +++ b/Python/graminit.c @@ -1285,7 +1285,7 @@ static state states_62[4] = { {1, arcs_62_2}, {1, arcs_62_3}, }; -static arc arcs_63_0[7] = { +static arc arcs_63_0[10] = { {13, 1}, {146, 2}, {148, 3}, @@ -1293,6 +1293,9 @@ static arc arcs_63_0[7] = { {151, 4}, {152, 5}, {77, 4}, + {153, 4}, + {154, 4}, + {155, 4}, }; static arc arcs_63_1[3] = { {46, 6}, @@ -1324,7 +1327,7 @@ static arc arcs_63_8[1] = { {150, 4}, }; static state states_63[9] = { - {7, arcs_63_0}, + {10, arcs_63_0}, {3, arcs_63_1}, {2, arcs_63_2}, {2, arcs_63_3}, @@ -1338,7 +1341,7 @@ static arc arcs_64_0[1] = { {24, 1}, }; static arc arcs_64_1[3] = { - {153, 2}, + {156, 2}, {30, 3}, {0, 1}, }; @@ -1370,7 +1373,7 @@ static arc arcs_65_1[2] = { {15, 5}, }; static arc arcs_65_2[1] = { - {154, 6}, + {157, 6}, }; static arc arcs_65_3[1] = { {21, 5}, @@ -1394,14 +1397,14 @@ static state states_65[7] = { {1, arcs_65_6}, }; static arc arcs_66_0[1] = { - {155, 1}, + {158, 1}, }; static arc arcs_66_1[2] = { {30, 2}, {0, 1}, }; static arc arcs_66_2[2] = { - {155, 1}, + {158, 1}, {0, 2}, }; static state states_66[3] = { @@ -1419,11 +1422,11 @@ static arc arcs_67_1[2] = { }; static arc arcs_67_2[3] = { {24, 3}, - {156, 4}, + {159, 4}, {0, 2}, }; static arc arcs_67_3[2] = { - {156, 4}, + {159, 4}, {0, 3}, }; static arc arcs_67_4[1] = { @@ -1488,7 +1491,7 @@ static arc arcs_71_0[1] = { }; static arc arcs_71_1[4] = { {25, 2}, - {153, 3}, + {156, 3}, {30, 4}, {0, 1}, }; @@ -1529,7 +1532,7 @@ static state states_71[9] = { {1, arcs_71_8}, }; static arc arcs_72_0[1] = { - {157, 1}, + {160, 1}, }; static arc arcs_72_1[1] = { {21, 2}, @@ -1565,7 +1568,7 @@ static state states_72[8] = { {1, arcs_72_7}, }; static arc arcs_73_0[3] = { - {158, 1}, + {161, 1}, {31, 2}, {32, 3}, }; @@ -1580,7 +1583,7 @@ static arc arcs_73_3[1] = { {24, 6}, }; static arc arcs_73_4[4] = { - {158, 1}, + {161, 1}, {31, 2}, {32, 3}, {0, 4}, @@ -1609,7 +1612,7 @@ static arc arcs_74_0[1] = { {24, 1}, }; static arc arcs_74_1[3] = { - {153, 2}, + {156, 2}, {29, 3}, {0, 1}, }; @@ -1626,8 +1629,8 @@ static state states_74[4] = { {1, arcs_74_3}, }; static arc arcs_75_0[2] = { - {153, 1}, - {160, 1}, + {156, 1}, + {163, 1}, }; static arc arcs_75_1[1] = { {0, 1}, @@ -1649,7 +1652,7 @@ static arc arcs_76_3[1] = { {105, 4}, }; static arc arcs_76_4[2] = { - {159, 5}, + {162, 5}, {0, 4}, }; static arc arcs_76_5[1] = { @@ -1670,7 +1673,7 @@ static arc arcs_77_1[1] = { {107, 2}, }; static arc arcs_77_2[2] = { - {159, 3}, + {162, 3}, {0, 2}, }; static arc arcs_77_3[1] = { @@ -1704,7 +1707,7 @@ static state states_79[2] = { {1, arcs_79_1}, }; static arc arcs_80_0[1] = { - {163, 1}, + {166, 1}, }; static arc arcs_80_1[2] = { {9, 2}, @@ -1720,11 +1723,11 @@ static state states_80[3] = { }; static dfa dfas[81] = { {256, "single_input", 0, 3, states_0, - "\004\050\060\200\000\000\000\050\170\052\034\144\011\040\004\000\200\041\224\041\010"}, + "\004\050\060\200\000\000\000\050\170\052\034\144\011\040\004\000\200\041\224\017\101"}, {257, "file_input", 0, 2, states_1, - "\204\050\060\200\000\000\000\050\170\052\034\144\011\040\004\000\200\041\224\041\010"}, + "\204\050\060\200\000\000\000\050\170\052\034\144\011\040\004\000\200\041\224\017\101"}, {258, "eval_input", 0, 3, states_2, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {259, "decorator", 0, 7, states_3, "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {260, "decorators", 0, 2, states_4, @@ -1744,13 +1747,13 @@ static dfa dfas[81] = { {267, "vfpdef", 0, 2, states_11, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {268, "stmt", 0, 2, states_12, - "\000\050\060\200\000\000\000\050\170\052\034\144\011\040\004\000\200\041\224\041\010"}, + "\000\050\060\200\000\000\000\050\170\052\034\144\011\040\004\000\200\041\224\017\101"}, {269, "simple_stmt", 0, 4, states_13, - "\000\040\040\200\000\000\000\050\170\052\034\000\000\040\004\000\200\041\224\001\010"}, + "\000\040\040\200\000\000\000\050\170\052\034\000\000\040\004\000\200\041\224\017\100"}, {270, "small_stmt", 0, 2, states_14, - "\000\040\040\200\000\000\000\050\170\052\034\000\000\040\004\000\200\041\224\001\010"}, + "\000\040\040\200\000\000\000\050\170\052\034\000\000\040\004\000\200\041\224\017\100"}, {271, "expr_stmt", 0, 6, states_15, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {272, "augassign", 0, 2, states_16, "\000\000\000\000\000\200\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {273, "del_stmt", 0, 3, states_17, @@ -1758,7 +1761,7 @@ static dfa dfas[81] = { {274, "pass_stmt", 0, 2, states_18, "\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {275, "flow_stmt", 0, 2, states_19, - "\000\000\000\000\000\000\000\000\170\000\000\000\000\000\000\000\000\000\000\000\010"}, + "\000\000\000\000\000\000\000\000\170\000\000\000\000\000\000\000\000\000\000\000\100"}, {276, "break_stmt", 0, 2, states_20, "\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000"}, {277, "continue_stmt", 0, 2, states_21, @@ -1766,7 +1769,7 @@ static dfa dfas[81] = { {278, "return_stmt", 0, 3, states_22, "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000"}, {279, "yield_stmt", 0, 2, states_23, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100"}, {280, "raise_stmt", 0, 7, states_24, "\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000"}, {281, "import_stmt", 0, 2, states_25, @@ -1792,7 +1795,7 @@ static dfa dfas[81] = { {291, "assert_stmt", 0, 5, states_35, "\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, {292, "compound_stmt", 0, 2, states_36, - "\000\010\020\000\000\000\000\000\000\000\000\144\011\000\000\000\000\000\000\040\000"}, + "\000\010\020\000\000\000\000\000\000\000\000\144\011\000\000\000\000\000\000\000\001"}, {293, "if_stmt", 0, 8, states_37, "\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"}, {294, "while_stmt", 0, 8, states_38, @@ -1808,67 +1811,67 @@ static dfa dfas[81] = { {299, "except_clause", 0, 5, states_43, "\000\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000"}, {300, "suite", 0, 5, states_44, - "\004\040\040\200\000\000\000\050\170\052\034\000\000\040\004\000\200\041\224\001\010"}, + "\004\040\040\200\000\000\000\050\170\052\034\000\000\040\004\000\200\041\224\017\100"}, {301, "test", 0, 6, states_45, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {302, "test_nocond", 0, 2, states_46, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {303, "lambdef", 0, 5, states_47, "\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000"}, {304, "lambdef_nocond", 0, 5, states_48, "\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000"}, {305, "or_test", 0, 2, states_49, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\004\000\200\041\224\017\000"}, {306, "and_test", 0, 2, states_50, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\004\000\200\041\224\017\000"}, {307, "not_test", 0, 3, states_51, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\004\000\200\041\224\017\000"}, {308, "comparison", 0, 2, states_52, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\017\000"}, {309, "comp_op", 0, 4, states_53, "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\304\037\000\000\000\000\000"}, {310, "star_expr", 0, 3, states_54, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\017\000"}, {311, "expr", 0, 2, states_55, - "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\001\000"}, + "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\017\000"}, {312, "xor_expr", 0, 2, states_56, - "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\001\000"}, + "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\017\000"}, {313, "and_expr", 0, 2, states_57, - "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\001\000"}, + "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\017\000"}, {314, "shift_expr", 0, 2, states_58, - "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\001\000"}, + "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\017\000"}, {315, "arith_expr", 0, 2, states_59, - "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\001\000"}, + "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\017\000"}, {316, "term", 0, 2, states_60, - "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\001\000"}, + "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\017\000"}, {317, "factor", 0, 3, states_61, - "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\001\000"}, + "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\017\000"}, {318, "power", 0, 4, states_62, - "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\224\001\000"}, + "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\224\017\000"}, {319, "atom", 0, 9, states_63, - "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\224\001\000"}, + "\000\040\040\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\224\017\000"}, {320, "testlist_comp", 0, 5, states_64, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {321, "trailer", 0, 7, states_65, "\000\040\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\004\000\000"}, {322, "subscriptlist", 0, 3, states_66, - "\000\040\040\202\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\202\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {323, "subscript", 0, 5, states_67, - "\000\040\040\202\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\202\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {324, "sliceop", 0, 3, states_68, "\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {325, "exprlist", 0, 3, states_69, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\000\000\000\200\041\224\017\000"}, {326, "testlist", 0, 3, states_70, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {327, "dictorsetmaker", 0, 9, states_71, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {328, "classdef", 0, 8, states_72, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001"}, {329, "arglist", 0, 8, states_73, - "\000\040\040\200\001\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\200\001\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {330, "argument", 0, 4, states_74, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {331, "comp_iter", 0, 2, states_75, "\000\000\000\000\000\000\000\000\000\000\000\104\000\000\000\000\000\000\000\000\000"}, {332, "comp_for", 0, 6, states_76, @@ -1876,13 +1879,13 @@ static dfa dfas[81] = { {333, "comp_if", 0, 4, states_77, "\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"}, {334, "testlist1", 0, 2, states_78, - "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\001\000"}, + "\000\040\040\200\000\000\000\000\000\040\000\000\000\040\004\000\200\041\224\017\000"}, {335, "encoding_decl", 0, 2, states_79, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {336, "yield_expr", 0, 3, states_80, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100"}, }; -static label labels[164] = { +static label labels[167] = { {0, "EMPTY"}, {256, 0}, {4, 0}, @@ -2036,6 +2039,9 @@ static label labels[164] = { {27, 0}, {2, 0}, {3, 0}, + {1, "None"}, + {1, "True"}, + {1, "False"}, {332, 0}, {322, 0}, {323, 0}, @@ -2051,6 +2057,6 @@ static label labels[164] = { grammar _PyParser_Grammar = { 81, dfas, - {164, labels}, + {167, labels}, 256 }; diff --git a/Python/import.c b/Python/import.c index e1a80f4..75f1e01 100644 --- a/Python/import.c +++ b/Python/import.c @@ -371,7 +371,6 @@ PyImport_GetModuleDict(void) /* List of names to clear in sys */ static char* sys_deletes[] = { "path", "argv", "ps1", "ps2", - "exc_type", "exc_value", "exc_traceback", "last_type", "last_value", "last_traceback", "path_hooks", "path_importer_cache", "meta_path", NULL @@ -2413,7 +2412,7 @@ PyImport_ReloadModule(PyObject *m) if (modules_reloading == NULL) { Py_FatalError("PyImport_ReloadModule: " - "no modules_reloading dictionary!"); + "no modules_reloading dictionary!"); return NULL; } @@ -2457,7 +2456,7 @@ PyImport_ReloadModule(PyObject *m) "reload(): parent %.200s not in sys.modules", PyString_AS_STRING(parentname)); Py_DECREF(parentname); - imp_modules_reloading_clear(); + imp_modules_reloading_clear(); return NULL; } Py_DECREF(parentname); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index a8bb918..442e66a 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -163,33 +163,6 @@ clause in the current stack frame or in an older stack frame." ); static PyObject * -sys_exc_clear(PyObject *self, PyObject *noargs) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = NULL; - tstate->exc_value = NULL; - tstate->exc_traceback = NULL; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(exc_clear_doc, -"exc_clear() -> None\n\ -\n\ -Clear global information on the current exception. Subsequent calls to\n\ -exc_info() will return (None,None,None) until another exception is raised\n\ -in the current thread or the execution stack returns to a frame where\n\ -another exception is being handled." -); - -static PyObject * sys_exit(PyObject *self, PyObject *args) { PyObject *exit_code = 0; @@ -765,7 +738,6 @@ static PyMethodDef sys_methods[] = { current_frames_doc}, {"displayhook", sys_displayhook, METH_O, displayhook_doc}, {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc}, - {"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc}, {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc}, {"exit", sys_exit, METH_VARARGS, exit_doc}, {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, @@ -907,12 +879,6 @@ last_value -- value of last uncaught exception\n\ last_traceback -- traceback of last uncaught exception\n\ These three are only available in an interactive session after a\n\ traceback has been printed.\n\ -\n\ -exc_type -- type of exception currently being handled\n\ -exc_value -- value of exception currently being handled\n\ -exc_traceback -- traceback of exception currently being handled\n\ - The function exc_info() should be used instead of these three,\n\ - because it is thread-safe.\n\ " ) /* concatenating string here */ @@ -953,7 +919,6 @@ Functions:\n\ displayhook() -- print an object to the screen, and save it in __builtin__._\n\ excepthook() -- print an exception and its traceback to sys.stderr\n\ exc_info() -- return thread-safe information about the current exception\n\ -exc_clear() -- clear the exception state for the current thread\n\ exit() -- exit the interpreter by raising SystemExit\n\ getdlopenflags() -- returns flags to be used for dlopen() calls\n\ getrefcount() -- return the reference count for an object (plus one :-)\n\ |