summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-01-01 15:46:10 (GMT)
committerGeorg Brandl <georg@python.org>2009-01-01 15:46:10 (GMT)
commit47fe9817f12caa13830dbb4a166b779389d69bc2 (patch)
treef8736de40a3478cc53e5250afc4ae45022c705f9 /Modules
parentb5fc36c86ea5c952b1c478fdd81939c4ef96aac1 (diff)
downloadcpython-47fe9817f12caa13830dbb4a166b779389d69bc2.zip
cpython-47fe9817f12caa13830dbb4a166b779389d69bc2.tar.gz
cpython-47fe9817f12caa13830dbb4a166b779389d69bc2.tar.bz2
Merged revisions 67952-67953,67955,67957-67958,67960-67961,67963,67965,67967,67970-67971,67973,67982,67988,67990,67995,68014,68016,68030,68057,68061,68112,68115-68118,68120-68121,68123-68128 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r67952 | georg.brandl | 2008-12-27 18:42:40 +0100 (Sat, 27 Dec 2008) | 2 lines #4752: actually use custom handler in example. ........ r67953 | georg.brandl | 2008-12-27 19:20:04 +0100 (Sat, 27 Dec 2008) | 3 lines Patch #4739 by David Laban: add symbols to pydoc help topics, so that ``help('@')`` works as expected. ........ r67955 | georg.brandl | 2008-12-27 19:27:53 +0100 (Sat, 27 Dec 2008) | 3 lines Follow-up to r67746 in order to restore backwards-compatibility for those who (monkey-)patch TextWrapper.wordsep_re with a custom RE. ........ r67957 | georg.brandl | 2008-12-27 19:49:19 +0100 (Sat, 27 Dec 2008) | 2 lines #4754: improve winsound documentation. ........ r67958 | georg.brandl | 2008-12-27 20:02:59 +0100 (Sat, 27 Dec 2008) | 2 lines #4682: 'b' is actually unsigned char. ........ r67960 | georg.brandl | 2008-12-27 20:04:44 +0100 (Sat, 27 Dec 2008) | 2 lines #4695: fix backslashery. ........ r67961 | georg.brandl | 2008-12-27 20:06:04 +0100 (Sat, 27 Dec 2008) | 2 lines Use :samp: role. ........ r67963 | georg.brandl | 2008-12-27 20:11:15 +0100 (Sat, 27 Dec 2008) | 2 lines #4671: document that pydoc imports modules. ........ r67965 | antoine.pitrou | 2008-12-27 21:34:52 +0100 (Sat, 27 Dec 2008) | 3 lines Issue #4677: add two list comprehension tests to pybench. ........ r67967 | benjamin.peterson | 2008-12-27 23:18:58 +0100 (Sat, 27 Dec 2008) | 1 line fix markup ........ r67970 | alexandre.vassalotti | 2008-12-28 02:52:58 +0100 (Sun, 28 Dec 2008) | 2 lines Fix name mangling of PyUnicode_ClearFreeList. ........ r67971 | alexandre.vassalotti | 2008-12-28 03:10:35 +0100 (Sun, 28 Dec 2008) | 2 lines Sort UCS-2/UCS-4 name mangling list. ........ r67973 | alexandre.vassalotti | 2008-12-28 03:58:22 +0100 (Sun, 28 Dec 2008) | 2 lines Document Py_VaBuildValue. ........ r67982 | benjamin.peterson | 2008-12-28 16:37:31 +0100 (Sun, 28 Dec 2008) | 1 line fix WORD_BIGEDIAN declaration in Universal builds; fixes #4060 and #4728 ........ r67988 | ronald.oussoren | 2008-12-28 20:40:56 +0100 (Sun, 28 Dec 2008) | 1 line Issue4064: architecture string for universal builds on OSX ........ r67990 | ronald.oussoren | 2008-12-28 20:50:40 +0100 (Sun, 28 Dec 2008) | 3 lines Update the fix for issue4064 to deal correctly with all three variants of universal builds that are presented by the configure script. ........ r67995 | benjamin.peterson | 2008-12-28 22:16:07 +0100 (Sun, 28 Dec 2008) | 1 line #4763 PyErr_ExceptionMatches won't blow up with NULL arguments ........ r68014 | benjamin.peterson | 2008-12-29 18:47:42 +0100 (Mon, 29 Dec 2008) | 1 line #4764 set IOError.filename when trying to open a directory on POSIX platforms ........ r68016 | benjamin.peterson | 2008-12-29 18:56:58 +0100 (Mon, 29 Dec 2008) | 1 line #4764 in io.open, set IOError.filename when trying to open a directory on POSIX platforms ........ r68030 | benjamin.peterson | 2008-12-29 22:38:14 +0100 (Mon, 29 Dec 2008) | 1 line fix French ........ r68057 | vinay.sajip | 2008-12-30 08:01:25 +0100 (Tue, 30 Dec 2008) | 1 line Minor documentation change relating to NullHandler. ........ r68061 | georg.brandl | 2008-12-30 11:15:49 +0100 (Tue, 30 Dec 2008) | 2 lines #4778: attributes can't be called. ........ r68112 | benjamin.peterson | 2009-01-01 00:48:39 +0100 (Thu, 01 Jan 2009) | 1 line #4795 inspect.isgeneratorfunction() should return False instead of None ........ r68115 | benjamin.peterson | 2009-01-01 05:04:41 +0100 (Thu, 01 Jan 2009) | 1 line simplfy code ........ r68116 | georg.brandl | 2009-01-01 12:46:51 +0100 (Thu, 01 Jan 2009) | 2 lines #4100: note that element children are not necessarily present on "start" events. ........ r68117 | georg.brandl | 2009-01-01 12:53:55 +0100 (Thu, 01 Jan 2009) | 2 lines #4156: make clear that "protocol" is to be replaced with the protocol name. ........ r68118 | georg.brandl | 2009-01-01 13:00:19 +0100 (Thu, 01 Jan 2009) | 2 lines #4185: clarify escape behavior of replacement strings. ........ r68120 | georg.brandl | 2009-01-01 13:15:31 +0100 (Thu, 01 Jan 2009) | 4 lines #4228: Pack negative values the same way as 2.4 in struct's L format. ........ r68121 | georg.brandl | 2009-01-01 13:43:33 +0100 (Thu, 01 Jan 2009) | 2 lines Point to types module in new module deprecation notice. ........ r68123 | georg.brandl | 2009-01-01 13:52:29 +0100 (Thu, 01 Jan 2009) | 2 lines #4784: ... on three counts ... ........ r68124 | georg.brandl | 2009-01-01 13:53:19 +0100 (Thu, 01 Jan 2009) | 2 lines #4782: Fix markup error that hid load() and loads(). ........ r68125 | georg.brandl | 2009-01-01 14:02:09 +0100 (Thu, 01 Jan 2009) | 2 lines #4776: add data_files and package_dir arguments. ........ r68126 | georg.brandl | 2009-01-01 14:05:13 +0100 (Thu, 01 Jan 2009) | 2 lines Handlers are in the `logging.handlers` module. ........ r68127 | georg.brandl | 2009-01-01 14:14:49 +0100 (Thu, 01 Jan 2009) | 2 lines #4767: Use correct submodules for all MIME classes. ........ r68128 | antoine.pitrou | 2009-01-01 15:11:22 +0100 (Thu, 01 Jan 2009) | 3 lines Issue #3680: Reference cycles created through a dict, set or deque iterator did not get collected. ........
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_collectionsmodule.c23
-rw-r--r--Modules/_fileio.c8
-rw-r--r--Modules/_struct.c12
3 files changed, 26 insertions, 17 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index da000d0..37633d2 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -958,7 +958,7 @@ deque_iter(dequeobject *deque)
{
dequeiterobject *it;
- it = PyObject_New(dequeiterobject, &dequeiter_type);
+ it = PyObject_GC_New(dequeiterobject, &dequeiter_type);
if (it == NULL)
return NULL;
it->b = deque->leftblock;
@@ -967,14 +967,22 @@ deque_iter(dequeobject *deque)
it->deque = deque;
it->state = deque->state;
it->counter = deque->len;
+ _PyObject_GC_TRACK(it);
return (PyObject *)it;
}
+static int
+dequeiter_traverse(dequeiterobject *dio, visitproc visit, void *arg)
+{
+ Py_VISIT(dio->deque);
+ return 0;
+}
+
static void
dequeiter_dealloc(dequeiterobject *dio)
{
Py_XDECREF(dio->deque);
- Py_TYPE(dio)->tp_free(dio);
+ PyObject_GC_Del(dio);
}
static PyObject *
@@ -1039,9 +1047,9 @@ static PyTypeObject dequeiter_type = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
0, /* tp_doc */
- 0, /* tp_traverse */
+ (traverseproc)dequeiter_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
@@ -1060,7 +1068,7 @@ deque_reviter(dequeobject *deque)
{
dequeiterobject *it;
- it = PyObject_New(dequeiterobject, &dequereviter_type);
+ it = PyObject_GC_New(dequeiterobject, &dequereviter_type);
if (it == NULL)
return NULL;
it->b = deque->rightblock;
@@ -1069,6 +1077,7 @@ deque_reviter(dequeobject *deque)
it->deque = deque;
it->state = deque->state;
it->counter = deque->len;
+ _PyObject_GC_TRACK(it);
return (PyObject *)it;
}
@@ -1121,9 +1130,9 @@ static PyTypeObject dequereviter_type = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
0, /* tp_doc */
- 0, /* tp_traverse */
+ (traverseproc)dequeiter_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
diff --git a/Modules/_fileio.c b/Modules/_fileio.c
index 65cc99d..ca12822 100644
--- a/Modules/_fileio.c
+++ b/Modules/_fileio.c
@@ -98,7 +98,7 @@ fileio_new(PyTypeObject *type, PyObject *args, PyObject *kews)
directories, so we need a check. */
static int
-dircheck(PyFileIOObject* self)
+dircheck(PyFileIOObject* self, char *name)
{
#if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR)
struct stat buf;
@@ -109,8 +109,8 @@ dircheck(PyFileIOObject* self)
PyObject *exc;
internal_close(self);
- exc = PyObject_CallFunction(PyExc_IOError, "(is)",
- EISDIR, msg);
+ exc = PyObject_CallFunction(PyExc_IOError, "(iss)",
+ EISDIR, msg, name);
PyErr_SetObject(PyExc_IOError, exc);
Py_XDECREF(exc);
return -1;
@@ -271,7 +271,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
#endif
goto error;
}
- if(dircheck(self) < 0)
+ if(dircheck(self, name) < 0)
goto error;
}
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 30feaa6..b8f1525 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -663,7 +663,7 @@ np_int(char *p, PyObject *v, const formatdef *f)
return -1;
#if (SIZEOF_LONG > SIZEOF_INT)
if ((x < ((long)INT_MIN)) || (x > ((long)INT_MAX)))
- return _range_error(f, 0);
+ RANGE_ERROR(x, f, 0, -1);
#endif
y = (int)x;
memcpy(p, (char *)&y, sizeof y);
@@ -675,12 +675,12 @@ np_uint(char *p, PyObject *v, const formatdef *f)
{
unsigned long x;
unsigned int y;
- if (get_ulong(v, &x) < 0)
- return _range_error(f, 1);
+ if (get_wrapped_ulong(v, &x) < 0)
+ return -1;
y = (unsigned int)x;
#if (SIZEOF_LONG > SIZEOF_INT)
if (x > ((unsigned long)UINT_MAX))
- return _range_error(f, 1);
+ RANGE_ERROR(y, f, 1, -1);
#endif
memcpy(p, (char *)&y, sizeof y);
return 0;
@@ -700,8 +700,8 @@ static int
np_ulong(char *p, PyObject *v, const formatdef *f)
{
unsigned long x;
- if (get_ulong(v, &x) < 0)
- return _range_error(f, 1);
+ if (get_wrapped_ulong(v, &x) < 0)
+ return -1;
memcpy(p, (char *)&x, sizeof x);
return 0;
}