diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-27 23:50:43 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-27 23:50:43 (GMT) |
commit | 26855635833fcd3f15786b4a9d4241ded293404c (patch) | |
tree | 37e1984aadfd2e688e7105ce112e3559bf93653e /Python | |
parent | 7b69c6c3afba79518865313e1b41845a6b534fb6 (diff) | |
download | cpython-26855635833fcd3f15786b4a9d4241ded293404c.zip cpython-26855635833fcd3f15786b4a9d4241ded293404c.tar.gz cpython-26855635833fcd3f15786b4a9d4241ded293404c.tar.bz2 |
Merged revisions 60364-60378 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60364 | neal.norwitz | 2008-01-27 19:09:48 +0100 (Sun, 27 Jan 2008) | 4 lines
Update the comment and remove the close. If we close we can't flush anymore.
We might still need to close after the for loop if flushing 6! times still
doesn't cause the signal/exception.
........
r60365 | georg.brandl | 2008-01-27 19:14:43 +0100 (Sun, 27 Jan 2008) | 2 lines
Remove effectless expression statement.
........
r60367 | neal.norwitz | 2008-01-27 19:19:04 +0100 (Sun, 27 Jan 2008) | 1 line
Try to handle socket.errors properly in is_unavailable
........
r60370 | christian.heimes | 2008-01-27 20:01:45 +0100 (Sun, 27 Jan 2008) | 1 line
Change isbasestring function as discussed on the cvs list a while ago
........
r60372 | neal.norwitz | 2008-01-27 21:03:13 +0100 (Sun, 27 Jan 2008) | 3 lines
socket.error doesn't have a headers attribute like ProtocolError.
Handle that situation where we catch socket.errors.
........
r60375 | georg.brandl | 2008-01-27 21:25:12 +0100 (Sun, 27 Jan 2008) | 2 lines
Add refcounting extension to build config.
........
r60377 | jeffrey.yasskin | 2008-01-28 00:08:46 +0100 (Mon, 28 Jan 2008) | 6 lines
Moved Rational._binary_float_to_ratio() to float.as_integer_ratio() because
it's useful outside of rational numbers.
This is my first C code that had to do anything significant. Please be more
careful when looking over it.
........
r60378 | christian.heimes | 2008-01-28 00:34:59 +0100 (Mon, 28 Jan 2008) | 1 line
Added clear cache methods to clear the internal type lookup cache for ref leak test runs.
........
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pythonrun.c | 3 | ||||
-rw-r--r-- | Python/sysmodule.c | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 9b72908..7cee8e4 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -404,6 +404,9 @@ Py_Finalize(void) Py_XDECREF(warnings_module); warnings_module = NULL; + /* Clear type lookup cache */ + PyType_ClearCache(); + /* Collect garbage. This may call finalizers; it's nice to call these * before all modules are destroyed. * XXX If a __del__ or weakref callback is triggered here, and tries to diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 499f328..e536f0a 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -730,6 +730,17 @@ a 11-tuple where the entries in the tuple are counts of:\n\ 10. Number of stack pops performed by call_function()" ); +static PyObject * +sys_cleartypecache(PyObject* self, PyObject* args) +{ + PyType_ClearCache(); + Py_RETURN_NONE; +} + +PyDoc_STRVAR(cleartypecache_doc, +"_cleartypecache() -> None\n\ +Clear the internal type lookup cache."); + #ifdef __cplusplus extern "C" { #endif @@ -752,6 +763,8 @@ static PyMethodDef sys_methods[] = { /* Might as well keep this in alphabetic order */ {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS, callstats_doc}, + {"_cleartypecache", sys_cleartypecache, METH_NOARGS, + cleartypecache_doc}, {"_current_frames", sys_current_frames, METH_NOARGS, current_frames_doc}, {"displayhook", sys_displayhook, METH_O, displayhook_doc}, |