1990-10-14 12:07:46 +00:00
|
|
|
/* Type object implementation */
|
|
|
|
|
|
1997-05-02 03:12:38 +00:00
|
|
|
#include "Python.h"
|
2023-06-26 15:02:43 +02:00
|
|
|
#include "pycore_abstract.h" // _PySequence_IterSearch()
|
|
|
|
|
#include "pycore_call.h" // _PyObject_VectorcallTstate()
|
2021-06-07 12:22:26 -06:00
|
|
|
#include "pycore_code.h" // CO_FAST_FREE
|
2022-11-16 10:37:29 -07:00
|
|
|
#include "pycore_dict.h" // _PyDict_KeysSize()
|
2025-03-17 14:41:05 +00:00
|
|
|
#include "pycore_function.h" // _PyFunction_GetVersionForCurrentState()
|
2025-03-19 18:17:44 +01:00
|
|
|
#include "pycore_interpframe.h" // _PyInterpreterFrame
|
2024-02-15 10:54:57 -08:00
|
|
|
#include "pycore_lock.h" // _PySeqLock_*
|
2024-05-21 22:38:12 -04:00
|
|
|
#include "pycore_long.h" // _PyLong_IsNegative(), _PyLong_GetOne()
|
2023-05-08 09:52:41 -07:00
|
|
|
#include "pycore_memoryobject.h" // _PyMemoryView_FromBufferProc()
|
2023-07-03 11:39:11 +02:00
|
|
|
#include "pycore_modsupport.h" // _PyArg_NoKwnames()
|
2021-04-22 00:52:52 +02:00
|
|
|
#include "pycore_moduleobject.h" // _PyModule_GetDef()
|
2021-10-12 08:38:19 +02:00
|
|
|
#include "pycore_object.h" // _PyType_HasFeature()
|
2024-01-20 11:14:45 -05:00
|
|
|
#include "pycore_object_alloc.h" // _PyObject_MallocWithType()
|
2025-02-25 21:24:20 -08:00
|
|
|
#include "pycore_pyatomic_ft_wrappers.h"
|
2021-10-12 08:38:19 +02:00
|
|
|
#include "pycore_pyerrors.h" // _PyErr_Occurred()
|
2020-04-15 02:35:41 +02:00
|
|
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
2023-06-21 16:35:58 +02:00
|
|
|
#include "pycore_symtable.h" // _Py_Mangle()
|
2021-12-09 12:59:26 -07:00
|
|
|
#include "pycore_typeobject.h" // struct type_cache
|
2025-03-17 14:41:05 +00:00
|
|
|
#include "pycore_unicodeobject.h" // _PyUnicode_Copy
|
2021-07-17 22:44:10 +03:00
|
|
|
#include "pycore_unionobject.h" // _Py_union_type_or
|
2023-06-21 16:35:58 +02:00
|
|
|
#include "pycore_weakref.h" // _PyWeakref_GET_REF()
|
2024-12-03 10:33:06 -08:00
|
|
|
#include "pycore_cell.h" // PyCell_GetRef()
|
2025-03-17 14:41:05 +00:00
|
|
|
#include "pycore_stats.h"
|
2021-06-08 16:01:34 -06:00
|
|
|
#include "opcode.h" // MAKE_CELL
|
2023-07-25 15:28:30 +02:00
|
|
|
|
2023-05-04 09:56:53 +02:00
|
|
|
#include <stddef.h> // ptrdiff_t
|
2002-06-04 19:52:53 +00:00
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
class type "PyTypeObject *" "&PyType_Type"
|
|
|
|
|
class object "PyObject *" "&PyBaseObject_Type"
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=4b94608d231c434b]*/
|
|
|
|
|
|
|
|
|
|
#include "clinic/typeobject.c.h"
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
|
2020-12-26 01:45:43 +01:00
|
|
|
/* Support type attribute lookup cache */
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
|
|
|
|
|
/* The cache can keep references to the names alive for longer than
|
|
|
|
|
they normally would. This is why the maximum size is limited to
|
|
|
|
|
MCACHE_MAX_ATTR_SIZE, since it might be a problem if very large
|
|
|
|
|
strings are used as attribute names. */
|
2010-05-09 15:52:27 +00:00
|
|
|
#define MCACHE_MAX_ATTR_SIZE 100
|
|
|
|
|
#define MCACHE_HASH(version, name_hash) \
|
2014-11-15 00:56:27 +01:00
|
|
|
(((unsigned int)(version) ^ (unsigned int)(name_hash)) \
|
|
|
|
|
& ((1 << MCACHE_SIZE_EXP) - 1))
|
|
|
|
|
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
#define MCACHE_HASH_METHOD(type, name) \
|
2025-04-28 23:38:29 -07:00
|
|
|
MCACHE_HASH(FT_ATOMIC_LOAD_UINT32_RELAXED((type)->tp_version_tag), \
|
2024-04-30 12:37:38 -07:00
|
|
|
((Py_ssize_t)(name)) >> 3)
|
2017-09-08 09:58:51 +03:00
|
|
|
#define MCACHE_CACHEABLE_NAME(name) \
|
|
|
|
|
PyUnicode_CheckExact(name) && \
|
2020-12-26 01:45:43 +01:00
|
|
|
(PyUnicode_GET_LENGTH(name) <= MCACHE_MAX_ATTR_SIZE)
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
|
2023-04-24 16:30:13 -06:00
|
|
|
#define NEXT_GLOBAL_VERSION_TAG _PyRuntime.types.next_version_tag
|
|
|
|
|
#define NEXT_VERSION_TAG(interp) \
|
|
|
|
|
(interp)->types.next_version_tag
|
2008-01-27 23:50:43 +00:00
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
|
2025-04-28 23:38:29 -07:00
|
|
|
// There's a global lock for mutation of types. This avoids having to take
|
|
|
|
|
// additional locks while doing various subclass processing which may result
|
|
|
|
|
// in odd behaviors w.r.t. running with the GIL as the outer type lock could
|
|
|
|
|
// be released and reacquired during a subclass update if there's contention
|
|
|
|
|
// on the subclass lock.
|
2024-02-15 16:28:31 -08:00
|
|
|
#define TYPE_LOCK &PyInterpreterState_Get()->types.mutex
|
2024-06-21 15:50:18 -04:00
|
|
|
#define BEGIN_TYPE_LOCK() Py_BEGIN_CRITICAL_SECTION_MUT(TYPE_LOCK)
|
|
|
|
|
#define END_TYPE_LOCK() Py_END_CRITICAL_SECTION()
|
2024-02-15 10:54:57 -08:00
|
|
|
|
2024-06-21 15:50:18 -04:00
|
|
|
#define BEGIN_TYPE_DICT_LOCK(d) \
|
|
|
|
|
Py_BEGIN_CRITICAL_SECTION2_MUT(TYPE_LOCK, &_PyObject_CAST(d)->ob_mutex)
|
2024-05-06 10:50:35 -07:00
|
|
|
|
2024-06-21 15:50:18 -04:00
|
|
|
#define END_TYPE_DICT_LOCK() Py_END_CRITICAL_SECTION2()
|
2024-05-06 10:50:35 -07:00
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
#define ASSERT_TYPE_LOCK_HELD() \
|
2025-04-28 23:38:29 -07:00
|
|
|
_Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED(TYPE_LOCK)
|
2024-02-15 10:54:57 -08:00
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
#define BEGIN_TYPE_LOCK()
|
|
|
|
|
#define END_TYPE_LOCK()
|
2024-05-06 10:50:35 -07:00
|
|
|
#define BEGIN_TYPE_DICT_LOCK(d)
|
|
|
|
|
#define END_TYPE_DICT_LOCK()
|
2024-02-15 10:54:57 -08:00
|
|
|
#define ASSERT_TYPE_LOCK_HELD()
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-02-25 11:44:59 +01:00
|
|
|
#define PyTypeObject_CAST(op) ((PyTypeObject *)(op))
|
2024-02-15 10:54:57 -08:00
|
|
|
|
2020-11-11 04:53:46 +08:00
|
|
|
typedef struct PySlot_Offset {
|
|
|
|
|
short subslot_offset;
|
|
|
|
|
short slot_offset;
|
|
|
|
|
} PySlot_Offset;
|
|
|
|
|
|
2023-05-08 09:52:41 -07:00
|
|
|
static void
|
|
|
|
|
slot_bf_releasebuffer(PyObject *self, Py_buffer *buffer);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
releasebuffer_call_python(PyObject *self, Py_buffer *buffer);
|
2014-11-15 00:56:27 +01:00
|
|
|
|
2012-06-23 23:20:45 +02:00
|
|
|
static PyObject *
|
|
|
|
|
slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
|
|
|
|
|
|
2020-07-03 02:09:28 +02:00
|
|
|
static int
|
|
|
|
|
slot_tp_setattro(PyObject *self, PyObject *name, PyObject *value);
|
|
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
static inline PyTypeObject *
|
|
|
|
|
type_from_ref(PyObject *ref)
|
|
|
|
|
{
|
2023-06-21 16:35:58 +02:00
|
|
|
PyObject *obj = _PyWeakref_GET_REF(ref);
|
|
|
|
|
if (obj == NULL) {
|
2023-05-01 20:34:43 -06:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return _PyType_CAST(obj);
|
|
|
|
|
}
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
|
2022-07-26 17:26:43 -06:00
|
|
|
|
|
|
|
|
/* helpers for for static builtin types */
|
|
|
|
|
|
2024-04-17 19:56:59 +02:00
|
|
|
#ifndef NDEBUG
|
2022-07-26 17:26:43 -06:00
|
|
|
static inline int
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_index_is_set(PyTypeObject *self)
|
2022-07-26 17:26:43 -06:00
|
|
|
{
|
2022-08-04 19:26:59 -06:00
|
|
|
return self->tp_subclasses != NULL;
|
2022-07-26 17:26:43 -06:00
|
|
|
}
|
2024-04-17 19:56:59 +02:00
|
|
|
#endif
|
2022-07-26 17:26:43 -06:00
|
|
|
|
|
|
|
|
static inline size_t
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_index_get(PyTypeObject *self)
|
2022-07-26 17:26:43 -06:00
|
|
|
{
|
2024-06-03 19:09:18 -04:00
|
|
|
assert(managed_static_type_index_is_set(self));
|
2022-07-26 17:26:43 -06:00
|
|
|
/* We store a 1-based index so 0 can mean "not initialized". */
|
2022-08-04 19:26:59 -06:00
|
|
|
return (size_t)self->tp_subclasses - 1;
|
2022-07-26 17:26:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_index_set(PyTypeObject *self, size_t index)
|
2022-07-26 17:26:43 -06:00
|
|
|
{
|
2024-06-03 19:09:18 -04:00
|
|
|
assert(index < _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES);
|
2022-07-26 17:26:43 -06:00
|
|
|
/* We store a 1-based index so 0 can mean "not initialized". */
|
2022-08-04 19:26:59 -06:00
|
|
|
self->tp_subclasses = (PyObject *)(index + 1);
|
2022-07-26 17:26:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_index_clear(PyTypeObject *self)
|
2022-07-26 17:26:43 -06:00
|
|
|
{
|
2022-08-04 19:26:59 -06:00
|
|
|
self->tp_subclasses = NULL;
|
2022-07-26 17:26:43 -06:00
|
|
|
}
|
|
|
|
|
|
2024-06-14 15:29:09 -04:00
|
|
|
static PyTypeObject *
|
|
|
|
|
static_ext_type_lookup(PyInterpreterState *interp, size_t index,
|
|
|
|
|
int64_t *p_interp_count)
|
2022-07-26 17:26:43 -06:00
|
|
|
{
|
2024-06-14 15:29:09 -04:00
|
|
|
assert(interp->runtime == &_PyRuntime);
|
|
|
|
|
assert(index < _Py_MAX_MANAGED_STATIC_EXT_TYPES);
|
2024-06-03 19:09:18 -04:00
|
|
|
|
2024-06-14 15:29:09 -04:00
|
|
|
size_t full_index = index + _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES;
|
|
|
|
|
int64_t interp_count =
|
|
|
|
|
_PyRuntime.types.managed_static.types[full_index].interp_count;
|
|
|
|
|
assert((interp_count == 0) ==
|
|
|
|
|
(_PyRuntime.types.managed_static.types[full_index].type == NULL));
|
|
|
|
|
*p_interp_count = interp_count;
|
|
|
|
|
|
|
|
|
|
PyTypeObject *type = interp->types.for_extensions.initialized[index].type;
|
|
|
|
|
if (type == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
assert(!interp->types.for_extensions.initialized[index].isbuiltin);
|
|
|
|
|
assert(type == _PyRuntime.types.managed_static.types[full_index].type);
|
|
|
|
|
assert(managed_static_type_index_is_set(type));
|
|
|
|
|
return type;
|
2024-06-03 19:09:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static managed_static_type_state *
|
|
|
|
|
managed_static_type_state_get(PyInterpreterState *interp, PyTypeObject *self)
|
|
|
|
|
{
|
|
|
|
|
// It's probably a builtin type.
|
|
|
|
|
size_t index = managed_static_type_index_get(self);
|
|
|
|
|
managed_static_type_state *state =
|
|
|
|
|
&(interp->types.builtins.initialized[index]);
|
|
|
|
|
if (state->type == self) {
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
if (index > _Py_MAX_MANAGED_STATIC_EXT_TYPES) {
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
return &(interp->types.for_extensions.initialized[index]);
|
2022-07-26 17:26:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* For static types we store some state in an array on each interpreter. */
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *
|
2023-05-01 19:36:00 -06:00
|
|
|
_PyStaticType_GetState(PyInterpreterState *interp, PyTypeObject *self)
|
2022-07-26 17:26:43 -06:00
|
|
|
{
|
|
|
|
|
assert(self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
|
2024-06-03 19:09:18 -04:00
|
|
|
return managed_static_type_state_get(interp, self);
|
2022-07-26 17:26:43 -06:00
|
|
|
}
|
|
|
|
|
|
2023-05-01 19:36:00 -06:00
|
|
|
/* Set the type's per-interpreter state. */
|
2022-07-26 17:26:43 -06:00
|
|
|
static void
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state_init(PyInterpreterState *interp, PyTypeObject *self,
|
|
|
|
|
int isbuiltin, int initial)
|
2022-07-26 17:26:43 -06:00
|
|
|
{
|
2024-06-14 15:29:09 -04:00
|
|
|
assert(interp->runtime == &_PyRuntime);
|
|
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
size_t index;
|
|
|
|
|
if (initial) {
|
|
|
|
|
assert(!managed_static_type_index_is_set(self));
|
|
|
|
|
if (isbuiltin) {
|
|
|
|
|
index = interp->types.builtins.num_initialized;
|
|
|
|
|
assert(index < _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PyMutex_Lock(&interp->types.mutex);
|
|
|
|
|
index = interp->types.for_extensions.next_index;
|
|
|
|
|
interp->types.for_extensions.next_index++;
|
|
|
|
|
PyMutex_Unlock(&interp->types.mutex);
|
|
|
|
|
assert(index < _Py_MAX_MANAGED_STATIC_EXT_TYPES);
|
|
|
|
|
}
|
|
|
|
|
managed_static_type_index_set(self, index);
|
2023-05-01 19:36:00 -06:00
|
|
|
}
|
2024-04-12 16:39:27 -06:00
|
|
|
else {
|
2024-06-03 19:09:18 -04:00
|
|
|
index = managed_static_type_index_get(self);
|
|
|
|
|
if (isbuiltin) {
|
|
|
|
|
assert(index == interp->types.builtins.num_initialized);
|
|
|
|
|
assert(index < _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
assert(index < _Py_MAX_MANAGED_STATIC_EXT_TYPES);
|
|
|
|
|
}
|
2024-04-12 16:39:27 -06:00
|
|
|
}
|
2024-06-14 15:29:09 -04:00
|
|
|
size_t full_index = isbuiltin
|
|
|
|
|
? index
|
|
|
|
|
: index + _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES;
|
|
|
|
|
|
|
|
|
|
assert((initial == 1) ==
|
|
|
|
|
(_PyRuntime.types.managed_static.types[full_index].interp_count == 0));
|
2024-06-17 15:16:00 -04:00
|
|
|
(void)_Py_atomic_add_int64(
|
|
|
|
|
&_PyRuntime.types.managed_static.types[full_index].interp_count, 1);
|
2024-06-14 15:29:09 -04:00
|
|
|
|
|
|
|
|
if (initial) {
|
|
|
|
|
assert(_PyRuntime.types.managed_static.types[full_index].type == NULL);
|
|
|
|
|
_PyRuntime.types.managed_static.types[full_index].type = self;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
assert(_PyRuntime.types.managed_static.types[full_index].type == self);
|
|
|
|
|
}
|
2022-07-26 17:26:43 -06:00
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = isbuiltin
|
|
|
|
|
? &(interp->types.builtins.initialized[index])
|
|
|
|
|
: &(interp->types.for_extensions.initialized[index]);
|
|
|
|
|
|
|
|
|
|
/* It should only be called once for each builtin type per interpreter. */
|
2023-05-01 19:36:00 -06:00
|
|
|
assert(state->type == NULL);
|
2022-07-26 17:26:43 -06:00
|
|
|
state->type = self;
|
2024-06-03 19:09:18 -04:00
|
|
|
state->isbuiltin = isbuiltin;
|
2023-05-01 19:36:00 -06:00
|
|
|
|
2022-08-04 19:26:59 -06:00
|
|
|
/* state->tp_subclasses is left NULL until init_subclasses() sets it. */
|
2022-07-28 19:23:47 -06:00
|
|
|
/* state->tp_weaklist is left NULL until insert_head() or insert_after()
|
|
|
|
|
(in weakrefobject.c) sets it. */
|
2023-05-01 19:36:00 -06:00
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
if (isbuiltin) {
|
|
|
|
|
interp->types.builtins.num_initialized++;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
interp->types.for_extensions.num_initialized++;
|
|
|
|
|
}
|
2022-07-26 17:26:43 -06:00
|
|
|
}
|
|
|
|
|
|
2023-05-01 19:36:00 -06:00
|
|
|
/* Reset the type's per-interpreter state.
|
2024-06-03 19:09:18 -04:00
|
|
|
This basically undoes what managed_static_type_state_init() did. */
|
2022-07-26 17:26:43 -06:00
|
|
|
static void
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state_clear(PyInterpreterState *interp, PyTypeObject *self,
|
|
|
|
|
int isbuiltin, int final)
|
2022-07-26 17:26:43 -06:00
|
|
|
{
|
2024-06-14 15:29:09 -04:00
|
|
|
size_t index = managed_static_type_index_get(self);
|
|
|
|
|
size_t full_index = isbuiltin
|
|
|
|
|
? index
|
|
|
|
|
: index + _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES;
|
|
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = isbuiltin
|
2024-06-14 15:29:09 -04:00
|
|
|
? &(interp->types.builtins.initialized[index])
|
|
|
|
|
: &(interp->types.for_extensions.initialized[index]);
|
|
|
|
|
assert(state != NULL);
|
|
|
|
|
|
|
|
|
|
assert(_PyRuntime.types.managed_static.types[full_index].interp_count > 0);
|
|
|
|
|
assert(_PyRuntime.types.managed_static.types[full_index].type == state->type);
|
2023-05-01 19:36:00 -06:00
|
|
|
|
|
|
|
|
assert(state->type != NULL);
|
2022-07-26 17:26:43 -06:00
|
|
|
state->type = NULL;
|
2022-07-28 19:23:47 -06:00
|
|
|
assert(state->tp_weaklist == NULL); // It was already cleared out.
|
2023-05-01 19:36:00 -06:00
|
|
|
|
2024-06-17 15:16:00 -04:00
|
|
|
(void)_Py_atomic_add_int64(
|
|
|
|
|
&_PyRuntime.types.managed_static.types[full_index].interp_count, -1);
|
2024-06-03 19:09:18 -04:00
|
|
|
if (final) {
|
2024-06-14 15:29:09 -04:00
|
|
|
assert(!_PyRuntime.types.managed_static.types[full_index].interp_count);
|
|
|
|
|
_PyRuntime.types.managed_static.types[full_index].type = NULL;
|
|
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_index_clear(self);
|
2023-05-01 19:36:00 -06:00
|
|
|
}
|
2022-07-26 17:26:43 -06:00
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
if (isbuiltin) {
|
|
|
|
|
assert(interp->types.builtins.num_initialized > 0);
|
|
|
|
|
interp->types.builtins.num_initialized--;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PyMutex_Lock(&interp->types.mutex);
|
|
|
|
|
assert(interp->types.for_extensions.num_initialized > 0);
|
|
|
|
|
interp->types.for_extensions.num_initialized--;
|
|
|
|
|
if (interp->types.for_extensions.num_initialized == 0) {
|
|
|
|
|
interp->types.for_extensions.next_index = 0;
|
|
|
|
|
}
|
|
|
|
|
PyMutex_Unlock(&interp->types.mutex);
|
|
|
|
|
}
|
2022-07-26 17:26:43 -06:00
|
|
|
}
|
|
|
|
|
|
2024-07-11 14:20:14 -06:00
|
|
|
|
2024-08-12 13:19:33 -06:00
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
_PyStaticType_GetBuiltins(void)
|
|
|
|
|
{
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
Py_ssize_t count = (Py_ssize_t)interp->types.builtins.num_initialized;
|
|
|
|
|
assert(count <= _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES);
|
|
|
|
|
|
|
|
|
|
PyObject *results = PyList_New(count);
|
|
|
|
|
if (results == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
for (Py_ssize_t i = 0; i < count; i++) {
|
|
|
|
|
PyTypeObject *cls = interp->types.builtins.initialized[i].type;
|
|
|
|
|
assert(cls != NULL);
|
|
|
|
|
assert(interp->types.builtins.initialized[i].isbuiltin);
|
|
|
|
|
PyList_SET_ITEM(results, i, Py_NewRef((PyObject *)cls));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return results;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
// Also see _PyStaticType_InitBuiltin() and _PyStaticType_FiniBuiltin().
|
2022-07-26 17:26:43 -06:00
|
|
|
|
|
|
|
|
/* end static builtin helpers */
|
|
|
|
|
|
2025-02-25 21:24:20 -08:00
|
|
|
static void
|
|
|
|
|
type_set_flags(PyTypeObject *tp, unsigned long flags)
|
|
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
if (tp->tp_flags & Py_TPFLAGS_READY) {
|
|
|
|
|
// It's possible the type object has been exposed to other threads
|
|
|
|
|
// if it's been marked ready. In that case, the type lock should be
|
|
|
|
|
// held when flags are modified.
|
|
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
}
|
|
|
|
|
// Since PyType_HasFeature() reads the flags without holding the type
|
|
|
|
|
// lock, we need an atomic store here.
|
|
|
|
|
FT_ATOMIC_STORE_ULONG_RELAXED(tp->tp_flags, flags);
|
2025-02-25 21:24:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
type_set_flags_with_mask(PyTypeObject *tp, unsigned long mask, unsigned long flags)
|
|
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
2025-02-25 21:24:20 -08:00
|
|
|
unsigned long new_flags = (tp->tp_flags & ~mask) | flags;
|
|
|
|
|
type_set_flags(tp, new_flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
type_add_flags(PyTypeObject *tp, unsigned long flag)
|
|
|
|
|
{
|
|
|
|
|
type_set_flags(tp, tp->tp_flags | flag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
type_clear_flags(PyTypeObject *tp, unsigned long flag)
|
|
|
|
|
{
|
|
|
|
|
type_set_flags(tp, tp->tp_flags & ~flag);
|
|
|
|
|
}
|
2022-07-26 17:26:43 -06:00
|
|
|
|
2023-05-02 21:30:03 -06:00
|
|
|
static inline void
|
|
|
|
|
start_readying(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = managed_static_type_state_get(interp, type);
|
2023-05-02 21:30:03 -06:00
|
|
|
assert(state != NULL);
|
|
|
|
|
assert(!state->readying);
|
|
|
|
|
state->readying = 1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
assert((type->tp_flags & Py_TPFLAGS_READYING) == 0);
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_READYING);
|
2023-05-02 21:30:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
stop_readying(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = managed_static_type_state_get(interp, type);
|
2023-05-02 21:30:03 -06:00
|
|
|
assert(state != NULL);
|
|
|
|
|
assert(state->readying);
|
|
|
|
|
state->readying = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
assert(type->tp_flags & Py_TPFLAGS_READYING);
|
2025-02-25 21:24:20 -08:00
|
|
|
type_clear_flags(type, Py_TPFLAGS_READYING);
|
2023-05-02 21:30:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
is_readying(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = managed_static_type_state_get(interp, type);
|
2023-05-02 21:30:03 -06:00
|
|
|
assert(state != NULL);
|
|
|
|
|
return state->readying;
|
|
|
|
|
}
|
|
|
|
|
return (type->tp_flags & Py_TPFLAGS_READYING) != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
/* accessors for objects stored on PyTypeObject */
|
|
|
|
|
|
|
|
|
|
static inline PyObject *
|
|
|
|
|
lookup_tp_dict(PyTypeObject *self)
|
|
|
|
|
{
|
2023-05-02 21:30:03 -06:00
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = _PyStaticType_GetState(interp, self);
|
2023-05-02 21:30:03 -06:00
|
|
|
assert(state != NULL);
|
|
|
|
|
return state->tp_dict;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
return self->tp_dict;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
_PyType_GetDict(PyTypeObject *self)
|
|
|
|
|
{
|
2023-05-02 21:30:03 -06:00
|
|
|
/* It returns a borrowed reference. */
|
2023-05-01 20:34:43 -06:00
|
|
|
return lookup_tp_dict(self);
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-10 10:41:02 -06:00
|
|
|
PyObject *
|
|
|
|
|
PyType_GetDict(PyTypeObject *self)
|
|
|
|
|
{
|
|
|
|
|
PyObject *dict = lookup_tp_dict(self);
|
|
|
|
|
return _Py_XNewRef(dict);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
static inline void
|
|
|
|
|
set_tp_dict(PyTypeObject *self, PyObject *dict)
|
|
|
|
|
{
|
2023-05-02 21:30:03 -06:00
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = _PyStaticType_GetState(interp, self);
|
2023-05-02 21:30:03 -06:00
|
|
|
assert(state != NULL);
|
|
|
|
|
state->tp_dict = dict;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
self->tp_dict = dict;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
clear_tp_dict(PyTypeObject *self)
|
|
|
|
|
{
|
2023-05-02 21:30:03 -06:00
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = _PyStaticType_GetState(interp, self);
|
2023-05-02 21:30:03 -06:00
|
|
|
assert(state != NULL);
|
|
|
|
|
Py_CLEAR(state->tp_dict);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
Py_CLEAR(self->tp_dict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline PyObject *
|
|
|
|
|
lookup_tp_bases(PyTypeObject *self)
|
|
|
|
|
{
|
|
|
|
|
return self->tp_bases;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
_PyType_GetBases(PyTypeObject *self)
|
|
|
|
|
{
|
2024-02-15 10:54:57 -08:00
|
|
|
PyObject *res;
|
|
|
|
|
|
|
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
res = lookup_tp_bases(self);
|
|
|
|
|
Py_INCREF(res);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
|
|
|
|
|
return res;
|
2023-05-01 20:34:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
2024-06-03 19:09:18 -04:00
|
|
|
set_tp_bases(PyTypeObject *self, PyObject *bases, int initial)
|
2023-05-01 20:34:43 -06:00
|
|
|
{
|
2025-04-15 14:13:51 +03:00
|
|
|
assert(PyTuple_Check(bases));
|
2023-05-02 21:30:03 -06:00
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
2023-05-30 18:13:35 -06:00
|
|
|
// XXX tp_bases can probably be statically allocated for each
|
|
|
|
|
// static builtin type.
|
2025-04-15 14:13:51 +03:00
|
|
|
assert(PyTuple_CheckExact(bases));
|
2024-06-03 19:09:18 -04:00
|
|
|
assert(initial);
|
2023-05-30 18:13:35 -06:00
|
|
|
assert(self->tp_bases == NULL);
|
|
|
|
|
if (PyTuple_GET_SIZE(bases) == 0) {
|
|
|
|
|
assert(self->tp_base == NULL);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
assert(PyTuple_GET_SIZE(bases) == 1);
|
|
|
|
|
assert(PyTuple_GET_ITEM(bases, 0) == (PyObject *)self->tp_base);
|
|
|
|
|
assert(self->tp_base->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
|
2024-10-10 18:19:08 +01:00
|
|
|
assert(_Py_IsImmortal(self->tp_base));
|
2023-05-30 18:13:35 -06:00
|
|
|
}
|
|
|
|
|
_Py_SetImmortal(bases);
|
2023-05-02 21:30:03 -06:00
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
self->tp_bases = bases;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
2024-06-03 19:09:18 -04:00
|
|
|
clear_tp_bases(PyTypeObject *self, int final)
|
2023-05-01 20:34:43 -06:00
|
|
|
{
|
2023-05-02 21:30:03 -06:00
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
2024-06-03 19:09:18 -04:00
|
|
|
if (final) {
|
2023-06-01 16:28:31 -06:00
|
|
|
if (self->tp_bases != NULL) {
|
|
|
|
|
if (PyTuple_GET_SIZE(self->tp_bases) == 0) {
|
|
|
|
|
Py_CLEAR(self->tp_bases);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2024-10-10 18:19:08 +01:00
|
|
|
assert(_Py_IsImmortal(self->tp_bases));
|
2023-06-01 16:28:31 -06:00
|
|
|
_Py_ClearImmortal(self->tp_bases);
|
|
|
|
|
}
|
2023-05-30 18:13:35 -06:00
|
|
|
}
|
|
|
|
|
}
|
2023-05-02 21:30:03 -06:00
|
|
|
return;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
Py_CLEAR(self->tp_bases);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline PyObject *
|
|
|
|
|
lookup_tp_mro(PyTypeObject *self)
|
|
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
2023-05-01 20:34:43 -06:00
|
|
|
return self->tp_mro;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
_PyType_GetMRO(PyTypeObject *self)
|
|
|
|
|
{
|
2024-03-15 12:35:29 -04:00
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
PyObject *mro = _Py_atomic_load_ptr_relaxed(&self->tp_mro);
|
|
|
|
|
if (mro == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2024-04-08 07:58:38 -07:00
|
|
|
if (_Py_TryIncrefCompare(&self->tp_mro, mro)) {
|
2024-03-15 12:35:29 -04:00
|
|
|
return mro;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
mro = lookup_tp_mro(self);
|
2024-03-15 12:35:29 -04:00
|
|
|
Py_XINCREF(mro);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
return mro;
|
2024-03-15 12:35:29 -04:00
|
|
|
#else
|
|
|
|
|
return Py_XNewRef(lookup_tp_mro(self));
|
|
|
|
|
#endif
|
2023-05-01 20:34:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
2024-06-03 19:09:18 -04:00
|
|
|
set_tp_mro(PyTypeObject *self, PyObject *mro, int initial)
|
2023-05-01 20:34:43 -06:00
|
|
|
{
|
2025-03-25 16:28:38 +03:00
|
|
|
if (mro != NULL) {
|
|
|
|
|
assert(PyTuple_CheckExact(mro));
|
|
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
|
|
|
|
// XXX tp_mro can probably be statically allocated for each
|
|
|
|
|
// static builtin type.
|
|
|
|
|
assert(initial);
|
|
|
|
|
assert(self->tp_mro == NULL);
|
|
|
|
|
/* Other checks are done via set_tp_bases. */
|
|
|
|
|
_Py_SetImmortal(mro);
|
|
|
|
|
}
|
2023-05-02 21:30:03 -06:00
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
self->tp_mro = mro;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
2024-06-03 19:09:18 -04:00
|
|
|
clear_tp_mro(PyTypeObject *self, int final)
|
2023-05-01 20:34:43 -06:00
|
|
|
{
|
2023-05-02 21:30:03 -06:00
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
2024-06-03 19:09:18 -04:00
|
|
|
if (final) {
|
2023-06-01 16:28:31 -06:00
|
|
|
if (self->tp_mro != NULL) {
|
|
|
|
|
if (PyTuple_GET_SIZE(self->tp_mro) == 0) {
|
|
|
|
|
Py_CLEAR(self->tp_mro);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2024-10-10 18:19:08 +01:00
|
|
|
assert(_Py_IsImmortal(self->tp_mro));
|
2023-06-01 16:28:31 -06:00
|
|
|
_Py_ClearImmortal(self->tp_mro);
|
|
|
|
|
}
|
2023-05-30 18:13:35 -06:00
|
|
|
}
|
|
|
|
|
}
|
2023-05-02 21:30:03 -06:00
|
|
|
return;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
Py_CLEAR(self->tp_mro);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
init_tp_subclasses(PyTypeObject *self)
|
|
|
|
|
{
|
|
|
|
|
PyObject *subclasses = PyDict_New();
|
|
|
|
|
if (subclasses == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = _PyStaticType_GetState(interp, self);
|
2023-05-01 20:34:43 -06:00
|
|
|
state->tp_subclasses = subclasses;
|
|
|
|
|
return subclasses;
|
|
|
|
|
}
|
|
|
|
|
self->tp_subclasses = (void *)subclasses;
|
|
|
|
|
return subclasses;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
clear_tp_subclasses(PyTypeObject *self)
|
|
|
|
|
{
|
|
|
|
|
/* Delete the dictionary to save memory. _PyStaticType_Dealloc()
|
|
|
|
|
callers also test if tp_subclasses is NULL to check if a static type
|
|
|
|
|
has no subclass. */
|
|
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = _PyStaticType_GetState(interp, self);
|
2023-05-01 20:34:43 -06:00
|
|
|
Py_CLEAR(state->tp_subclasses);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Py_CLEAR(self->tp_subclasses);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline PyObject *
|
|
|
|
|
lookup_tp_subclasses(PyTypeObject *self)
|
|
|
|
|
{
|
|
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state *state = _PyStaticType_GetState(interp, self);
|
2023-05-01 20:34:43 -06:00
|
|
|
assert(state != NULL);
|
|
|
|
|
return state->tp_subclasses;
|
|
|
|
|
}
|
|
|
|
|
return (PyObject *)self->tp_subclasses;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
_PyType_HasSubclasses(PyTypeObject *self)
|
|
|
|
|
{
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
if (self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN
|
|
|
|
|
// XXX _PyStaticType_GetState() should never return NULL.
|
|
|
|
|
&& _PyStaticType_GetState(interp, self) == NULL)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (lookup_tp_subclasses(self) == NULL) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject*
|
|
|
|
|
_PyType_GetSubclasses(PyTypeObject *self)
|
|
|
|
|
{
|
|
|
|
|
PyObject *list = PyList_New(0);
|
|
|
|
|
if (list == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *subclasses = lookup_tp_subclasses(self); // borrowed ref
|
|
|
|
|
if (subclasses == NULL) {
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
assert(PyDict_CheckExact(subclasses));
|
|
|
|
|
// The loop cannot modify tp_subclasses, there is no need
|
|
|
|
|
// to hold a strong reference (use a borrowed reference).
|
|
|
|
|
|
|
|
|
|
Py_ssize_t i = 0;
|
|
|
|
|
PyObject *ref; // borrowed ref
|
|
|
|
|
while (PyDict_Next(subclasses, &i, NULL, &ref)) {
|
2023-06-21 16:35:58 +02:00
|
|
|
PyTypeObject *subclass = type_from_ref(ref);
|
2023-05-01 20:34:43 -06:00
|
|
|
if (subclass == NULL) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PyList_Append(list, _PyObject_CAST(subclass)) < 0) {
|
|
|
|
|
Py_DECREF(list);
|
2023-06-21 16:35:58 +02:00
|
|
|
Py_DECREF(subclass);
|
2023-05-01 20:34:43 -06:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2023-06-21 16:35:58 +02:00
|
|
|
Py_DECREF(subclass);
|
2023-05-01 20:34:43 -06:00
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* end accessors for objects stored on PyTypeObject */
|
|
|
|
|
|
|
|
|
|
|
2014-01-24 06:17:25 -08:00
|
|
|
/*
|
2014-02-08 22:15:29 -08:00
|
|
|
* finds the beginning of the docstring's introspection signature.
|
2014-01-24 06:17:25 -08:00
|
|
|
* if present, returns a pointer pointing to the first '('.
|
|
|
|
|
* otherwise returns NULL.
|
2014-02-08 22:15:29 -08:00
|
|
|
*
|
|
|
|
|
* doesn't guarantee that the signature is valid, only that it
|
|
|
|
|
* has a valid prefix. (the signature must also pass skip_signature.)
|
2014-01-24 06:17:25 -08:00
|
|
|
*/
|
|
|
|
|
static const char *
|
2014-02-08 22:15:29 -08:00
|
|
|
find_signature(const char *name, const char *doc)
|
2014-01-24 06:17:25 -08:00
|
|
|
{
|
2014-02-08 22:15:29 -08:00
|
|
|
const char *dot;
|
|
|
|
|
size_t length;
|
|
|
|
|
|
|
|
|
|
if (!doc)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
assert(name != NULL);
|
|
|
|
|
|
|
|
|
|
/* for dotted names like classes, only use the last component */
|
|
|
|
|
dot = strrchr(name, '.');
|
|
|
|
|
if (dot)
|
|
|
|
|
name = dot + 1;
|
|
|
|
|
|
|
|
|
|
length = strlen(name);
|
|
|
|
|
if (strncmp(doc, name, length))
|
|
|
|
|
return NULL;
|
|
|
|
|
doc += length;
|
|
|
|
|
if (*doc != '(')
|
|
|
|
|
return NULL;
|
|
|
|
|
return doc;
|
2014-01-24 06:17:25 -08:00
|
|
|
}
|
|
|
|
|
|
2014-02-08 22:15:29 -08:00
|
|
|
#define SIGNATURE_END_MARKER ")\n--\n\n"
|
|
|
|
|
#define SIGNATURE_END_MARKER_LENGTH 6
|
2014-01-24 06:17:25 -08:00
|
|
|
/*
|
2019-08-31 06:21:19 +10:00
|
|
|
* skips past the end of the docstring's introspection signature.
|
2014-02-08 22:15:29 -08:00
|
|
|
* (assumes doc starts with a valid signature prefix.)
|
2014-01-24 06:17:25 -08:00
|
|
|
*/
|
|
|
|
|
static const char *
|
|
|
|
|
skip_signature(const char *doc)
|
|
|
|
|
{
|
2014-02-08 22:15:29 -08:00
|
|
|
while (*doc) {
|
|
|
|
|
if ((*doc == *SIGNATURE_END_MARKER) &&
|
|
|
|
|
!strncmp(doc, SIGNATURE_END_MARKER, SIGNATURE_END_MARKER_LENGTH))
|
|
|
|
|
return doc + SIGNATURE_END_MARKER_LENGTH;
|
|
|
|
|
if ((*doc == '\n') && (doc[1] == '\n'))
|
|
|
|
|
return NULL;
|
2014-01-24 06:17:25 -08:00
|
|
|
doc++;
|
2014-02-08 22:15:29 -08:00
|
|
|
}
|
|
|
|
|
return NULL;
|
2014-01-24 06:17:25 -08:00
|
|
|
}
|
|
|
|
|
|
2019-04-12 21:51:34 +02:00
|
|
|
int
|
2017-01-25 23:33:27 +01:00
|
|
|
_PyType_CheckConsistency(PyTypeObject *type)
|
|
|
|
|
{
|
2019-10-07 18:42:01 +02:00
|
|
|
#define CHECK(expr) \
|
|
|
|
|
do { if (!(expr)) { _PyObject_ASSERT_FAILED_MSG((PyObject *)type, Py_STRINGIFY(expr)); } } while (0)
|
|
|
|
|
|
|
|
|
|
CHECK(!_PyObject_IsFreed((PyObject *)type));
|
2018-10-26 18:47:15 +02:00
|
|
|
|
2017-01-25 23:33:27 +01:00
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_READY)) {
|
2019-10-07 18:42:01 +02:00
|
|
|
/* don't check static types before PyType_Ready() */
|
2017-01-25 23:33:27 +01:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-07 18:42:01 +02:00
|
|
|
CHECK(Py_REFCNT(type) >= 1);
|
|
|
|
|
CHECK(PyType_Check(type));
|
2019-04-12 21:51:34 +02:00
|
|
|
|
2023-05-02 21:30:03 -06:00
|
|
|
CHECK(!is_readying(type));
|
2023-05-01 20:34:43 -06:00
|
|
|
CHECK(lookup_tp_dict(type) != NULL);
|
2018-10-26 18:47:15 +02:00
|
|
|
|
2021-06-01 23:37:12 +02:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_HAVE_GC) {
|
|
|
|
|
// bpo-44263: tp_traverse is required if Py_TPFLAGS_HAVE_GC is set.
|
|
|
|
|
// Note: tp_clear is optional.
|
|
|
|
|
CHECK(type->tp_traverse != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-30 12:46:15 +02:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_DISALLOW_INSTANTIATION) {
|
|
|
|
|
CHECK(type->tp_new == NULL);
|
2023-05-01 20:34:43 -06:00
|
|
|
CHECK(PyDict_Contains(lookup_tp_dict(type), &_Py_ID(__new__)) == 0);
|
2021-04-30 12:46:15 +02:00
|
|
|
}
|
|
|
|
|
|
2019-04-12 21:51:34 +02:00
|
|
|
return 1;
|
2019-10-07 18:42:01 +02:00
|
|
|
#undef CHECK
|
2017-01-25 23:33:27 +01:00
|
|
|
}
|
|
|
|
|
|
2014-01-24 06:17:25 -08:00
|
|
|
static const char *
|
2014-02-08 22:15:29 -08:00
|
|
|
_PyType_DocWithoutSignature(const char *name, const char *internal_doc)
|
2014-01-24 06:17:25 -08:00
|
|
|
{
|
2014-02-08 22:15:29 -08:00
|
|
|
const char *doc = find_signature(name, internal_doc);
|
2014-01-24 06:17:25 -08:00
|
|
|
|
2014-02-08 22:15:29 -08:00
|
|
|
if (doc) {
|
|
|
|
|
doc = skip_signature(doc);
|
|
|
|
|
if (doc)
|
|
|
|
|
return doc;
|
|
|
|
|
}
|
2014-01-24 06:17:25 -08:00
|
|
|
return internal_doc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *
|
2014-02-08 22:15:29 -08:00
|
|
|
_PyType_GetDocFromInternalDoc(const char *name, const char *internal_doc)
|
2014-01-24 06:17:25 -08:00
|
|
|
{
|
2014-02-08 22:15:29 -08:00
|
|
|
const char *doc = _PyType_DocWithoutSignature(name, internal_doc);
|
2014-01-24 06:17:25 -08:00
|
|
|
|
2015-04-13 18:22:35 -05:00
|
|
|
if (!doc || *doc == '\0') {
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2014-01-24 06:17:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return PyUnicode_FromString(doc);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-11 18:08:38 +03:00
|
|
|
static const char *
|
|
|
|
|
signature_from_flags(int flags)
|
|
|
|
|
{
|
|
|
|
|
switch (flags & ~METH_COEXIST) {
|
|
|
|
|
case METH_NOARGS:
|
|
|
|
|
return "($self, /)";
|
|
|
|
|
case METH_NOARGS|METH_CLASS:
|
|
|
|
|
return "($type, /)";
|
|
|
|
|
case METH_NOARGS|METH_STATIC:
|
|
|
|
|
return "()";
|
|
|
|
|
case METH_O:
|
|
|
|
|
return "($self, object, /)";
|
|
|
|
|
case METH_O|METH_CLASS:
|
|
|
|
|
return "($type, object, /)";
|
|
|
|
|
case METH_O|METH_STATIC:
|
|
|
|
|
return "(object, /)";
|
|
|
|
|
default:
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-24 06:17:25 -08:00
|
|
|
PyObject *
|
2023-08-11 18:08:38 +03:00
|
|
|
_PyType_GetTextSignatureFromInternalDoc(const char *name, const char *internal_doc, int flags)
|
2014-01-24 06:17:25 -08:00
|
|
|
{
|
2014-02-08 22:15:29 -08:00
|
|
|
const char *start = find_signature(name, internal_doc);
|
|
|
|
|
const char *end;
|
2014-01-24 06:17:25 -08:00
|
|
|
|
2014-02-08 22:15:29 -08:00
|
|
|
if (start)
|
|
|
|
|
end = skip_signature(start);
|
|
|
|
|
else
|
|
|
|
|
end = NULL;
|
|
|
|
|
if (!end) {
|
2023-08-11 18:08:38 +03:00
|
|
|
start = signature_from_flags(flags);
|
|
|
|
|
if (start) {
|
|
|
|
|
return PyUnicode_FromString(start);
|
|
|
|
|
}
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2014-01-24 06:17:25 -08:00
|
|
|
}
|
|
|
|
|
|
2014-02-08 22:15:29 -08:00
|
|
|
/* back "end" up until it points just past the final ')' */
|
|
|
|
|
end -= SIGNATURE_END_MARKER_LENGTH - 1;
|
|
|
|
|
assert((end - start) >= 2); /* should be "()" at least */
|
|
|
|
|
assert(end[-1] == ')');
|
|
|
|
|
assert(end[0] == '\n');
|
|
|
|
|
return PyUnicode_FromStringAndSize(start, end - start);
|
2014-01-24 06:17:25 -08:00
|
|
|
}
|
|
|
|
|
|
2020-12-26 01:45:43 +01:00
|
|
|
|
|
|
|
|
static struct type_cache*
|
|
|
|
|
get_type_cache(void)
|
2008-01-27 23:50:43 +00:00
|
|
|
{
|
2020-12-26 01:45:43 +01:00
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2022-07-26 17:26:43 -06:00
|
|
|
return &interp->types.type_cache;
|
2020-12-26 01:45:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2021-08-16 12:21:34 +01:00
|
|
|
type_cache_clear(struct type_cache *cache, PyObject *value)
|
2020-12-26 01:45:43 +01:00
|
|
|
{
|
|
|
|
|
for (Py_ssize_t i = 0; i < (1 << MCACHE_SIZE_EXP); i++) {
|
|
|
|
|
struct type_cache_entry *entry = &cache->hashtable[i];
|
2024-02-15 10:54:57 -08:00
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
_PySeqLock_LockWrite(&entry->sequence);
|
|
|
|
|
#endif
|
2020-12-26 01:45:43 +01:00
|
|
|
entry->version = 0;
|
2021-08-16 12:21:34 +01:00
|
|
|
Py_XSETREF(entry->name, _Py_XNewRef(value));
|
2020-12-26 01:45:43 +01:00
|
|
|
entry->value = NULL;
|
2024-02-15 10:54:57 -08:00
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
_PySeqLock_UnlockWrite(&entry->sequence);
|
|
|
|
|
#endif
|
2020-12-26 01:45:43 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_PyType_InitCache(PyInterpreterState *interp)
|
|
|
|
|
{
|
2022-07-26 17:26:43 -06:00
|
|
|
struct type_cache *cache = &interp->types.type_cache;
|
2020-12-26 01:45:43 +01:00
|
|
|
for (Py_ssize_t i = 0; i < (1 << MCACHE_SIZE_EXP); i++) {
|
|
|
|
|
struct type_cache_entry *entry = &cache->hashtable[i];
|
|
|
|
|
assert(entry->name == NULL);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2020-12-26 01:45:43 +01:00
|
|
|
entry->version = 0;
|
2024-05-06 10:50:35 -07:00
|
|
|
// Set to None so _PyType_LookupRef() can use Py_SETREF(),
|
2020-12-26 01:45:43 +01:00
|
|
|
// rather than using slower Py_XSETREF().
|
2023-03-21 11:46:09 -06:00
|
|
|
entry->name = Py_None;
|
2020-12-26 01:45:43 +01:00
|
|
|
entry->value = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static unsigned int
|
2021-03-13 21:38:36 +08:00
|
|
|
_PyType_ClearCache(PyInterpreterState *interp)
|
2020-12-26 01:45:43 +01:00
|
|
|
{
|
2022-07-26 17:26:43 -06:00
|
|
|
struct type_cache *cache = &interp->types.type_cache;
|
2024-05-06 10:50:35 -07:00
|
|
|
// Set to None, rather than NULL, so _PyType_LookupRef() can
|
2021-08-16 12:21:34 +01:00
|
|
|
// use Py_SETREF() rather than using slower Py_XSETREF().
|
|
|
|
|
type_cache_clear(cache, Py_None);
|
2020-12-26 01:45:43 +01:00
|
|
|
|
2023-04-24 16:30:13 -06:00
|
|
|
return NEXT_VERSION_TAG(interp) - 1;
|
2008-01-27 23:50:43 +00:00
|
|
|
}
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
|
2020-12-26 01:45:43 +01:00
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
|
PyType_ClearCache(void)
|
|
|
|
|
{
|
2021-03-13 21:38:36 +08:00
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
return _PyType_ClearCache(interp);
|
2020-12-26 01:45:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-05-04 20:45:02 +02:00
|
|
|
void
|
2021-12-09 12:59:26 -07:00
|
|
|
_PyTypes_Fini(PyInterpreterState *interp)
|
2013-05-04 20:45:02 +02:00
|
|
|
{
|
2022-07-26 17:26:43 -06:00
|
|
|
struct type_cache *cache = &interp->types.type_cache;
|
2021-08-16 12:21:34 +01:00
|
|
|
type_cache_clear(cache, NULL);
|
2022-07-26 17:26:43 -06:00
|
|
|
|
2024-06-14 15:29:09 -04:00
|
|
|
// All the managed static types should have been finalized already.
|
|
|
|
|
assert(interp->types.for_extensions.num_initialized == 0);
|
|
|
|
|
for (size_t i = 0; i < _Py_MAX_MANAGED_STATIC_EXT_TYPES; i++) {
|
|
|
|
|
assert(interp->types.for_extensions.initialized[i].type == NULL);
|
|
|
|
|
}
|
2024-06-03 19:09:18 -04:00
|
|
|
assert(interp->types.builtins.num_initialized == 0);
|
|
|
|
|
for (size_t i = 0; i < _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES; i++) {
|
|
|
|
|
assert(interp->types.builtins.initialized[i].type == NULL);
|
2022-07-26 17:26:43 -06:00
|
|
|
}
|
2013-05-04 20:45:02 +02:00
|
|
|
}
|
|
|
|
|
|
2020-12-26 01:45:43 +01:00
|
|
|
|
2022-10-21 07:41:51 -06:00
|
|
|
int
|
|
|
|
|
PyType_AddWatcher(PyType_WatchCallback callback)
|
|
|
|
|
{
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
|
2024-06-08 05:41:45 -04:00
|
|
|
// start at 1, 0 is reserved for cpython optimizer
|
|
|
|
|
for (int i = 1; i < TYPE_MAX_WATCHERS; i++) {
|
2022-10-21 07:41:51 -06:00
|
|
|
if (!interp->type_watchers[i]) {
|
|
|
|
|
interp->type_watchers[i] = callback;
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError, "no more type watcher IDs available");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
validate_watcher_id(PyInterpreterState *interp, int watcher_id)
|
|
|
|
|
{
|
|
|
|
|
if (watcher_id < 0 || watcher_id >= TYPE_MAX_WATCHERS) {
|
|
|
|
|
PyErr_Format(PyExc_ValueError, "Invalid type watcher ID %d", watcher_id);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!interp->type_watchers[watcher_id]) {
|
|
|
|
|
PyErr_Format(PyExc_ValueError, "No type watcher set for ID %d", watcher_id);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
PyType_ClearWatcher(int watcher_id)
|
|
|
|
|
{
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
if (validate_watcher_id(interp, watcher_id) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
interp->type_watchers[watcher_id] = NULL;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-24 16:30:13 -06:00
|
|
|
static int assign_version_tag(PyInterpreterState *interp, PyTypeObject *type);
|
2022-10-21 07:41:51 -06:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
PyType_Watch(int watcher_id, PyObject* obj)
|
|
|
|
|
{
|
|
|
|
|
if (!PyType_Check(obj)) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError, "Cannot watch non-type");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
PyTypeObject *type = (PyTypeObject *)obj;
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
if (validate_watcher_id(interp, watcher_id) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
// ensure we will get a callback on the next modification
|
2024-06-21 15:50:18 -04:00
|
|
|
BEGIN_TYPE_LOCK();
|
2023-04-24 16:30:13 -06:00
|
|
|
assign_version_tag(interp, type);
|
2022-10-21 07:41:51 -06:00
|
|
|
type->tp_watched |= (1 << watcher_id);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2022-10-21 07:41:51 -06:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
PyType_Unwatch(int watcher_id, PyObject* obj)
|
|
|
|
|
{
|
|
|
|
|
if (!PyType_Check(obj)) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError, "Cannot watch non-type");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
PyTypeObject *type = (PyTypeObject *)obj;
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
if (validate_watcher_id(interp, watcher_id)) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
type->tp_watched &= ~(1 << watcher_id);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-06 10:50:35 -07:00
|
|
|
static void
|
2024-06-19 17:38:45 +01:00
|
|
|
set_version_unlocked(PyTypeObject *tp, unsigned int version)
|
2024-05-06 10:50:35 -07:00
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
2025-01-13 14:10:41 +01:00
|
|
|
assert(version == 0 || (tp->tp_versions_used != _Py_ATTR_CACHE_UNUSED));
|
2024-06-19 17:38:45 +01:00
|
|
|
#ifndef Py_GIL_DISABLED
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
// lookup the old version and set to null
|
|
|
|
|
if (tp->tp_version_tag != 0) {
|
|
|
|
|
PyTypeObject **slot =
|
|
|
|
|
interp->types.type_version_cache
|
|
|
|
|
+ (tp->tp_version_tag % TYPE_VERSION_CACHE_SIZE);
|
|
|
|
|
*slot = NULL;
|
2024-05-06 10:50:35 -07:00
|
|
|
}
|
2024-06-19 17:38:45 +01:00
|
|
|
if (version) {
|
|
|
|
|
tp->tp_versions_used++;
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
if (version) {
|
|
|
|
|
_Py_atomic_add_uint16(&tp->tp_versions_used, 1);
|
2024-05-06 10:50:35 -07:00
|
|
|
}
|
|
|
|
|
#endif
|
2025-02-12 09:34:40 -05:00
|
|
|
FT_ATOMIC_STORE_UINT_RELAXED(tp->tp_version_tag, version);
|
2024-06-19 17:38:45 +01:00
|
|
|
#ifndef Py_GIL_DISABLED
|
|
|
|
|
if (version != 0) {
|
|
|
|
|
PyTypeObject **slot =
|
|
|
|
|
interp->types.type_version_cache
|
|
|
|
|
+ (version % TYPE_VERSION_CACHE_SIZE);
|
|
|
|
|
*slot = tp;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
2024-05-06 10:50:35 -07:00
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
static void
|
|
|
|
|
type_modified_unlocked(PyTypeObject *type)
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Invalidate any cached data for the specified type and all
|
|
|
|
|
subclasses. This function is called after the base
|
|
|
|
|
classes, mro, or attributes of the type are altered.
|
|
|
|
|
|
|
|
|
|
Invariants:
|
|
|
|
|
|
2024-06-19 17:38:45 +01:00
|
|
|
- before tp_version_tag can be set on a type,
|
2010-05-09 15:52:27 +00:00
|
|
|
it must first be set on all super types.
|
|
|
|
|
|
2024-06-19 17:38:45 +01:00
|
|
|
This function clears the tp_version_tag of a
|
2010-05-09 15:52:27 +00:00
|
|
|
type (so it must first clear it on all subclasses). The
|
2024-06-19 17:38:45 +01:00
|
|
|
tp_version_tag value is meaningless when equal to zero.
|
2010-05-09 15:52:27 +00:00
|
|
|
We don't assign new version tags eagerly, but only as
|
|
|
|
|
needed.
|
|
|
|
|
*/
|
2025-04-28 23:38:29 -07:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
2025-02-12 09:34:40 -05:00
|
|
|
if (type->tp_version_tag == 0) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return;
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
2024-07-24 10:22:51 +01:00
|
|
|
// Cannot modify static builtin types.
|
|
|
|
|
assert((type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) == 0);
|
2022-01-22 18:56:11 +01:00
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *subclasses = lookup_tp_subclasses(type);
|
2022-01-22 18:56:11 +01:00
|
|
|
if (subclasses != NULL) {
|
|
|
|
|
assert(PyDict_CheckExact(subclasses));
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
Py_ssize_t i = 0;
|
|
|
|
|
PyObject *ref;
|
|
|
|
|
while (PyDict_Next(subclasses, &i, NULL, &ref)) {
|
2023-06-21 16:35:58 +02:00
|
|
|
PyTypeObject *subclass = type_from_ref(ref);
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
if (subclass == NULL) {
|
2022-01-22 18:56:11 +01:00
|
|
|
continue;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2024-05-06 10:50:35 -07:00
|
|
|
type_modified_unlocked(subclass);
|
2023-06-21 16:35:58 +02:00
|
|
|
Py_DECREF(subclass);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
|
2022-12-14 11:14:16 -08:00
|
|
|
// Notify registered type watchers, if any
|
2022-10-21 07:41:51 -06:00
|
|
|
if (type->tp_watched) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
int bits = type->tp_watched;
|
|
|
|
|
int i = 0;
|
2022-12-14 11:14:16 -08:00
|
|
|
while (bits) {
|
|
|
|
|
assert(i < TYPE_MAX_WATCHERS);
|
2022-10-21 07:41:51 -06:00
|
|
|
if (bits & 1) {
|
|
|
|
|
PyType_WatchCallback cb = interp->type_watchers[i];
|
|
|
|
|
if (cb && (cb(type) < 0)) {
|
2023-11-02 11:16:34 +02:00
|
|
|
PyErr_FormatUnraisable(
|
|
|
|
|
"Exception ignored in type watcher callback #%d for %R",
|
|
|
|
|
i, type);
|
2022-10-21 07:41:51 -06:00
|
|
|
}
|
|
|
|
|
}
|
2022-12-14 11:14:16 -08:00
|
|
|
i++;
|
2022-10-21 07:41:51 -06:00
|
|
|
bits >>= 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-19 17:38:45 +01:00
|
|
|
set_version_unlocked(type, 0); /* 0 is not a valid version tag */
|
2023-03-29 15:53:30 -07:00
|
|
|
if (PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
// This field *must* be invalidated if the type is modified (see the
|
|
|
|
|
// comment on struct _specialization_cache):
|
2025-02-11 16:53:08 -05:00
|
|
|
FT_ATOMIC_STORE_PTR_RELAXED(
|
|
|
|
|
((PyHeapTypeObject *)type)->_spec_cache.getitem, NULL);
|
2023-03-29 15:53:30 -07:00
|
|
|
}
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
void
|
|
|
|
|
PyType_Modified(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
// Quick check without the lock held
|
2025-02-12 09:34:40 -05:00
|
|
|
if (FT_ATOMIC_LOAD_UINT_RELAXED(type->tp_version_tag) == 0) {
|
2024-02-15 10:54:57 -08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-21 15:50:18 -04:00
|
|
|
BEGIN_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
type_modified_unlocked(type);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2024-03-15 12:35:29 -04:00
|
|
|
is_subtype_with_mro(PyObject *a_mro, PyTypeObject *a, PyTypeObject *b);
|
2024-02-15 10:54:57 -08:00
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
// Check if the `mro` method on `type` is overridden, i.e.,
|
|
|
|
|
// `type(tp).mro is not type.mro`.
|
|
|
|
|
static int
|
|
|
|
|
has_custom_mro(PyTypeObject *tp)
|
|
|
|
|
{
|
|
|
|
|
_PyCStackRef c_ref1, c_ref2;
|
|
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
|
|
|
|
_PyThreadState_PushCStackRef(tstate, &c_ref1);
|
|
|
|
|
_PyThreadState_PushCStackRef(tstate, &c_ref2);
|
|
|
|
|
|
|
|
|
|
_PyType_LookupStackRefAndVersion(Py_TYPE(tp), &_Py_ID(mro), &c_ref1.ref);
|
|
|
|
|
_PyType_LookupStackRefAndVersion(&PyType_Type, &_Py_ID(mro), &c_ref2.ref);
|
|
|
|
|
|
|
|
|
|
int custom = !PyStackRef_Is(c_ref1.ref, c_ref2.ref);
|
|
|
|
|
|
|
|
|
|
_PyThreadState_PopCStackRef(tstate, &c_ref2);
|
|
|
|
|
_PyThreadState_PopCStackRef(tstate, &c_ref1);
|
|
|
|
|
return custom;
|
|
|
|
|
}
|
|
|
|
|
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
static void
|
2025-03-26 14:38:47 -04:00
|
|
|
type_mro_modified(PyTypeObject *type, PyObject *bases)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
/*
|
2011-12-12 18:54:29 +01:00
|
|
|
Check that all base classes or elements of the MRO of type are
|
2010-05-09 15:52:27 +00:00
|
|
|
able to be cached. This function is called after the base
|
|
|
|
|
classes or mro of the type are altered.
|
|
|
|
|
|
|
|
|
|
Unset HAVE_VERSION_TAG and VALID_VERSION_TAG if the type
|
2011-12-12 18:54:29 +01:00
|
|
|
has a custom MRO that includes a type which is not officially
|
2019-05-26 16:25:47 +02:00
|
|
|
super type, or if the type implements its own mro() method.
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
Called from mro_internal, which will subsequently be called on
|
|
|
|
|
each subclass when their mro is recursively updated.
|
|
|
|
|
*/
|
|
|
|
|
Py_ssize_t i, n;
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
2025-03-26 14:38:47 -04:00
|
|
|
if (!Py_IS_TYPE(type, &PyType_Type) && has_custom_mro(type)) {
|
|
|
|
|
goto clear;
|
2019-05-26 16:25:47 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
n = PyTuple_GET_SIZE(bases);
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
|
PyObject *b = PyTuple_GET_ITEM(bases, i);
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *cls = _PyType_CAST(b);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2025-01-13 14:10:41 +01:00
|
|
|
if (cls->tp_versions_used >= _Py_ATTR_CACHE_UNUSED) {
|
|
|
|
|
goto clear;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-15 12:35:29 -04:00
|
|
|
if (!is_subtype_with_mro(lookup_tp_mro(type), type, cls)) {
|
2019-05-26 16:25:47 +02:00
|
|
|
goto clear;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
2019-05-26 16:25:47 +02:00
|
|
|
return;
|
2023-04-24 16:30:13 -06:00
|
|
|
|
2019-05-26 16:25:47 +02:00
|
|
|
clear:
|
2023-04-24 16:30:13 -06:00
|
|
|
assert(!(type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN));
|
2025-01-13 14:10:41 +01:00
|
|
|
set_version_unlocked(type, 0); /* 0 is not a valid version tag */
|
|
|
|
|
type->tp_versions_used = _Py_ATTR_CACHE_UNUSED;
|
2023-03-29 15:53:30 -07:00
|
|
|
if (PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
// This field *must* be invalidated if the type is modified (see the
|
|
|
|
|
// comment on struct _specialization_cache):
|
2025-02-11 16:53:08 -05:00
|
|
|
FT_ATOMIC_STORE_PTR_RELAXED(
|
|
|
|
|
((PyHeapTypeObject *)type)->_spec_cache.getitem, NULL);
|
2023-03-29 15:53:30 -07:00
|
|
|
}
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
}
|
|
|
|
|
|
2024-06-08 05:41:45 -04:00
|
|
|
/*
|
|
|
|
|
The Tier 2 interpreter requires looking up the type object by the type version, so it can install
|
|
|
|
|
watchers to understand when they change.
|
|
|
|
|
|
|
|
|
|
So we add a global cache from type version to borrowed references of type objects.
|
|
|
|
|
|
|
|
|
|
This is similar to func_version_cache.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_PyType_SetVersion(PyTypeObject *tp, unsigned int version)
|
|
|
|
|
{
|
2024-06-21 15:50:18 -04:00
|
|
|
BEGIN_TYPE_LOCK();
|
2024-06-19 17:38:45 +01:00
|
|
|
set_version_unlocked(tp, version);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-06-08 05:41:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyTypeObject *
|
|
|
|
|
_PyType_LookupByVersion(unsigned int version)
|
|
|
|
|
{
|
|
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
return NULL;
|
|
|
|
|
#else
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
PyTypeObject **slot =
|
|
|
|
|
interp->types.type_version_cache
|
|
|
|
|
+ (version % TYPE_VERSION_CACHE_SIZE);
|
|
|
|
|
if (*slot && (*slot)->tp_version_tag == version) {
|
|
|
|
|
return *slot;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-28 23:38:29 -07:00
|
|
|
unsigned int
|
|
|
|
|
_PyType_GetVersionForCurrentState(PyTypeObject *tp)
|
|
|
|
|
{
|
|
|
|
|
return tp->tp_version_tag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-05 16:20:54 +00:00
|
|
|
#define MAX_VERSIONS_PER_CLASS 1000
|
2025-01-13 14:10:41 +01:00
|
|
|
#if _Py_ATTR_CACHE_UNUSED < MAX_VERSIONS_PER_CLASS
|
|
|
|
|
#error "_Py_ATTR_CACHE_UNUSED must be bigger than max"
|
|
|
|
|
#endif
|
2024-02-05 16:20:54 +00:00
|
|
|
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
static int
|
2023-04-24 16:30:13 -06:00
|
|
|
assign_version_tag(PyInterpreterState *interp, PyTypeObject *type)
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
{
|
2024-02-15 10:54:57 -08:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
2024-06-19 17:38:45 +01:00
|
|
|
/* Ensure that the tp_version_tag is valid.
|
|
|
|
|
* To respect the invariant, this must first be done on all super classes.
|
|
|
|
|
* Return 0 if this cannot be done, 1 if tp_version_tag is set.
|
2010-05-09 15:52:27 +00:00
|
|
|
*/
|
2024-06-19 17:38:45 +01:00
|
|
|
if (type->tp_version_tag != 0) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return 1;
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
|
|
|
|
if (!_PyType_HasFeature(type, Py_TPFLAGS_READY)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
2024-02-05 16:20:54 +00:00
|
|
|
if (type->tp_versions_used >= MAX_VERSIONS_PER_CLASS) {
|
2025-01-13 14:10:41 +01:00
|
|
|
/* (this includes `tp_versions_used == _Py_ATTR_CACHE_UNUSED`) */
|
2024-02-05 16:20:54 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
2024-06-19 17:38:45 +01:00
|
|
|
|
|
|
|
|
PyObject *bases = lookup_tp_bases(type);
|
|
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(bases);
|
|
|
|
|
for (Py_ssize_t i = 0; i < n; i++) {
|
|
|
|
|
PyObject *b = PyTuple_GET_ITEM(bases, i);
|
|
|
|
|
if (!assign_version_tag(interp, _PyType_CAST(b))) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-24 16:30:13 -06:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) {
|
|
|
|
|
/* static types */
|
|
|
|
|
if (NEXT_GLOBAL_VERSION_TAG > _Py_MAX_GLOBAL_TYPE_VERSION_TAG) {
|
|
|
|
|
/* We have run out of version numbers */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2024-06-19 17:38:45 +01:00
|
|
|
set_version_unlocked(type, NEXT_GLOBAL_VERSION_TAG++);
|
2023-04-24 16:30:13 -06:00
|
|
|
assert (type->tp_version_tag <= _Py_MAX_GLOBAL_TYPE_VERSION_TAG);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* heap types */
|
|
|
|
|
if (NEXT_VERSION_TAG(interp) == 0) {
|
|
|
|
|
/* We have run out of version numbers */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2024-06-19 17:38:45 +01:00
|
|
|
set_version_unlocked(type, NEXT_VERSION_TAG(interp)++);
|
2023-04-24 16:30:13 -06:00
|
|
|
assert (type->tp_version_tag != 0);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
return 1;
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
}
|
|
|
|
|
|
2023-04-24 09:07:47 -07:00
|
|
|
int PyUnstable_Type_AssignVersionTag(PyTypeObject *type)
|
|
|
|
|
{
|
2023-04-24 16:30:13 -06:00
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-02-15 10:54:57 -08:00
|
|
|
int assigned;
|
2024-06-21 15:50:18 -04:00
|
|
|
BEGIN_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
assigned = assign_version_tag(interp, type);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
return assigned;
|
2023-04-24 09:07:47 -07:00
|
|
|
}
|
|
|
|
|
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
|
2001-09-20 20:46:19 +00:00
|
|
|
static PyMemberDef type_members[] = {
|
2023-07-25 15:28:30 +02:00
|
|
|
{"__basicsize__", Py_T_PYSSIZET, offsetof(PyTypeObject,tp_basicsize),Py_READONLY},
|
|
|
|
|
{"__itemsize__", Py_T_PYSSIZET, offsetof(PyTypeObject, tp_itemsize), Py_READONLY},
|
|
|
|
|
{"__flags__", Py_T_ULONG, offsetof(PyTypeObject, tp_flags), Py_READONLY},
|
2022-07-28 19:23:47 -06:00
|
|
|
/* Note that this value is misleading for static builtin types,
|
|
|
|
|
since the memory at this offset will always be NULL. */
|
2023-07-25 15:28:30 +02:00
|
|
|
{"__weakrefoffset__", Py_T_PYSSIZET,
|
|
|
|
|
offsetof(PyTypeObject, tp_weaklistoffset), Py_READONLY},
|
|
|
|
|
{"__base__", _Py_T_OBJECT, offsetof(PyTypeObject, tp_base), Py_READONLY},
|
|
|
|
|
{"__dictoffset__", Py_T_PYSSIZET,
|
|
|
|
|
offsetof(PyTypeObject, tp_dictoffset), Py_READONLY},
|
2010-05-09 15:52:27 +00:00
|
|
|
{0}
|
2001-08-02 04:15:00 +00:00
|
|
|
};
|
|
|
|
|
|
2011-08-17 11:54:03 -05:00
|
|
|
static int
|
|
|
|
|
check_set_special_type_attr(PyTypeObject *type, PyObject *value, const char *name)
|
|
|
|
|
{
|
2021-04-30 15:25:43 +02:00
|
|
|
if (_PyType_HasFeature(type, Py_TPFLAGS_IMMUTABLETYPE)) {
|
2011-08-17 11:54:03 -05:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
2021-04-30 15:25:43 +02:00
|
|
|
"cannot set '%s' attribute of immutable type '%s'",
|
|
|
|
|
name, type->tp_name);
|
2011-08-17 11:54:03 -05:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (!value) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
2021-04-30 15:25:43 +02:00
|
|
|
"cannot delete '%s' attribute of immutable type '%s'",
|
|
|
|
|
name, type->tp_name);
|
2011-08-17 11:54:03 -05:00
|
|
|
return 0;
|
|
|
|
|
}
|
2019-05-23 08:45:22 -07:00
|
|
|
|
|
|
|
|
if (PySys_Audit("object.__setattr__", "OsO",
|
|
|
|
|
type, name, value) < 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-17 11:54:03 -05:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-17 21:11:04 +03:00
|
|
|
const char *
|
|
|
|
|
_PyType_Name(PyTypeObject *type)
|
|
|
|
|
{
|
2020-03-23 01:17:34 +09:00
|
|
|
assert(type->tp_name != NULL);
|
2017-09-17 21:11:04 +03:00
|
|
|
const char *s = strrchr(type->tp_name, '.');
|
|
|
|
|
if (s == NULL) {
|
|
|
|
|
s = type->tp_name;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
s++;
|
|
|
|
|
}
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-16 09:18:56 +00:00
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_name(PyObject *tp, void *Py_UNUSED(closure))
|
2001-08-16 09:18:56 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
|
|
|
|
PyHeapTypeObject* et = (PyHeapTypeObject*)type;
|
2022-11-10 23:40:31 +01:00
|
|
|
return Py_NewRef(et->ht_name);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2017-09-17 21:11:04 +03:00
|
|
|
return PyUnicode_FromString(_PyType_Name(type));
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2001-08-16 09:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-25 18:56:07 +01:00
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_qualname(PyObject *tp, void *Py_UNUSED(closure))
|
2011-11-25 18:56:07 +01:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2011-11-25 18:56:07 +01:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
|
|
|
|
PyHeapTypeObject* et = (PyHeapTypeObject*)type;
|
2022-11-10 23:40:31 +01:00
|
|
|
return Py_NewRef(et->ht_qualname);
|
2011-11-25 18:56:07 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2017-09-17 21:11:04 +03:00
|
|
|
return PyUnicode_FromString(_PyType_Name(type));
|
2011-11-25 18:56:07 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 14:47:27 +00:00
|
|
|
static int
|
2025-02-25 11:44:59 +01:00
|
|
|
type_set_name(PyObject *tp, PyObject *value, void *Py_UNUSED(closure))
|
2002-11-26 14:47:27 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2015-12-30 21:40:49 +02:00
|
|
|
const char *tp_name;
|
|
|
|
|
Py_ssize_t name_size;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2011-08-17 11:54:03 -05:00
|
|
|
if (!check_set_special_type_attr(type, value, "__name__"))
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
|
|
|
|
if (!PyUnicode_Check(value)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"can only assign string to %s.__name__, not '%s'",
|
|
|
|
|
type->tp_name, Py_TYPE(value)->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-30 21:40:49 +02:00
|
|
|
tp_name = PyUnicode_AsUTF8AndSize(value, &name_size);
|
|
|
|
|
if (tp_name == NULL)
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2015-12-30 21:40:49 +02:00
|
|
|
if (strlen(tp_name) != (size_t)name_size) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError,
|
|
|
|
|
"type name must not contain null characters");
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type->tp_name = tp_name;
|
2022-11-10 23:40:31 +01:00
|
|
|
Py_SETREF(((PyHeapTypeObject*)type)->ht_name, Py_NewRef(value));
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
return 0;
|
2002-11-26 14:47:27 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-25 18:56:07 +01:00
|
|
|
static int
|
2025-02-25 11:44:59 +01:00
|
|
|
type_set_qualname(PyObject *tp, PyObject *value, void *context)
|
2011-11-25 18:56:07 +01:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2011-11-25 18:56:07 +01:00
|
|
|
PyHeapTypeObject* et;
|
|
|
|
|
|
2012-10-31 00:01:15 -04:00
|
|
|
if (!check_set_special_type_attr(type, value, "__qualname__"))
|
|
|
|
|
return -1;
|
2011-11-25 18:56:07 +01:00
|
|
|
if (!PyUnicode_Check(value)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"can only assign string to %s.__qualname__, not '%s'",
|
|
|
|
|
type->tp_name, Py_TYPE(value)->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
et = (PyHeapTypeObject*)type;
|
2022-11-10 23:40:31 +01:00
|
|
|
Py_SETREF(et->ht_qualname, Py_NewRef(value));
|
2011-11-25 18:56:07 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
2024-03-14 19:17:43 +01:00
|
|
|
type_module(PyTypeObject *type)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2016-09-10 00:53:02 +03:00
|
|
|
PyObject *mod;
|
2010-05-09 15:52:27 +00:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2023-11-14 11:25:39 +02:00
|
|
|
if (PyDict_GetItemRef(dict, &_Py_ID(__module__), &mod) == 0) {
|
|
|
|
|
PyErr_Format(PyExc_AttributeError, "__module__");
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2016-09-10 00:53:02 +03:00
|
|
|
const char *s = strrchr(type->tp_name, '.');
|
|
|
|
|
if (s != NULL) {
|
|
|
|
|
mod = PyUnicode_FromStringAndSize(
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_name, (Py_ssize_t)(s - type->tp_name));
|
2024-06-21 17:19:31 +02:00
|
|
|
if (mod != NULL) {
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
_PyUnicode_InternMortal(interp, &mod);
|
|
|
|
|
}
|
2016-09-10 00:53:02 +03:00
|
|
|
}
|
|
|
|
|
else {
|
2023-08-04 16:24:50 -07:00
|
|
|
mod = &_Py_ID(builtins);
|
2016-09-10 00:53:02 +03:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2016-09-10 00:53:02 +03:00
|
|
|
return mod;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
1990-10-14 12:07:46 +00:00
|
|
|
|
2025-02-25 11:44:59 +01:00
|
|
|
static inline PyObject *
|
|
|
|
|
type_get_module(PyObject *tp, void *Py_UNUSED(closure))
|
2024-03-14 19:17:43 +01:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2024-03-14 19:17:43 +01:00
|
|
|
return type_module(type);
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-25 16:25:58 +00:00
|
|
|
static int
|
2025-02-25 11:44:59 +01:00
|
|
|
type_set_module(PyObject *tp, PyObject *value, void *Py_UNUSED(closure))
|
2001-09-25 16:25:58 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2011-08-17 11:54:03 -05:00
|
|
|
if (!check_set_special_type_attr(type, value, "__module__"))
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2002-11-26 14:47:27 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
PyType_Modified(type);
|
Merged revisions 59921-59932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line
Speed-up and simplify code urlparse's result objects.
........
r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line
Bug #1790: update link; remove outdated paragraph
........
r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines
Raise an error instead of crashing with a segfault when a NULL
function pointer is called.
Will backport to release25-maint.
........
r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
........
r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line
Update the opcode docs for STORE_MAP and BUILD_MAP
........
r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines
Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
........
r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines
Move OSError docs to exceptions doc, remove obsolete descriptions
from os docs, rework posix docs.
........
r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines
Patch #1700288: Method cache optimization, by Armin Rigo, ported to
2.6 by Kevin Jacobs.
........
r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines
Fix editing glitch.
........
2008-01-12 19:39:10 +00:00
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2024-09-28 20:51:49 +03:00
|
|
|
if (PyDict_Pop(dict, &_Py_ID(__firstlineno__), NULL) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
return PyDict_SetItem(dict, &_Py_ID(__module__), value);
|
2001-09-25 16:25:58 +00:00
|
|
|
}
|
|
|
|
|
|
2024-03-14 17:19:36 +01:00
|
|
|
|
|
|
|
|
PyObject *
|
2024-03-14 23:23:00 +01:00
|
|
|
_PyType_GetFullyQualifiedName(PyTypeObject *type, char sep)
|
2024-03-14 17:19:36 +01:00
|
|
|
{
|
|
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
return PyUnicode_FromString(type->tp_name);
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-25 11:44:59 +01:00
|
|
|
PyObject *qualname = type_qualname((PyObject *)type, NULL);
|
2024-03-14 17:19:36 +01:00
|
|
|
if (qualname == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-14 19:17:43 +01:00
|
|
|
PyObject *module = type_module(type);
|
2024-03-14 17:19:36 +01:00
|
|
|
if (module == NULL) {
|
|
|
|
|
Py_DECREF(qualname);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *result;
|
|
|
|
|
if (PyUnicode_Check(module)
|
|
|
|
|
&& !_PyUnicode_Equal(module, &_Py_ID(builtins))
|
|
|
|
|
&& !_PyUnicode_Equal(module, &_Py_ID(__main__)))
|
|
|
|
|
{
|
2024-03-14 23:23:00 +01:00
|
|
|
result = PyUnicode_FromFormat("%U%c%U", module, sep, qualname);
|
2024-03-14 17:19:36 +01:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
result = Py_NewRef(qualname);
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(module);
|
|
|
|
|
Py_DECREF(qualname);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-14 23:23:00 +01:00
|
|
|
PyObject *
|
|
|
|
|
PyType_GetFullyQualifiedName(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
return _PyType_GetFullyQualifiedName(type, '.');
|
|
|
|
|
}
|
|
|
|
|
|
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61103 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61098 | jeffrey.yasskin | 2008-02-28 05:45:36 +0100 (Thu, 28 Feb 2008) | 7 lines
Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed
./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'
up from 2.5us to 0.201us. This fixes issue 1762.
........
r61099 | jeffrey.yasskin | 2008-02-28 06:53:18 +0100 (Thu, 28 Feb 2008) | 3 lines
Speed test_socketserver up from 28.739s to 0.226s, simplify the logic, and make
sure all tests run even if some fail.
........
r61100 | jeffrey.yasskin | 2008-02-28 07:09:19 +0100 (Thu, 28 Feb 2008) | 21 lines
Thread.start() used sleep(0.000001) to make sure it didn't return before the
new thread had started. At least on my MacBook Pro, that wound up sleeping for
a full 10ms (probably 1 jiffy). By using an Event instead, we can be absolutely
certain that the thread has started, and return more quickly (217us).
Before:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
100 loops, best of 3: 10.3 msec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.47 usec per loop
After:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
1000 loops, best of 3: 217 usec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.86 usec per loop
To be fair, the 10ms isn't CPU time, and other threads including the spawned
one get to run during it. There are also some slightly more complicated ways to
get back the .4us in isAlive() if we want.
........
r61101 | raymond.hettinger | 2008-02-28 10:23:48 +0100 (Thu, 28 Feb 2008) | 1 line
Add repeat keyword argument to itertools.product().
........
r61102 | christian.heimes | 2008-02-28 12:18:49 +0100 (Thu, 28 Feb 2008) | 1 line
The empty tuple is usually a singleton with a much higher refcnt than 1
........
2008-02-28 12:27:11 +00:00
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_abstractmethods(PyObject *tp, void *Py_UNUSED(closure))
|
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61103 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61098 | jeffrey.yasskin | 2008-02-28 05:45:36 +0100 (Thu, 28 Feb 2008) | 7 lines
Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed
./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'
up from 2.5us to 0.201us. This fixes issue 1762.
........
r61099 | jeffrey.yasskin | 2008-02-28 06:53:18 +0100 (Thu, 28 Feb 2008) | 3 lines
Speed test_socketserver up from 28.739s to 0.226s, simplify the logic, and make
sure all tests run even if some fail.
........
r61100 | jeffrey.yasskin | 2008-02-28 07:09:19 +0100 (Thu, 28 Feb 2008) | 21 lines
Thread.start() used sleep(0.000001) to make sure it didn't return before the
new thread had started. At least on my MacBook Pro, that wound up sleeping for
a full 10ms (probably 1 jiffy). By using an Event instead, we can be absolutely
certain that the thread has started, and return more quickly (217us).
Before:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
100 loops, best of 3: 10.3 msec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.47 usec per loop
After:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
1000 loops, best of 3: 217 usec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.86 usec per loop
To be fair, the 10ms isn't CPU time, and other threads including the spawned
one get to run during it. There are also some slightly more complicated ways to
get back the .4us in isAlive() if we want.
........
r61101 | raymond.hettinger | 2008-02-28 10:23:48 +0100 (Thu, 28 Feb 2008) | 1 line
Add repeat keyword argument to itertools.product().
........
r61102 | christian.heimes | 2008-02-28 12:18:49 +0100 (Thu, 28 Feb 2008) | 1 line
The empty tuple is usually a singleton with a much higher refcnt than 1
........
2008-02-28 12:27:11 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
|
|
|
|
PyObject *res = NULL;
|
2010-10-03 02:13:39 +00:00
|
|
|
/* type itself has an __abstractmethods__ descriptor (this). Don't return
|
|
|
|
|
that. */
|
2023-11-14 11:25:39 +02:00
|
|
|
if (type == &PyType_Type) {
|
|
|
|
|
PyErr_SetObject(PyExc_AttributeError, &_Py_ID(__abstractmethods__));
|
2023-05-01 20:34:43 -06:00
|
|
|
}
|
2023-11-14 11:25:39 +02:00
|
|
|
else {
|
|
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2025-02-25 11:44:59 +01:00
|
|
|
if (PyDict_GetItemRef(dict, &_Py_ID(__abstractmethods__), &res) == 0) {
|
2022-02-08 13:39:07 -07:00
|
|
|
PyErr_SetObject(PyExc_AttributeError, &_Py_ID(__abstractmethods__));
|
2019-02-25 17:59:46 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2025-02-25 11:44:59 +01:00
|
|
|
return res;
|
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61103 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61098 | jeffrey.yasskin | 2008-02-28 05:45:36 +0100 (Thu, 28 Feb 2008) | 7 lines
Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed
./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'
up from 2.5us to 0.201us. This fixes issue 1762.
........
r61099 | jeffrey.yasskin | 2008-02-28 06:53:18 +0100 (Thu, 28 Feb 2008) | 3 lines
Speed test_socketserver up from 28.739s to 0.226s, simplify the logic, and make
sure all tests run even if some fail.
........
r61100 | jeffrey.yasskin | 2008-02-28 07:09:19 +0100 (Thu, 28 Feb 2008) | 21 lines
Thread.start() used sleep(0.000001) to make sure it didn't return before the
new thread had started. At least on my MacBook Pro, that wound up sleeping for
a full 10ms (probably 1 jiffy). By using an Event instead, we can be absolutely
certain that the thread has started, and return more quickly (217us).
Before:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
100 loops, best of 3: 10.3 msec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.47 usec per loop
After:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
1000 loops, best of 3: 217 usec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.86 usec per loop
To be fair, the 10ms isn't CPU time, and other threads including the spawned
one get to run during it. There are also some slightly more complicated ways to
get back the .4us in isAlive() if we want.
........
r61101 | raymond.hettinger | 2008-02-28 10:23:48 +0100 (Thu, 28 Feb 2008) | 1 line
Add repeat keyword argument to itertools.product().
........
r61102 | christian.heimes | 2008-02-28 12:18:49 +0100 (Thu, 28 Feb 2008) | 1 line
The empty tuple is usually a singleton with a much higher refcnt than 1
........
2008-02-28 12:27:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2025-02-25 11:44:59 +01:00
|
|
|
type_set_abstractmethods(PyObject *tp, PyObject *value, void *Py_UNUSED(closure))
|
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61103 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61098 | jeffrey.yasskin | 2008-02-28 05:45:36 +0100 (Thu, 28 Feb 2008) | 7 lines
Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed
./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'
up from 2.5us to 0.201us. This fixes issue 1762.
........
r61099 | jeffrey.yasskin | 2008-02-28 06:53:18 +0100 (Thu, 28 Feb 2008) | 3 lines
Speed test_socketserver up from 28.739s to 0.226s, simplify the logic, and make
sure all tests run even if some fail.
........
r61100 | jeffrey.yasskin | 2008-02-28 07:09:19 +0100 (Thu, 28 Feb 2008) | 21 lines
Thread.start() used sleep(0.000001) to make sure it didn't return before the
new thread had started. At least on my MacBook Pro, that wound up sleeping for
a full 10ms (probably 1 jiffy). By using an Event instead, we can be absolutely
certain that the thread has started, and return more quickly (217us).
Before:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
100 loops, best of 3: 10.3 msec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.47 usec per loop
After:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
1000 loops, best of 3: 217 usec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.86 usec per loop
To be fair, the 10ms isn't CPU time, and other threads including the spawned
one get to run during it. There are also some slightly more complicated ways to
get back the .4us in isAlive() if we want.
........
r61101 | raymond.hettinger | 2008-02-28 10:23:48 +0100 (Thu, 28 Feb 2008) | 1 line
Add repeat keyword argument to itertools.product().
........
r61102 | christian.heimes | 2008-02-28 12:18:49 +0100 (Thu, 28 Feb 2008) | 1 line
The empty tuple is usually a singleton with a much higher refcnt than 1
........
2008-02-28 12:27:11 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2010-05-09 15:52:27 +00:00
|
|
|
/* __abstractmethods__ should only be set once on a type, in
|
|
|
|
|
abc.ABCMeta.__new__, so this function doesn't do anything
|
|
|
|
|
special to update subclasses.
|
|
|
|
|
*/
|
2012-08-15 23:18:25 +02:00
|
|
|
int abstract, res;
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2011-01-12 15:34:01 +00:00
|
|
|
if (value != NULL) {
|
2012-08-15 23:18:25 +02:00
|
|
|
abstract = PyObject_IsTrue(value);
|
|
|
|
|
if (abstract < 0)
|
|
|
|
|
return -1;
|
2023-05-01 20:34:43 -06:00
|
|
|
res = PyDict_SetItem(dict, &_Py_ID(__abstractmethods__), value);
|
2011-01-12 15:34:01 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-08-15 23:18:25 +02:00
|
|
|
abstract = 0;
|
2024-03-07 11:21:08 +02:00
|
|
|
res = PyDict_Pop(dict, &_Py_ID(__abstractmethods__), NULL);
|
|
|
|
|
if (res == 0) {
|
2022-02-08 13:39:07 -07:00
|
|
|
PyErr_SetObject(PyExc_AttributeError, &_Py_ID(__abstractmethods__));
|
2011-01-12 15:34:01 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-07 11:21:08 +02:00
|
|
|
if (res < 0) {
|
|
|
|
|
return -1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2024-03-07 11:21:08 +02:00
|
|
|
|
2025-02-25 21:24:20 -08:00
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
type_modified_unlocked(type);
|
2024-03-07 11:21:08 +02:00
|
|
|
if (abstract)
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_IS_ABSTRACT);
|
2024-03-07 11:21:08 +02:00
|
|
|
else
|
2025-02-25 21:24:20 -08:00
|
|
|
type_clear_flags(type, Py_TPFLAGS_IS_ABSTRACT);
|
|
|
|
|
END_TYPE_LOCK();
|
|
|
|
|
|
2024-03-07 11:21:08 +02:00
|
|
|
return 0;
|
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61103 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61098 | jeffrey.yasskin | 2008-02-28 05:45:36 +0100 (Thu, 28 Feb 2008) | 7 lines
Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed
./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'
up from 2.5us to 0.201us. This fixes issue 1762.
........
r61099 | jeffrey.yasskin | 2008-02-28 06:53:18 +0100 (Thu, 28 Feb 2008) | 3 lines
Speed test_socketserver up from 28.739s to 0.226s, simplify the logic, and make
sure all tests run even if some fail.
........
r61100 | jeffrey.yasskin | 2008-02-28 07:09:19 +0100 (Thu, 28 Feb 2008) | 21 lines
Thread.start() used sleep(0.000001) to make sure it didn't return before the
new thread had started. At least on my MacBook Pro, that wound up sleeping for
a full 10ms (probably 1 jiffy). By using an Event instead, we can be absolutely
certain that the thread has started, and return more quickly (217us).
Before:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
100 loops, best of 3: 10.3 msec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.47 usec per loop
After:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
1000 loops, best of 3: 217 usec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.86 usec per loop
To be fair, the 10ms isn't CPU time, and other threads including the spawned
one get to run during it. There are also some slightly more complicated ways to
get back the .4us in isAlive() if we want.
........
r61101 | raymond.hettinger | 2008-02-28 10:23:48 +0100 (Thu, 28 Feb 2008) | 1 line
Add repeat keyword argument to itertools.product().
........
r61102 | christian.heimes | 2008-02-28 12:18:49 +0100 (Thu, 28 Feb 2008) | 1 line
The empty tuple is usually a singleton with a much higher refcnt than 1
........
2008-02-28 12:27:11 +00:00
|
|
|
}
|
|
|
|
|
|
2002-11-26 14:47:27 +00:00
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_get_bases(PyObject *tp, void *Py_UNUSED(closure))
|
2002-11-26 14:47:27 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2024-02-15 10:54:57 -08:00
|
|
|
PyObject *bases = _PyType_GetBases(type);
|
2023-05-02 21:30:03 -06:00
|
|
|
if (bases == NULL) {
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
2024-02-15 10:54:57 -08:00
|
|
|
return bases;
|
2023-05-02 21:30:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_get_mro(PyObject *tp, void *Py_UNUSED(closure))
|
2023-05-02 21:30:03 -06:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2024-02-15 10:54:57 -08:00
|
|
|
PyObject *mro;
|
|
|
|
|
|
2024-06-21 15:50:18 -04:00
|
|
|
BEGIN_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
mro = lookup_tp_mro(type);
|
2023-05-02 21:30:03 -06:00
|
|
|
if (mro == NULL) {
|
2024-02-15 10:54:57 -08:00
|
|
|
mro = Py_None;
|
|
|
|
|
} else {
|
|
|
|
|
Py_INCREF(mro);
|
2023-05-02 21:30:03 -06:00
|
|
|
}
|
2024-02-15 10:54:57 -08:00
|
|
|
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
return mro;
|
2002-11-26 14:47:27 +00:00
|
|
|
}
|
|
|
|
|
|
2025-04-28 23:38:29 -07:00
|
|
|
static PyTypeObject *best_base(PyObject *);
|
|
|
|
|
static int mro_internal(PyTypeObject *, PyObject **);
|
2016-09-09 12:42:51 -07:00
|
|
|
static int type_is_subtype_base_chain(PyTypeObject *, PyTypeObject *);
|
2015-12-25 20:01:53 +02:00
|
|
|
static int compatible_for_assignment(PyTypeObject *, PyTypeObject *, const char *);
|
2002-11-26 14:47:27 +00:00
|
|
|
static int add_subclass(PyTypeObject*, PyTypeObject*);
|
2015-02-05 22:29:14 -05:00
|
|
|
static int add_all_subclasses(PyTypeObject *type, PyObject *bases);
|
2002-11-26 14:47:27 +00:00
|
|
|
static void remove_subclass(PyTypeObject *, PyTypeObject *);
|
2013-10-29 21:31:25 +01:00
|
|
|
static void remove_all_subclasses(PyTypeObject *type, PyObject *bases);
|
2002-11-26 14:47:27 +00:00
|
|
|
static void update_all_slots(PyTypeObject *);
|
|
|
|
|
|
2003-03-24 23:49:49 +00:00
|
|
|
typedef int (*update_callback)(PyTypeObject *, void *);
|
2022-01-22 18:56:11 +01:00
|
|
|
static int update_subclasses(PyTypeObject *type, PyObject *attr_name,
|
2010-05-09 15:52:27 +00:00
|
|
|
update_callback callback, void *data);
|
2003-03-24 23:49:49 +00:00
|
|
|
static int recurse_down_subclasses(PyTypeObject *type, PyObject *name,
|
2010-05-09 15:52:27 +00:00
|
|
|
update_callback callback, void *data);
|
2003-03-24 23:49:49 +00:00
|
|
|
|
2002-11-26 14:47:27 +00:00
|
|
|
static int
|
2015-02-05 22:29:14 -05:00
|
|
|
mro_hierarchy(PyTypeObject *type, PyObject *temp)
|
2002-11-26 14:47:27 +00:00
|
|
|
{
|
2024-02-15 10:54:57 -08:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
2022-01-21 23:29:10 +01:00
|
|
|
PyObject *old_mro;
|
2025-04-28 23:38:29 -07:00
|
|
|
int res = mro_internal(type, &old_mro);
|
2022-01-21 23:29:10 +01:00
|
|
|
if (res <= 0) {
|
2015-02-05 22:29:14 -05:00
|
|
|
/* error / reentrance */
|
|
|
|
|
return res;
|
2022-01-21 23:29:10 +01:00
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *new_mro = lookup_tp_mro(type);
|
2013-10-29 21:31:25 +01:00
|
|
|
|
2022-01-21 23:29:10 +01:00
|
|
|
PyObject *tuple;
|
|
|
|
|
if (old_mro != NULL) {
|
2015-02-05 22:29:14 -05:00
|
|
|
tuple = PyTuple_Pack(3, type, new_mro, old_mro);
|
2022-01-21 23:29:10 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2015-02-05 22:29:14 -05:00
|
|
|
tuple = PyTuple_Pack(2, type, new_mro);
|
2022-01-21 23:29:10 +01:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
|
2022-01-21 23:29:10 +01:00
|
|
|
if (tuple != NULL) {
|
2015-02-05 22:29:14 -05:00
|
|
|
res = PyList_Append(temp, tuple);
|
2022-01-21 23:29:10 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2015-02-05 22:29:14 -05:00
|
|
|
res = -1;
|
2022-01-21 23:29:10 +01:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_XDECREF(tuple);
|
|
|
|
|
|
|
|
|
|
if (res < 0) {
|
2024-06-03 19:09:18 -04:00
|
|
|
set_tp_mro(type, old_mro, 0);
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_DECREF(new_mro);
|
|
|
|
|
return -1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_XDECREF(old_mro);
|
|
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
// Avoid creating an empty list if there is no subclass
|
2022-08-04 19:26:59 -06:00
|
|
|
if (_PyType_HasSubclasses(type)) {
|
2022-01-22 18:56:11 +01:00
|
|
|
/* Obtain a copy of subclasses list to iterate over.
|
2015-02-05 22:29:14 -05:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
Otherwise type->tp_subclasses might be altered
|
|
|
|
|
in the middle of the loop, for example, through a custom mro(),
|
|
|
|
|
by invoking type_set_bases on some subclass of the type
|
|
|
|
|
which in turn calls remove_subclass/add_subclass on this type.
|
2015-02-05 22:29:14 -05:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
Finally, this makes things simple avoiding the need to deal
|
|
|
|
|
with dictionary iterators and weak references.
|
|
|
|
|
*/
|
|
|
|
|
PyObject *subclasses = _PyType_GetSubclasses(type);
|
|
|
|
|
if (subclasses == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2022-01-21 23:29:10 +01:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
Py_ssize_t n = PyList_GET_SIZE(subclasses);
|
|
|
|
|
for (Py_ssize_t i = 0; i < n; i++) {
|
|
|
|
|
PyTypeObject *subclass = _PyType_CAST(PyList_GET_ITEM(subclasses, i));
|
|
|
|
|
res = mro_hierarchy(subclass, temp);
|
|
|
|
|
if (res < 0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-01-21 23:29:10 +01:00
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
Py_DECREF(subclasses);
|
2015-02-05 22:29:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
2002-11-26 14:47:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2025-04-28 23:38:29 -07:00
|
|
|
type_set_bases_unlocked(PyTypeObject *type, PyObject *new_bases)
|
2002-11-26 14:47:27 +00:00
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
// Check arguments
|
2022-01-22 18:56:11 +01:00
|
|
|
if (!check_set_special_type_attr(type, new_bases, "__bases__")) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
|
|
|
|
assert(new_bases != NULL);
|
|
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
if (!PyTuple_Check(new_bases)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"can only assign tuple to %s.__bases__, not %s",
|
2015-02-05 22:29:14 -05:00
|
|
|
type->tp_name, Py_TYPE(new_bases)->tp_name);
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
if (PyTuple_GET_SIZE(new_bases) == 0) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"can only assign non-empty tuple to %s.__bases__, not ()",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(new_bases);
|
|
|
|
|
for (Py_ssize_t i = 0; i < n; i++) {
|
2022-01-21 21:39:01 +01:00
|
|
|
PyObject *ob = PyTuple_GET_ITEM(new_bases, i);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!PyType_Check(ob)) {
|
2012-04-01 18:49:54 -04:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
2012-04-01 18:51:37 -04:00
|
|
|
"%s.__bases__ must be tuple of classes, not '%s'",
|
2012-04-01 18:49:54 -04:00
|
|
|
type->tp_name, Py_TYPE(ob)->tp_name);
|
|
|
|
|
return -1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *base = (PyTypeObject*)ob;
|
2015-02-05 22:29:14 -05:00
|
|
|
|
2024-03-15 12:35:29 -04:00
|
|
|
if (is_subtype_with_mro(lookup_tp_mro(base), base, type) ||
|
2015-02-05 22:29:14 -05:00
|
|
|
/* In case of reentering here again through a custom mro()
|
|
|
|
|
the above check is not enough since it relies on
|
|
|
|
|
base->tp_mro which would gonna be updated inside
|
|
|
|
|
mro_internal only upon returning from the mro().
|
|
|
|
|
|
|
|
|
|
However, base->tp_base has already been assigned (see
|
|
|
|
|
below), which in turn may cause an inheritance cycle
|
|
|
|
|
through tp_base chain. And this is definitely
|
|
|
|
|
not what you want to ever happen. */
|
2023-05-01 20:34:43 -06:00
|
|
|
(lookup_tp_mro(base) != NULL
|
|
|
|
|
&& type_is_subtype_base_chain(base, type)))
|
2022-01-22 18:56:11 +01:00
|
|
|
{
|
2012-04-01 18:48:40 -04:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"a __bases__ item causes an inheritance cycle");
|
|
|
|
|
return -1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
// Compute the new MRO and the new base class
|
2025-04-28 23:38:29 -07:00
|
|
|
PyTypeObject *new_base = best_base(new_bases);
|
|
|
|
|
if (new_base == NULL)
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
|
|
|
|
|
2025-04-28 23:38:29 -07:00
|
|
|
if (!compatible_for_assignment(type->tp_base, new_base, "__bases__")) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *old_bases = lookup_tp_bases(type);
|
2022-01-22 18:56:11 +01:00
|
|
|
assert(old_bases != NULL);
|
|
|
|
|
PyTypeObject *old_base = type->tp_base;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
set_tp_bases(type, Py_NewRef(new_bases), 0);
|
2025-04-28 23:38:29 -07:00
|
|
|
type->tp_base = (PyTypeObject *)Py_NewRef(new_base);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
PyObject *temp = PyList_New(0);
|
|
|
|
|
if (temp == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
goto bail;
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
|
|
|
|
if (mro_hierarchy(type, temp) < 0) {
|
2015-02-05 22:29:14 -05:00
|
|
|
goto undo;
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(temp);
|
|
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
/* Take no action in case if type->tp_bases has been replaced
|
|
|
|
|
through reentrance. */
|
2022-01-22 18:56:11 +01:00
|
|
|
int res;
|
2023-05-01 20:34:43 -06:00
|
|
|
if (lookup_tp_bases(type) == new_bases) {
|
2015-02-05 22:29:14 -05:00
|
|
|
/* any base that was in __bases__ but now isn't, we
|
|
|
|
|
need to remove |type| from its tp_subclasses.
|
|
|
|
|
conversely, any class now in __bases__ that wasn't
|
|
|
|
|
needs to have |type| added to its subclasses. */
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
/* for now, sod that: just remove from all old_bases,
|
|
|
|
|
add to all new_bases */
|
|
|
|
|
remove_all_subclasses(type, old_bases);
|
|
|
|
|
res = add_all_subclasses(type, new_bases);
|
|
|
|
|
update_all_slots(type);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
else {
|
|
|
|
|
res = 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2024-01-25 06:10:51 -05:00
|
|
|
RARE_EVENT_INC(set_bases);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(old_bases);
|
|
|
|
|
Py_DECREF(old_base);
|
|
|
|
|
|
2017-01-25 23:33:27 +01:00
|
|
|
assert(_PyType_CheckConsistency(type));
|
2015-02-05 22:29:14 -05:00
|
|
|
return res;
|
2002-11-27 15:40:09 +00:00
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
undo:
|
2022-01-22 18:56:11 +01:00
|
|
|
n = PyList_GET_SIZE(temp);
|
|
|
|
|
for (Py_ssize_t i = n - 1; i >= 0; i--) {
|
2015-02-05 22:29:14 -05:00
|
|
|
PyTypeObject *cls;
|
|
|
|
|
PyObject *new_mro, *old_mro = NULL;
|
|
|
|
|
|
|
|
|
|
PyArg_UnpackTuple(PyList_GET_ITEM(temp, i),
|
|
|
|
|
"", 2, 3, &cls, &new_mro, &old_mro);
|
|
|
|
|
/* Do not rollback if cls has a newer version of MRO. */
|
2023-05-01 20:34:43 -06:00
|
|
|
if (lookup_tp_mro(cls) == new_mro) {
|
2024-06-03 19:09:18 -04:00
|
|
|
set_tp_mro(cls, Py_XNewRef(old_mro), 0);
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_DECREF(new_mro);
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_DECREF(temp);
|
|
|
|
|
|
|
|
|
|
bail:
|
2023-05-01 20:34:43 -06:00
|
|
|
if (lookup_tp_bases(type) == new_bases) {
|
2025-04-28 23:38:29 -07:00
|
|
|
assert(type->tp_base == new_base);
|
2015-02-05 22:29:14 -05:00
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
set_tp_bases(type, old_bases, 0);
|
2015-02-05 22:29:14 -05:00
|
|
|
type->tp_base = old_base;
|
2003-08-07 14:58:10 +00:00
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_DECREF(new_bases);
|
2025-04-28 23:38:29 -07:00
|
|
|
Py_DECREF(new_base);
|
2015-02-05 22:29:14 -05:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Py_DECREF(old_bases);
|
|
|
|
|
Py_DECREF(old_base);
|
|
|
|
|
}
|
2002-12-07 21:39:16 +00:00
|
|
|
|
2017-01-25 23:33:27 +01:00
|
|
|
assert(_PyType_CheckConsistency(type));
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2002-11-26 14:47:27 +00:00
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
static int
|
2025-02-25 11:44:59 +01:00
|
|
|
type_set_bases(PyObject *tp, PyObject *new_bases, void *Py_UNUSED(closure))
|
2024-02-15 10:54:57 -08:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2024-02-15 10:54:57 -08:00
|
|
|
int res;
|
|
|
|
|
BEGIN_TYPE_LOCK();
|
2025-04-28 23:38:29 -07:00
|
|
|
res = type_set_bases_unlocked(type, new_bases);
|
2024-02-15 10:54:57 -08:00
|
|
|
END_TYPE_LOCK();
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
1997-05-02 03:12:38 +00:00
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_dict(PyObject *tp, void *Py_UNUSED(closure))
|
1995-01-07 11:58:15 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
|
|
|
|
if (dict == NULL) {
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
return PyDictProxy_New(dict);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2002-03-17 18:56:20 +00:00
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_get_doc(PyObject *tp, void *Py_UNUSED(closure))
|
2002-03-17 18:56:20 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *result;
|
2014-01-24 06:17:25 -08:00
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) {
|
2014-02-08 22:15:29 -08:00
|
|
|
return _PyType_GetDocFromInternalDoc(type->tp_name, type->tp_doc);
|
2014-01-24 06:17:25 -08:00
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2023-11-14 11:25:39 +02:00
|
|
|
if (PyDict_GetItemRef(dict, &_Py_ID(__doc__), &result) == 0) {
|
|
|
|
|
result = Py_NewRef(Py_None);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2023-11-14 11:25:39 +02:00
|
|
|
else if (result) {
|
|
|
|
|
descrgetfunc descr_get = Py_TYPE(result)->tp_descr_get;
|
|
|
|
|
if (descr_get) {
|
|
|
|
|
Py_SETREF(result, descr_get(result, NULL, (PyObject *)type));
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
return result;
|
2002-03-17 18:56:20 +00:00
|
|
|
}
|
|
|
|
|
|
2014-01-24 06:17:25 -08:00
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_get_text_signature(PyObject *tp, void *Py_UNUSED(closure))
|
2014-01-24 06:17:25 -08:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2023-08-11 18:08:38 +03:00
|
|
|
return _PyType_GetTextSignatureFromInternalDoc(type->tp_name, type->tp_doc, 0);
|
2014-01-24 06:17:25 -08:00
|
|
|
}
|
|
|
|
|
|
2011-08-17 12:03:47 -05:00
|
|
|
static int
|
2025-02-25 11:44:59 +01:00
|
|
|
type_set_doc(PyObject *tp, PyObject *value, void *Py_UNUSED(closure))
|
2011-08-17 12:03:47 -05:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2011-08-17 12:03:47 -05:00
|
|
|
if (!check_set_special_type_attr(type, value, "__doc__"))
|
|
|
|
|
return -1;
|
|
|
|
|
PyType_Modified(type);
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
|
|
|
|
return PyDict_SetItem(dict, &_Py_ID(__doc__), value);
|
2011-08-17 12:03:47 -05:00
|
|
|
}
|
|
|
|
|
|
2024-05-21 22:38:12 -04:00
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_get_annotate(PyObject *tp, void *Py_UNUSED(closure))
|
2024-05-21 22:38:12 -04:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2024-05-21 22:38:12 -04:00
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
PyErr_Format(PyExc_AttributeError, "type object '%s' has no attribute '__annotate__'", type->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *annotate;
|
|
|
|
|
PyObject *dict = PyType_GetDict(type);
|
2025-04-10 21:13:26 -07:00
|
|
|
// First try __annotate__, in case that's been set explicitly
|
2024-05-21 22:38:12 -04:00
|
|
|
if (PyDict_GetItemRef(dict, &_Py_ID(__annotate__), &annotate) < 0) {
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2025-04-10 21:13:26 -07:00
|
|
|
if (!annotate) {
|
|
|
|
|
if (PyDict_GetItemRef(dict, &_Py_ID(__annotate_func__), &annotate) < 0) {
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-21 22:38:12 -04:00
|
|
|
if (annotate) {
|
|
|
|
|
descrgetfunc get = Py_TYPE(annotate)->tp_descr_get;
|
|
|
|
|
if (get) {
|
|
|
|
|
Py_SETREF(annotate, get(annotate, NULL, (PyObject *)type));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
annotate = Py_None;
|
2025-04-10 21:13:26 -07:00
|
|
|
int result = PyDict_SetItem(dict, &_Py_ID(__annotate_func__), annotate);
|
2024-05-21 22:38:12 -04:00
|
|
|
if (result < 0) {
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
return annotate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2025-02-25 11:44:59 +01:00
|
|
|
type_set_annotate(PyObject *tp, PyObject *value, void *Py_UNUSED(closure))
|
2024-05-21 22:38:12 -04:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2024-05-21 22:38:12 -04:00
|
|
|
if (value == NULL) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "cannot delete __annotate__ attribute");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (_PyType_HasFeature(type, Py_TPFLAGS_IMMUTABLETYPE)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"cannot set '__annotate__' attribute of immutable type '%s'",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Py_IsNone(value) && !PyCallable_Check(value)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "__annotate__ must be callable or None");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *dict = PyType_GetDict(type);
|
|
|
|
|
assert(PyDict_Check(dict));
|
2025-04-10 21:13:26 -07:00
|
|
|
int result = PyDict_SetItem(dict, &_Py_ID(__annotate_func__), value);
|
2024-05-21 22:38:12 -04:00
|
|
|
if (result < 0) {
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!Py_IsNone(value)) {
|
2025-04-10 21:13:26 -07:00
|
|
|
if (PyDict_Pop(dict, &_Py_ID(__annotations_cache__), NULL) == -1) {
|
2024-05-21 22:38:12 -04:00
|
|
|
Py_DECREF(dict);
|
|
|
|
|
PyType_Modified(type);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
PyType_Modified(type);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 20:09:08 -07:00
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_get_annotations(PyObject *tp, void *Py_UNUSED(closure))
|
2021-04-29 20:09:08 -07:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2021-04-29 20:09:08 -07:00
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
PyErr_Format(PyExc_AttributeError, "type object '%s' has no attribute '__annotations__'", type->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *annotations;
|
2024-05-21 22:38:12 -04:00
|
|
|
PyObject *dict = PyType_GetDict(type);
|
2025-04-10 21:13:26 -07:00
|
|
|
// First try __annotations__ (e.g. for "from __future__ import annotations")
|
2023-11-14 11:25:39 +02:00
|
|
|
if (PyDict_GetItemRef(dict, &_Py_ID(__annotations__), &annotations) < 0) {
|
2024-05-21 22:38:12 -04:00
|
|
|
Py_DECREF(dict);
|
2023-11-14 11:25:39 +02:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2025-04-10 21:13:26 -07:00
|
|
|
if (!annotations) {
|
|
|
|
|
if (PyDict_GetItemRef(dict, &_Py_ID(__annotations_cache__), &annotations) < 0) {
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-18 08:56:58 +03:00
|
|
|
if (annotations) {
|
2023-11-14 11:25:39 +02:00
|
|
|
descrgetfunc get = Py_TYPE(annotations)->tp_descr_get;
|
|
|
|
|
if (get) {
|
2025-02-25 11:44:59 +01:00
|
|
|
Py_SETREF(annotations, get(annotations, NULL, tp));
|
2021-04-29 20:09:08 -07:00
|
|
|
}
|
2023-07-18 08:56:58 +03:00
|
|
|
}
|
2023-11-14 11:25:39 +02:00
|
|
|
else {
|
2025-04-10 21:13:26 -07:00
|
|
|
PyObject *annotate = PyObject_GetAttrString((PyObject *)type, "__annotate__");
|
2024-05-21 22:38:12 -04:00
|
|
|
if (annotate == NULL) {
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (PyCallable_Check(annotate)) {
|
|
|
|
|
PyObject *one = _PyLong_GetOne();
|
|
|
|
|
annotations = _PyObject_CallOneArg(annotate, one);
|
|
|
|
|
if (annotations == NULL) {
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
Py_DECREF(annotate);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (!PyDict_Check(annotations)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError, "__annotate__ returned non-dict of type '%.100s'",
|
|
|
|
|
Py_TYPE(annotations)->tp_name);
|
|
|
|
|
Py_DECREF(annotations);
|
|
|
|
|
Py_DECREF(annotate);
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
annotations = PyDict_New();
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(annotate);
|
2021-04-29 20:09:08 -07:00
|
|
|
if (annotations) {
|
2022-02-08 13:39:07 -07:00
|
|
|
int result = PyDict_SetItem(
|
2025-04-10 21:13:26 -07:00
|
|
|
dict, &_Py_ID(__annotations_cache__), annotations);
|
2021-04-29 20:09:08 -07:00
|
|
|
if (result) {
|
|
|
|
|
Py_CLEAR(annotations);
|
|
|
|
|
} else {
|
|
|
|
|
PyType_Modified(type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-21 22:38:12 -04:00
|
|
|
Py_DECREF(dict);
|
2021-04-29 20:09:08 -07:00
|
|
|
return annotations;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2025-02-25 11:44:59 +01:00
|
|
|
type_set_annotations(PyObject *tp, PyObject *value, void *Py_UNUSED(closure))
|
2021-04-29 20:09:08 -07:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2021-04-30 15:25:43 +02:00
|
|
|
if (_PyType_HasFeature(type, Py_TPFLAGS_IMMUTABLETYPE)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"cannot set '__annotations__' attribute of immutable type '%s'",
|
|
|
|
|
type->tp_name);
|
2021-04-29 20:09:08 -07:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int result;
|
2024-05-21 22:38:12 -04:00
|
|
|
PyObject *dict = PyType_GetDict(type);
|
2021-04-29 20:09:08 -07:00
|
|
|
if (value != NULL) {
|
|
|
|
|
/* set */
|
2025-04-10 21:13:26 -07:00
|
|
|
result = PyDict_SetItem(dict, &_Py_ID(__annotations_cache__), value);
|
2021-04-29 20:09:08 -07:00
|
|
|
} else {
|
|
|
|
|
/* delete */
|
2025-04-10 21:13:26 -07:00
|
|
|
result = PyDict_Pop(dict, &_Py_ID(__annotations_cache__), NULL);
|
2024-03-07 11:21:08 +02:00
|
|
|
if (result == 0) {
|
2023-07-18 08:56:58 +03:00
|
|
|
PyErr_SetString(PyExc_AttributeError, "__annotations__");
|
2024-05-21 22:38:12 -04:00
|
|
|
Py_DECREF(dict);
|
2024-03-07 11:21:08 +02:00
|
|
|
return -1;
|
2023-07-18 08:56:58 +03:00
|
|
|
}
|
2021-04-29 20:09:08 -07:00
|
|
|
}
|
2024-03-07 11:21:08 +02:00
|
|
|
if (result < 0) {
|
2024-05-21 22:38:12 -04:00
|
|
|
Py_DECREF(dict);
|
2024-03-07 11:21:08 +02:00
|
|
|
return -1;
|
2025-04-09 20:36:08 +03:00
|
|
|
} else { // result can be 0 or 1
|
2025-04-10 21:13:26 -07:00
|
|
|
if (PyDict_Pop(dict, &_Py_ID(__annotate_func__), NULL) < 0) {
|
|
|
|
|
PyType_Modified(type);
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2024-05-21 22:38:12 -04:00
|
|
|
if (PyDict_Pop(dict, &_Py_ID(__annotate__), NULL) < 0) {
|
|
|
|
|
PyType_Modified(type);
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-07 11:21:08 +02:00
|
|
|
PyType_Modified(type);
|
2024-05-21 22:38:12 -04:00
|
|
|
Py_DECREF(dict);
|
2024-03-07 11:21:08 +02:00
|
|
|
return 0;
|
2021-04-29 20:09:08 -07:00
|
|
|
}
|
|
|
|
|
|
2023-05-19 09:04:47 -07:00
|
|
|
static PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
type_get_type_params(PyObject *tp, void *Py_UNUSED(closure))
|
2023-05-19 09:04:47 -07:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2024-05-28 21:12:58 +03:00
|
|
|
if (type == &PyType_Type) {
|
|
|
|
|
return PyTuple_New(0);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 11:25:39 +02:00
|
|
|
PyObject *params;
|
|
|
|
|
if (PyDict_GetItemRef(lookup_tp_dict(type), &_Py_ID(__type_params__), ¶ms) == 0) {
|
|
|
|
|
return PyTuple_New(0);
|
2023-06-23 20:10:32 +03:00
|
|
|
}
|
2023-11-14 11:25:39 +02:00
|
|
|
return params;
|
2023-05-19 09:04:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2025-02-25 11:44:59 +01:00
|
|
|
type_set_type_params(PyObject *tp, PyObject *value, void *Py_UNUSED(closure))
|
2023-05-19 09:04:47 -07:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
2023-05-19 09:04:47 -07:00
|
|
|
if (!check_set_special_type_attr(type, value, "__type_params__")) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
|
|
|
|
int result = PyDict_SetItem(dict, &_Py_ID(__type_params__), value);
|
|
|
|
|
|
|
|
|
|
if (result == 0) {
|
|
|
|
|
PyType_Modified(type);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 20:09:08 -07:00
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
type.__instancecheck__ -> bool
|
|
|
|
|
|
|
|
|
|
instance: object
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
Check if an object is an instance.
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
type___instancecheck___impl(PyTypeObject *self, PyObject *instance)
|
|
|
|
|
/*[clinic end generated code: output=08b6bf5f591c3618 input=cdbfeaee82c01a0f]*/
|
2008-08-26 22:40:48 +00:00
|
|
|
{
|
2017-03-19 08:46:44 +02:00
|
|
|
return _PyObject_RealIsInstance(instance, (PyObject *)self);
|
2008-08-26 22:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
type.__subclasscheck__ -> bool
|
2008-08-26 22:40:48 +00:00
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
subclass: object
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
Check if a class is a subclass.
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
type___subclasscheck___impl(PyTypeObject *self, PyObject *subclass)
|
|
|
|
|
/*[clinic end generated code: output=97a4e51694500941 input=071b2ca9e03355f4]*/
|
2008-08-26 22:40:48 +00:00
|
|
|
{
|
2017-03-19 08:46:44 +02:00
|
|
|
return _PyObject_RealIsSubclass(subclass, (PyObject *)self);
|
2008-08-26 22:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-10-21 22:28:58 +00:00
|
|
|
static PyGetSetDef type_getsets[] = {
|
2025-02-25 11:44:59 +01:00
|
|
|
{"__name__", type_name, type_set_name, NULL},
|
|
|
|
|
{"__qualname__", type_qualname, type_set_qualname, NULL},
|
|
|
|
|
{"__bases__", type_get_bases, type_set_bases, NULL},
|
|
|
|
|
{"__mro__", type_get_mro, NULL, NULL},
|
|
|
|
|
{"__module__", type_get_module, type_set_module, NULL},
|
|
|
|
|
{"__abstractmethods__", type_abstractmethods,
|
|
|
|
|
type_set_abstractmethods, NULL},
|
|
|
|
|
{"__dict__", type_dict, NULL, NULL},
|
|
|
|
|
{"__doc__", type_get_doc, type_set_doc, NULL},
|
|
|
|
|
{"__text_signature__", type_get_text_signature, NULL, NULL},
|
|
|
|
|
{"__annotations__", type_get_annotations, type_set_annotations, NULL},
|
|
|
|
|
{"__annotate__", type_get_annotate, type_set_annotate, NULL},
|
|
|
|
|
{"__type_params__", type_get_type_params, type_set_type_params, NULL},
|
2010-05-09 15:52:27 +00:00
|
|
|
{0}
|
2001-08-02 04:15:00 +00:00
|
|
|
};
|
|
|
|
|
|
1997-05-02 03:12:38 +00:00
|
|
|
static PyObject *
|
2023-12-20 08:13:44 -06:00
|
|
|
type_repr(PyObject *self)
|
1990-10-14 12:07:46 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(self);
|
2021-06-29 16:39:29 +02:00
|
|
|
if (type->tp_name == NULL) {
|
|
|
|
|
// type_repr() called before the type is fully initialized
|
|
|
|
|
// by PyType_Ready().
|
|
|
|
|
return PyUnicode_FromFormat("<class at %p>", type);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-14 19:17:43 +01:00
|
|
|
PyObject *mod = type_module(type);
|
2024-03-14 17:19:36 +01:00
|
|
|
if (mod == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_Clear();
|
2024-03-14 17:19:36 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
else if (!PyUnicode_Check(mod)) {
|
2024-03-14 17:19:36 +01:00
|
|
|
Py_CLEAR(mod);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2024-03-14 17:19:36 +01:00
|
|
|
|
2025-02-25 11:44:59 +01:00
|
|
|
PyObject *name = type_qualname(self, NULL);
|
2012-09-10 03:00:14 +02:00
|
|
|
if (name == NULL) {
|
|
|
|
|
Py_XDECREF(mod);
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
2012-09-10 03:00:14 +02:00
|
|
|
}
|
2001-08-24 18:34:26 +00:00
|
|
|
|
2024-03-14 17:19:36 +01:00
|
|
|
PyObject *result;
|
|
|
|
|
if (mod != NULL && !_PyUnicode_Equal(mod, &_Py_ID(builtins))) {
|
|
|
|
|
result = PyUnicode_FromFormat("<class '%U.%U'>", mod, name);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
result = PyUnicode_FromFormat("<class '%s'>", type->tp_name);
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_XDECREF(mod);
|
|
|
|
|
Py_DECREF(name);
|
2024-03-14 17:19:36 +01:00
|
|
|
|
|
|
|
|
return result;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
2023-12-20 08:13:44 -06:00
|
|
|
type_call(PyObject *self, PyObject *args, PyObject *kwds)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(self);
|
2020-03-09 19:59:03 +02:00
|
|
|
PyObject *obj;
|
2019-11-05 01:22:12 +01:00
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2013-08-26 14:05:19 +02:00
|
|
|
#ifdef Py_DEBUG
|
|
|
|
|
/* type_call() must not be called with an exception set,
|
2017-01-18 14:12:51 +01:00
|
|
|
because it can clear it (directly or indirectly) and so the
|
2015-10-07 10:26:23 +00:00
|
|
|
caller loses its exception */
|
2019-11-05 01:22:12 +01:00
|
|
|
assert(!_PyErr_Occurred(tstate));
|
2013-08-26 14:05:19 +02:00
|
|
|
#endif
|
|
|
|
|
|
2020-03-09 19:59:03 +02:00
|
|
|
/* Special case: type(x) should return Py_TYPE(x) */
|
|
|
|
|
/* We only want type itself to accept the one-argument form (#27157) */
|
|
|
|
|
if (type == &PyType_Type) {
|
|
|
|
|
assert(args != NULL && PyTuple_Check(args));
|
|
|
|
|
assert(kwds == NULL || PyDict_Check(kwds));
|
|
|
|
|
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
|
|
|
|
|
|
|
|
|
|
if (nargs == 1 && (kwds == NULL || !PyDict_GET_SIZE(kwds))) {
|
|
|
|
|
obj = (PyObject *) Py_TYPE(PyTuple_GET_ITEM(args, 0));
|
2022-11-10 23:40:31 +01:00
|
|
|
return Py_NewRef(obj);
|
2020-03-09 19:59:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* SF bug 475327 -- if that didn't trigger, we need 3
|
|
|
|
|
arguments. But PyArg_ParseTuple in type_new may give
|
|
|
|
|
a msg saying type() needs exactly 3. */
|
|
|
|
|
if (nargs != 3) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"type() takes 1 or 3 arguments");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type->tp_new == NULL) {
|
|
|
|
|
_PyErr_Format(tstate, PyExc_TypeError,
|
2021-04-30 12:46:15 +02:00
|
|
|
"cannot create '%s' instances", type->tp_name);
|
2020-03-09 19:59:03 +02:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obj = type->tp_new(type, args, kwds);
|
2019-11-05 01:22:12 +01:00
|
|
|
obj = _Py_CheckFunctionResult(tstate, (PyObject*)type, obj, NULL);
|
2015-09-03 12:16:49 +02:00
|
|
|
if (obj == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
/* If the returned object is not an instance of type,
|
|
|
|
|
it won't be initialized. */
|
2021-11-04 03:39:50 -07:00
|
|
|
if (!PyObject_TypeCheck(obj, type))
|
2015-09-03 12:16:49 +02:00
|
|
|
return obj;
|
|
|
|
|
|
|
|
|
|
type = Py_TYPE(obj);
|
|
|
|
|
if (type->tp_init != NULL) {
|
|
|
|
|
int res = type->tp_init(obj, args, kwds);
|
|
|
|
|
if (res < 0) {
|
2019-11-05 01:22:12 +01:00
|
|
|
assert(_PyErr_Occurred(tstate));
|
2022-11-23 14:57:50 +01:00
|
|
|
Py_SETREF(obj, NULL);
|
2015-09-03 12:16:49 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2019-11-05 01:22:12 +01:00
|
|
|
assert(!_PyErr_Occurred(tstate));
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return obj;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2023-06-22 09:48:19 +01:00
|
|
|
PyObject *
|
|
|
|
|
_PyType_NewManagedObject(PyTypeObject *type)
|
|
|
|
|
{
|
2024-04-02 11:59:21 +01:00
|
|
|
assert(type->tp_flags & Py_TPFLAGS_INLINE_VALUES);
|
2023-06-22 09:48:19 +01:00
|
|
|
assert(_PyType_IS_GC(type));
|
|
|
|
|
assert(type->tp_new == PyBaseObject_Type.tp_new);
|
|
|
|
|
assert(type->tp_alloc == PyType_GenericAlloc);
|
|
|
|
|
assert(type->tp_itemsize == 0);
|
|
|
|
|
PyObject *obj = PyType_GenericAlloc(type, 0);
|
|
|
|
|
if (obj == NULL) {
|
|
|
|
|
return PyErr_NoMemory();
|
|
|
|
|
}
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
PyObject *
|
2021-07-01 02:30:46 +02:00
|
|
|
_PyType_AllocNoTrack(PyTypeObject *type, Py_ssize_t nitems)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *obj;
|
2023-01-12 10:03:50 -08:00
|
|
|
/* The +1 on nitems is needed for most types but not all. We could save a
|
|
|
|
|
* bit of space by allocating one less item in certain cases, depending on
|
|
|
|
|
* the type. However, given the extra complexity (e.g. an additional type
|
|
|
|
|
* flag to indicate when that is safe) it does not seem worth the memory
|
|
|
|
|
* savings. An example type that doesn't need the +1 is a subclass of
|
|
|
|
|
* tuple. See GH-100659 and GH-81381. */
|
2024-04-02 11:59:21 +01:00
|
|
|
size_t size = _PyObject_VAR_SIZE(type, nitems+1);
|
2001-10-06 19:04:01 +00:00
|
|
|
|
2021-12-07 16:02:53 +00:00
|
|
|
const size_t presize = _PyType_PreHeaderSize(type);
|
2024-04-02 11:59:21 +01:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
|
|
|
|
|
assert(type->tp_itemsize == 0);
|
|
|
|
|
size += _PyInlineValuesSize(type);
|
|
|
|
|
}
|
2024-01-20 11:14:45 -05:00
|
|
|
char *alloc = _PyObject_MallocWithType(type, size + presize);
|
2021-12-07 16:02:53 +00:00
|
|
|
if (alloc == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return PyErr_NoMemory();
|
2020-04-08 01:42:27 +02:00
|
|
|
}
|
2021-12-07 16:02:53 +00:00
|
|
|
obj = (PyObject *)(alloc + presize);
|
|
|
|
|
if (presize) {
|
|
|
|
|
((PyObject **)alloc)[0] = NULL;
|
|
|
|
|
((PyObject **)alloc)[1] = NULL;
|
2024-02-16 11:22:27 -05:00
|
|
|
}
|
|
|
|
|
if (PyType_IS_GC(type)) {
|
2021-12-07 16:02:53 +00:00
|
|
|
_PyObject_GC_Link(obj);
|
|
|
|
|
}
|
2025-02-13 11:50:45 -05:00
|
|
|
// Zero out the object after the PyObject header. The header fields are
|
|
|
|
|
// initialized by _PyObject_Init[Var]().
|
|
|
|
|
memset((char *)obj + sizeof(PyObject), 0, size - sizeof(PyObject));
|
2001-10-06 19:04:01 +00:00
|
|
|
|
2020-04-08 01:42:27 +02:00
|
|
|
if (type->tp_itemsize == 0) {
|
2020-06-16 01:28:07 +02:00
|
|
|
_PyObject_Init(obj, type);
|
2020-04-08 01:42:27 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2020-06-16 01:28:07 +02:00
|
|
|
_PyObject_InitVar((PyVarObject *)obj, type, nitems);
|
2020-04-08 01:42:27 +02:00
|
|
|
}
|
2024-04-02 11:59:21 +01:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
|
|
|
|
|
_PyObject_InitInlineValues(obj, type);
|
|
|
|
|
}
|
2021-07-01 02:30:46 +02:00
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
|
|
|
|
|
{
|
|
|
|
|
PyObject *obj = _PyType_AllocNoTrack(type, nitems);
|
|
|
|
|
if (obj == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2001-10-06 19:04:01 +00:00
|
|
|
|
2020-04-08 01:42:27 +02:00
|
|
|
if (_PyType_IS_GC(type)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
_PyObject_GC_TRACK(obj);
|
2020-04-08 01:42:27 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
return obj;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
PyType_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
return type->tp_alloc(type, 0);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-10-05 20:51:39 +00:00
|
|
|
/* Helpers for subtyping */
|
|
|
|
|
|
2023-05-04 09:56:53 +02:00
|
|
|
static inline PyMemberDef *
|
|
|
|
|
_PyHeapType_GET_MEMBERS(PyHeapTypeObject* type)
|
|
|
|
|
{
|
|
|
|
|
return PyObject_GetItemData((PyObject *)type);
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-04 19:52:53 +00:00
|
|
|
static int
|
|
|
|
|
traverse_slots(PyTypeObject *type, PyObject *self, visitproc visit, void *arg)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_ssize_t i, n;
|
|
|
|
|
PyMemberDef *mp;
|
|
|
|
|
|
|
|
|
|
n = Py_SIZE(type);
|
2022-01-28 00:39:52 +01:00
|
|
|
mp = _PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
|
2010-05-09 15:52:27 +00:00
|
|
|
for (i = 0; i < n; i++, mp++) {
|
2023-07-25 15:28:30 +02:00
|
|
|
if (mp->type == Py_T_OBJECT_EX) {
|
2010-05-09 15:52:27 +00:00
|
|
|
char *addr = (char *)self + mp->offset;
|
|
|
|
|
PyObject *obj = *(PyObject **)addr;
|
|
|
|
|
if (obj != NULL) {
|
|
|
|
|
int err = visit(obj, arg);
|
|
|
|
|
if (err)
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2002-06-04 19:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
2001-10-05 20:51:39 +00:00
|
|
|
static int
|
|
|
|
|
subtype_traverse(PyObject *self, visitproc visit, void *arg)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *type, *base;
|
|
|
|
|
traverseproc basetraverse;
|
|
|
|
|
|
|
|
|
|
/* Find the nearest base with a different tp_traverse,
|
|
|
|
|
and traverse slots while we're at it */
|
|
|
|
|
type = Py_TYPE(self);
|
|
|
|
|
base = type;
|
|
|
|
|
while ((basetraverse = base->tp_traverse) == subtype_traverse) {
|
|
|
|
|
if (Py_SIZE(base)) {
|
|
|
|
|
int err = traverse_slots(base, self, visit, arg);
|
|
|
|
|
if (err)
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
base = base->tp_base;
|
|
|
|
|
assert(base);
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-15 12:29:27 +01:00
|
|
|
if (type->tp_dictoffset != base->tp_dictoffset) {
|
|
|
|
|
assert(base->tp_dictoffset == 0);
|
|
|
|
|
if (type->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
|
|
|
|
|
assert(type->tp_dictoffset == -1);
|
2023-10-02 19:24:08 +02:00
|
|
|
int err = PyObject_VisitManagedDict(self, visit, arg);
|
2022-08-15 12:29:27 +01:00
|
|
|
if (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PyObject **dictptr = _PyObject_ComputedDictPointer(self);
|
|
|
|
|
if (dictptr && *dictptr) {
|
|
|
|
|
Py_VISIT(*dictptr);
|
|
|
|
|
}
|
2021-10-13 14:19:34 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
2020-05-27 10:03:38 +01:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE
|
|
|
|
|
&& (!basetraverse || !(base->tp_flags & Py_TPFLAGS_HEAPTYPE))) {
|
2010-05-09 15:52:27 +00:00
|
|
|
/* For a heaptype, the instances count as references
|
|
|
|
|
to the type. Traverse the type so the collector
|
2020-05-27 10:03:38 +01:00
|
|
|
can find cycles involving this link.
|
|
|
|
|
Skip this visit if basetraverse belongs to a heap type: in that
|
|
|
|
|
case, basetraverse will visit the type when we call it later.
|
|
|
|
|
*/
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_VISIT(type);
|
2020-05-27 10:03:38 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
if (basetraverse)
|
|
|
|
|
return basetraverse(self, visit, arg);
|
|
|
|
|
return 0;
|
2002-06-04 19:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
clear_slots(PyTypeObject *type, PyObject *self)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_ssize_t i, n;
|
|
|
|
|
PyMemberDef *mp;
|
|
|
|
|
|
|
|
|
|
n = Py_SIZE(type);
|
2022-01-28 00:39:52 +01:00
|
|
|
mp = _PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
|
2010-05-09 15:52:27 +00:00
|
|
|
for (i = 0; i < n; i++, mp++) {
|
2023-07-25 15:28:30 +02:00
|
|
|
if (mp->type == Py_T_OBJECT_EX && !(mp->flags & Py_READONLY)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
char *addr = (char *)self + mp->offset;
|
|
|
|
|
PyObject *obj = *(PyObject **)addr;
|
|
|
|
|
if (obj != NULL) {
|
|
|
|
|
*(PyObject **)addr = NULL;
|
|
|
|
|
Py_DECREF(obj);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-06-04 19:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
subtype_clear(PyObject *self)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *type, *base;
|
|
|
|
|
inquiry baseclear;
|
2002-06-04 19:52:53 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Find the nearest base with a different tp_clear
|
|
|
|
|
and clear slots while we're at it */
|
|
|
|
|
type = Py_TYPE(self);
|
|
|
|
|
base = type;
|
|
|
|
|
while ((baseclear = base->tp_clear) == subtype_clear) {
|
|
|
|
|
if (Py_SIZE(base))
|
|
|
|
|
clear_slots(base, self);
|
|
|
|
|
base = base->tp_base;
|
|
|
|
|
assert(base);
|
|
|
|
|
}
|
2002-06-04 19:52:53 +00:00
|
|
|
|
2012-03-07 18:41:11 -06:00
|
|
|
/* Clear the instance dict (if any), to break cycles involving only
|
|
|
|
|
__dict__ slots (as in the case 'self.__dict__ is self'). */
|
2021-12-07 16:02:53 +00:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
|
2022-08-15 12:29:27 +01:00
|
|
|
if ((base->tp_flags & Py_TPFLAGS_MANAGED_DICT) == 0) {
|
2023-10-02 19:24:08 +02:00
|
|
|
PyObject_ClearManagedDict(self);
|
2022-08-15 12:29:27 +01:00
|
|
|
}
|
2024-04-02 11:59:21 +01:00
|
|
|
else {
|
|
|
|
|
assert((base->tp_flags & Py_TPFLAGS_INLINE_VALUES) ==
|
|
|
|
|
(type->tp_flags & Py_TPFLAGS_INLINE_VALUES));
|
|
|
|
|
}
|
2021-10-13 14:19:34 +01:00
|
|
|
}
|
2022-08-01 14:34:54 +01:00
|
|
|
else if (type->tp_dictoffset != base->tp_dictoffset) {
|
|
|
|
|
PyObject **dictptr = _PyObject_ComputedDictPointer(self);
|
2012-03-07 18:41:11 -06:00
|
|
|
if (dictptr && *dictptr)
|
|
|
|
|
Py_CLEAR(*dictptr);
|
|
|
|
|
}
|
2002-06-04 19:52:53 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (baseclear)
|
|
|
|
|
return baseclear(self);
|
|
|
|
|
return 0;
|
2001-10-05 20:51:39 +00:00
|
|
|
}
|
2001-08-02 04:15:00 +00:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
subtype_dealloc(PyObject *self)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *type, *base;
|
|
|
|
|
destructor basedealloc;
|
2013-07-30 19:59:21 +02:00
|
|
|
int has_finalizer;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* Extract the type; we expect it to be a heap type */
|
|
|
|
|
type = Py_TYPE(self);
|
2018-10-26 18:39:11 +02:00
|
|
|
_PyObject_ASSERT((PyObject *)type, type->tp_flags & Py_TPFLAGS_HEAPTYPE);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* Test whether the type has GC exactly once */
|
|
|
|
|
|
2020-04-08 01:42:27 +02:00
|
|
|
if (!_PyType_IS_GC(type)) {
|
bpo-37879: Suppress subtype_dealloc decref when base type is a C heap type (GH-15323)
The instance destructor for a type is responsible for preparing
an instance for deallocation by decrementing the reference counts
of its referents.
If an instance belongs to a heap type, the type object of an instance
has its reference count decremented while for static types, which
are permanently allocated, the type object is unaffected by the
instance destructor.
Previously, the default instance destructor searched the class
hierarchy for an inherited instance destructor and, if present,
would invoke it.
Then, if the instance type is a heap type, it would decrement the
reference count of that heap type. However, this could result in the
premature destruction of a type because the inherited instance
destructor should have already decremented the reference count
of the type object.
This change avoids the premature destruction of the type object
by suppressing the decrement of its reference count when an
inherited, non-default instance destructor has been invoked.
Finally, an assertion on the Py_SIZE of a type was deleted. Heap
types have a non zero size, making this into an incorrect assertion.
https://github.com/python/cpython/pull/15323
2019-09-11 05:17:13 -04:00
|
|
|
/* A non GC dynamic type allows certain simplifications:
|
|
|
|
|
there's no need to call clear_slots(), or DECREF the dict,
|
|
|
|
|
or clear weakrefs. */
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* Maybe call finalizer; exit early if resurrected */
|
2013-07-30 19:59:21 +02:00
|
|
|
if (type->tp_finalize) {
|
|
|
|
|
if (PyObject_CallFinalizerFromDealloc(self) < 0)
|
|
|
|
|
return;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
if (type->tp_del) {
|
|
|
|
|
type->tp_del(self);
|
2020-02-07 00:38:59 +01:00
|
|
|
if (Py_REFCNT(self) > 0) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return;
|
2020-02-07 00:38:59 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find the nearest base with a different tp_dealloc */
|
|
|
|
|
base = type;
|
|
|
|
|
while ((basedealloc = base->tp_dealloc) == subtype_dealloc) {
|
|
|
|
|
base = base->tp_base;
|
|
|
|
|
assert(base);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Extract the type again; tp_del may have changed it */
|
|
|
|
|
type = Py_TYPE(self);
|
|
|
|
|
|
2021-07-16 00:40:57 +02:00
|
|
|
// Don't read type memory after calling basedealloc() since basedealloc()
|
|
|
|
|
// can deallocate the type and free its memory.
|
|
|
|
|
int type_needs_decref = (type->tp_flags & Py_TPFLAGS_HEAPTYPE
|
|
|
|
|
&& !(base->tp_flags & Py_TPFLAGS_HEAPTYPE));
|
|
|
|
|
|
2021-12-07 16:02:53 +00:00
|
|
|
assert((type->tp_flags & Py_TPFLAGS_MANAGED_DICT) == 0);
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Call the base tp_dealloc() */
|
|
|
|
|
assert(basedealloc);
|
|
|
|
|
basedealloc(self);
|
|
|
|
|
|
2021-07-16 00:40:57 +02:00
|
|
|
/* Can't reference self beyond this point. It's possible tp_del switched
|
|
|
|
|
our type from a HEAPTYPE to a non-HEAPTYPE, so be careful about
|
|
|
|
|
reference counting. Only decref if the base type is not already a heap
|
|
|
|
|
allocated type. Otherwise, basedealloc should have decref'd it already */
|
|
|
|
|
if (type_needs_decref) {
|
2024-08-06 14:36:57 -04:00
|
|
|
_Py_DECREF_TYPE(type);
|
2021-07-16 00:40:57 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* Done */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We get here only if the type has GC */
|
|
|
|
|
|
|
|
|
|
/* UnTrack and re-Track around the trashcan macro, alas */
|
|
|
|
|
/* See explanation at end of function for full disclosure */
|
|
|
|
|
PyObject_GC_UnTrack(self);
|
|
|
|
|
|
|
|
|
|
/* Find the nearest base with a different tp_dealloc */
|
|
|
|
|
base = type;
|
2011-02-22 20:15:44 +00:00
|
|
|
while ((/*basedealloc =*/ base->tp_dealloc) == subtype_dealloc) {
|
2010-05-09 15:52:27 +00:00
|
|
|
base = base->tp_base;
|
|
|
|
|
assert(base);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-30 19:59:21 +02:00
|
|
|
has_finalizer = type->tp_finalize || type->tp_del;
|
|
|
|
|
|
|
|
|
|
if (type->tp_finalize) {
|
2016-10-04 00:00:02 -07:00
|
|
|
_PyObject_GC_TRACK(self);
|
2013-07-30 19:59:21 +02:00
|
|
|
if (PyObject_CallFinalizerFromDealloc(self) < 0) {
|
|
|
|
|
/* Resurrected */
|
2025-04-30 11:37:53 +01:00
|
|
|
return;
|
2013-07-30 19:59:21 +02:00
|
|
|
}
|
2016-10-04 00:00:02 -07:00
|
|
|
_PyObject_GC_UNTRACK(self);
|
2013-07-30 19:59:21 +02:00
|
|
|
}
|
2016-10-04 00:00:02 -07:00
|
|
|
/*
|
|
|
|
|
If we added a weaklist, we clear it. Do this *before* calling tp_del,
|
|
|
|
|
clearing slots, or clearing the instance dict.
|
|
|
|
|
|
|
|
|
|
GC tracking must be off at this point. weakref callbacks (if any, and
|
|
|
|
|
whether directly here or indirectly in something we call) may trigger GC,
|
|
|
|
|
and if self is tracked at that point, it will look like trash to GC and GC
|
|
|
|
|
will try to delete self again.
|
|
|
|
|
*/
|
2022-01-22 18:56:11 +01:00
|
|
|
if (type->tp_weaklistoffset && !base->tp_weaklistoffset) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject_ClearWeakRefs(self);
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
if (type->tp_del) {
|
2016-10-04 00:00:02 -07:00
|
|
|
_PyObject_GC_TRACK(self);
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_del(self);
|
2020-02-07 00:38:59 +01:00
|
|
|
if (Py_REFCNT(self) > 0) {
|
2013-07-30 19:59:21 +02:00
|
|
|
/* Resurrected */
|
2025-04-30 11:37:53 +01:00
|
|
|
return;
|
2013-07-30 19:59:21 +02:00
|
|
|
}
|
2016-10-04 00:00:02 -07:00
|
|
|
_PyObject_GC_UNTRACK(self);
|
2013-07-30 19:59:21 +02:00
|
|
|
}
|
|
|
|
|
if (has_finalizer) {
|
2010-05-09 15:52:27 +00:00
|
|
|
/* New weakrefs could be created during the finalizer call.
|
2013-07-30 19:59:21 +02:00
|
|
|
If this occurs, clear them out without calling their
|
|
|
|
|
finalizers since they might rely on part of the object
|
|
|
|
|
being finalized that has already been destroyed. */
|
2010-05-09 15:52:27 +00:00
|
|
|
if (type->tp_weaklistoffset && !base->tp_weaklistoffset) {
|
2024-06-18 09:57:23 -04:00
|
|
|
_PyWeakref_ClearWeakRefsNoCallbacks(self);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clear slots up to the nearest base with a different tp_dealloc */
|
|
|
|
|
base = type;
|
|
|
|
|
while ((basedealloc = base->tp_dealloc) == subtype_dealloc) {
|
|
|
|
|
if (Py_SIZE(base))
|
|
|
|
|
clear_slots(base, self);
|
|
|
|
|
base = base->tp_base;
|
|
|
|
|
assert(base);
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-13 14:19:34 +01:00
|
|
|
/* If we added a dict, DECREF it, or free inline values. */
|
2021-12-07 16:02:53 +00:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
|
2024-04-02 11:59:21 +01:00
|
|
|
PyObject_ClearManagedDict(self);
|
2021-10-13 14:19:34 +01:00
|
|
|
}
|
2021-12-07 16:02:53 +00:00
|
|
|
else if (type->tp_dictoffset && !base->tp_dictoffset) {
|
2022-08-01 14:34:54 +01:00
|
|
|
PyObject **dictptr = _PyObject_ComputedDictPointer(self);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (dictptr != NULL) {
|
|
|
|
|
PyObject *dict = *dictptr;
|
|
|
|
|
if (dict != NULL) {
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
*dictptr = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Extract the type again; tp_del may have changed it */
|
|
|
|
|
type = Py_TYPE(self);
|
|
|
|
|
|
|
|
|
|
/* Call the base tp_dealloc(); first retrack self if
|
|
|
|
|
* basedealloc knows about gc.
|
|
|
|
|
*/
|
2020-04-08 01:42:27 +02:00
|
|
|
if (_PyType_IS_GC(base)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
_PyObject_GC_TRACK(self);
|
2020-04-08 01:42:27 +02:00
|
|
|
}
|
2021-05-21 19:19:54 +02:00
|
|
|
|
|
|
|
|
// Don't read type memory after calling basedealloc() since basedealloc()
|
|
|
|
|
// can deallocate the type and free its memory.
|
|
|
|
|
int type_needs_decref = (type->tp_flags & Py_TPFLAGS_HEAPTYPE
|
|
|
|
|
&& !(base->tp_flags & Py_TPFLAGS_HEAPTYPE));
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
assert(basedealloc);
|
|
|
|
|
basedealloc(self);
|
|
|
|
|
|
2015-01-30 13:33:42 -05:00
|
|
|
/* Can't reference self beyond this point. It's possible tp_del switched
|
|
|
|
|
our type from a HEAPTYPE to a non-HEAPTYPE, so be careful about
|
bpo-37879: Suppress subtype_dealloc decref when base type is a C heap type (GH-15323)
The instance destructor for a type is responsible for preparing
an instance for deallocation by decrementing the reference counts
of its referents.
If an instance belongs to a heap type, the type object of an instance
has its reference count decremented while for static types, which
are permanently allocated, the type object is unaffected by the
instance destructor.
Previously, the default instance destructor searched the class
hierarchy for an inherited instance destructor and, if present,
would invoke it.
Then, if the instance type is a heap type, it would decrement the
reference count of that heap type. However, this could result in the
premature destruction of a type because the inherited instance
destructor should have already decremented the reference count
of the type object.
This change avoids the premature destruction of the type object
by suppressing the decrement of its reference count when an
inherited, non-default instance destructor has been invoked.
Finally, an assertion on the Py_SIZE of a type was deleted. Heap
types have a non zero size, making this into an incorrect assertion.
https://github.com/python/cpython/pull/15323
2019-09-11 05:17:13 -04:00
|
|
|
reference counting. Only decref if the base type is not already a heap
|
|
|
|
|
allocated type. Otherwise, basedealloc should have decref'd it already */
|
2021-05-21 19:19:54 +02:00
|
|
|
if (type_needs_decref) {
|
2024-08-06 14:36:57 -04:00
|
|
|
_Py_DECREF_TYPE(type);
|
2021-05-21 19:19:54 +02:00
|
|
|
}
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2002-07-17 16:30:39 +00:00
|
|
|
static PyTypeObject *solid_base(PyTypeObject *type);
|
2001-08-02 04:15:00 +00:00
|
|
|
|
|
|
|
|
/* type test with subclassing support */
|
|
|
|
|
|
2016-09-09 12:42:51 -07:00
|
|
|
static int
|
2015-02-05 22:29:14 -05:00
|
|
|
type_is_subtype_base_chain(PyTypeObject *a, PyTypeObject *b)
|
|
|
|
|
{
|
|
|
|
|
do {
|
|
|
|
|
if (a == b)
|
|
|
|
|
return 1;
|
|
|
|
|
a = a->tp_base;
|
|
|
|
|
} while (a != NULL);
|
|
|
|
|
|
|
|
|
|
return (b == &PyBaseObject_Type);
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
static int
|
2024-03-15 12:35:29 -04:00
|
|
|
is_subtype_with_mro(PyObject *a_mro, PyTypeObject *a, PyTypeObject *b)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2024-03-15 12:35:29 -04:00
|
|
|
int res;
|
|
|
|
|
if (a_mro != NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Deal with multiple inheritance without recursion
|
|
|
|
|
by walking the MRO tuple */
|
|
|
|
|
Py_ssize_t i, n;
|
2024-03-15 12:35:29 -04:00
|
|
|
assert(PyTuple_Check(a_mro));
|
|
|
|
|
n = PyTuple_GET_SIZE(a_mro);
|
|
|
|
|
res = 0;
|
2010-05-09 15:52:27 +00:00
|
|
|
for (i = 0; i < n; i++) {
|
2024-03-15 12:35:29 -04:00
|
|
|
if (PyTuple_GET_ITEM(a_mro, i) == (PyObject *)b) {
|
|
|
|
|
res = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
2024-03-15 12:35:29 -04:00
|
|
|
else {
|
2019-07-31 08:16:13 +10:00
|
|
|
/* a is not completely initialized yet; follow tp_base */
|
2024-03-15 12:35:29 -04:00
|
|
|
res = type_is_subtype_base_chain(a, b);
|
|
|
|
|
}
|
|
|
|
|
return res;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
int
|
|
|
|
|
PyType_IsSubtype(PyTypeObject *a, PyTypeObject *b)
|
|
|
|
|
{
|
2024-03-29 10:42:02 -07:00
|
|
|
return is_subtype_with_mro(a->tp_mro, a, b);
|
2024-02-15 10:54:57 -08:00
|
|
|
}
|
|
|
|
|
|
2017-06-01 08:18:25 +03:00
|
|
|
/* Routines to do a method lookup in the type without looking in the
|
|
|
|
|
instance dictionary (so we can't use PyObject_GetAttr) but still
|
|
|
|
|
binding it to the instance.
|
2001-09-14 17:51:50 +00:00
|
|
|
|
2017-02-09 22:53:47 +01:00
|
|
|
Variants:
|
2001-09-14 17:51:50 +00:00
|
|
|
|
2017-06-01 08:18:25 +03:00
|
|
|
- _PyObject_LookupSpecial() returns NULL without raising an exception
|
2024-05-06 10:50:35 -07:00
|
|
|
when the _PyType_LookupRef() call fails;
|
2001-09-14 17:51:50 +00:00
|
|
|
|
2017-06-01 08:18:25 +03:00
|
|
|
- lookup_maybe_method() and lookup_method() are internal routines similar
|
|
|
|
|
to _PyObject_LookupSpecial(), but can return unbound PyFunction
|
2017-02-09 22:53:47 +01:00
|
|
|
to avoid temporary method object. Pass self as first argument when
|
|
|
|
|
unbound == 1.
|
2001-09-14 17:51:50 +00:00
|
|
|
*/
|
2001-08-28 17:47:51 +00:00
|
|
|
|
2017-06-01 08:18:25 +03:00
|
|
|
PyObject *
|
2022-02-08 13:39:07 -07:00
|
|
|
_PyObject_LookupSpecial(PyObject *self, PyObject *attr)
|
2001-08-28 17:47:51 +00:00
|
|
|
{
|
2012-03-26 22:10:51 +02:00
|
|
|
PyObject *res;
|
2001-08-28 17:47:51 +00:00
|
|
|
|
2024-05-06 10:50:35 -07:00
|
|
|
res = _PyType_LookupRef(Py_TYPE(self), attr);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (res != NULL) {
|
|
|
|
|
descrgetfunc f;
|
2024-05-06 10:50:35 -07:00
|
|
|
if ((f = Py_TYPE(res)->tp_descr_get) != NULL) {
|
|
|
|
|
Py_SETREF(res, f(res, self, (PyObject *)(Py_TYPE(self))));
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
return res;
|
2001-08-28 17:47:51 +00:00
|
|
|
}
|
|
|
|
|
|
2025-04-21 15:54:25 -04:00
|
|
|
// Lookup the method name `attr` on `self`. On entry, `method_and_self[0]`
|
|
|
|
|
// is null and `method_and_self[1]` is `self`. On exit, `method_and_self[0]`
|
|
|
|
|
// is the method object and `method_and_self[1]` is `self` if the method is
|
|
|
|
|
// not bound.
|
|
|
|
|
// Return 1 on success, -1 on error, and 0 if the method is missing.
|
|
|
|
|
int
|
|
|
|
|
_PyObject_LookupSpecialMethod(PyObject *attr, _PyStackRef *method_and_self)
|
2024-06-18 12:17:46 +01:00
|
|
|
{
|
2025-04-21 15:54:25 -04:00
|
|
|
PyObject *self = PyStackRef_AsPyObjectBorrow(method_and_self[1]);
|
|
|
|
|
_PyType_LookupStackRefAndVersion(Py_TYPE(self), attr, &method_and_self[0]);
|
|
|
|
|
PyObject *method_o = PyStackRef_AsPyObjectBorrow(method_and_self[0]);
|
|
|
|
|
if (method_o == NULL) {
|
|
|
|
|
return 0;
|
2024-06-18 12:17:46 +01:00
|
|
|
}
|
|
|
|
|
|
2025-04-21 15:54:25 -04:00
|
|
|
if (_PyType_HasFeature(Py_TYPE(method_o), Py_TPFLAGS_METHOD_DESCRIPTOR)) {
|
2024-06-18 12:17:46 +01:00
|
|
|
/* Avoid temporary PyMethodObject */
|
2025-04-21 15:54:25 -04:00
|
|
|
return 1;
|
2024-06-18 12:17:46 +01:00
|
|
|
}
|
2025-04-21 15:54:25 -04:00
|
|
|
|
|
|
|
|
descrgetfunc f = Py_TYPE(method_o)->tp_descr_get;
|
|
|
|
|
if (f != NULL) {
|
|
|
|
|
PyObject *func = f(method_o, self, (PyObject *)(Py_TYPE(self)));
|
|
|
|
|
if (func == NULL) {
|
|
|
|
|
return -1;
|
2024-06-18 12:17:46 +01:00
|
|
|
}
|
2025-04-21 15:54:25 -04:00
|
|
|
PyStackRef_CLEAR(method_and_self[0]); // clear method
|
|
|
|
|
method_and_self[0] = PyStackRef_FromPyObjectSteal(func);
|
2024-06-18 12:17:46 +01:00
|
|
|
}
|
2025-04-21 15:54:25 -04:00
|
|
|
PyStackRef_CLEAR(method_and_self[1]); // clear self
|
|
|
|
|
return 1;
|
2024-06-18 12:17:46 +01:00
|
|
|
}
|
|
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
static int
|
|
|
|
|
lookup_method_ex(PyObject *self, PyObject *attr, _PyStackRef *out,
|
|
|
|
|
int raise_attribute_error)
|
2001-09-14 17:51:50 +00:00
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
_PyType_LookupStackRefAndVersion(Py_TYPE(self), attr, out);
|
|
|
|
|
if (PyStackRef_IsNull(*out)) {
|
|
|
|
|
if (raise_attribute_error) {
|
|
|
|
|
PyErr_SetObject(PyExc_AttributeError, attr);
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
2017-02-09 22:53:47 +01:00
|
|
|
}
|
|
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
PyObject *value = PyStackRef_AsPyObjectBorrow(*out);
|
|
|
|
|
if (_PyType_HasFeature(Py_TYPE(value), Py_TPFLAGS_METHOD_DESCRIPTOR)) {
|
2017-02-09 22:53:47 +01:00
|
|
|
/* Avoid temporary PyMethodObject */
|
2025-03-26 14:38:47 -04:00
|
|
|
return 1;
|
2017-02-09 22:53:47 +01:00
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
|
|
|
|
|
descrgetfunc f = Py_TYPE(value)->tp_descr_get;
|
|
|
|
|
if (f != NULL) {
|
|
|
|
|
value = f(value, self, (PyObject *)(Py_TYPE(self)));
|
|
|
|
|
PyStackRef_CLEAR(*out);
|
|
|
|
|
if (value == NULL) {
|
|
|
|
|
if (!raise_attribute_error &&
|
|
|
|
|
PyErr_ExceptionMatches(PyExc_AttributeError))
|
|
|
|
|
{
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
2017-02-09 22:53:47 +01:00
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
*out = PyStackRef_FromPyObjectSteal(value);
|
2017-02-09 22:53:47 +01:00
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
return 0;
|
2017-02-09 22:53:47 +01:00
|
|
|
}
|
|
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
static int
|
|
|
|
|
lookup_maybe_method(PyObject *self, PyObject *attr, _PyStackRef *out)
|
2017-02-09 22:53:47 +01:00
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
return lookup_method_ex(self, attr, out, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
lookup_method(PyObject *self, PyObject *attr, _PyStackRef *out)
|
|
|
|
|
{
|
|
|
|
|
return lookup_method_ex(self, attr, out, 1);
|
2001-09-14 17:51:50 +00:00
|
|
|
}
|
|
|
|
|
|
2019-06-13 11:26:44 +02:00
|
|
|
|
|
|
|
|
static inline PyObject*
|
2019-11-08 10:05:17 +01:00
|
|
|
vectorcall_unbound(PyThreadState *tstate, int unbound, PyObject *func,
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *const *args, Py_ssize_t nargs)
|
2017-02-09 22:53:47 +01:00
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
size_t nargsf = nargs;
|
|
|
|
|
if (!unbound) {
|
|
|
|
|
/* Skip self argument, freeing up args[0] to use for
|
|
|
|
|
* PY_VECTORCALL_ARGUMENTS_OFFSET */
|
|
|
|
|
args++;
|
|
|
|
|
nargsf = nargsf - 1 + PY_VECTORCALL_ARGUMENTS_OFFSET;
|
2017-02-09 22:53:47 +01:00
|
|
|
}
|
2022-05-27 16:31:41 +01:00
|
|
|
EVAL_CALL_STAT_INC_IF_FUNCTION(EVAL_CALL_SLOT, func);
|
2019-11-08 10:05:17 +01:00
|
|
|
return _PyObject_VectorcallTstate(tstate, func, args, nargsf, NULL);
|
2017-02-09 22:53:47 +01:00
|
|
|
}
|
2001-08-28 18:22:14 +00:00
|
|
|
|
2017-02-09 22:53:47 +01:00
|
|
|
static PyObject*
|
|
|
|
|
call_unbound_noarg(int unbound, PyObject *func, PyObject *self)
|
|
|
|
|
{
|
|
|
|
|
if (unbound) {
|
2020-02-11 17:46:57 +01:00
|
|
|
return PyObject_CallOneArg(func, self);
|
2017-02-09 22:53:47 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2021-10-12 00:42:23 +02:00
|
|
|
return _PyObject_CallNoArgs(func);
|
2017-02-09 22:53:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
// Call the method with the name `attr` on `self`. Returns NULL with an
|
|
|
|
|
// exception set if the method is missing or an error occurs.
|
|
|
|
|
static PyObject *
|
|
|
|
|
call_method_noarg(PyObject *self, PyObject *attr)
|
|
|
|
|
{
|
|
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
|
|
|
|
_PyCStackRef cref;
|
|
|
|
|
_PyThreadState_PushCStackRef(tstate, &cref);
|
|
|
|
|
PyObject *res = NULL;
|
|
|
|
|
int unbound = lookup_method(self, attr, &cref.ref);
|
|
|
|
|
if (unbound >= 0) {
|
|
|
|
|
PyObject *func = PyStackRef_AsPyObjectBorrow(cref.ref);
|
|
|
|
|
res = call_unbound_noarg(unbound, func, self);
|
|
|
|
|
}
|
|
|
|
|
_PyThreadState_PopCStackRef(tstate, &cref);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
call_method(PyObject *self, PyObject *attr, PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
|
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
|
|
|
|
_PyCStackRef cref;
|
|
|
|
|
_PyThreadState_PushCStackRef(tstate, &cref);
|
|
|
|
|
PyObject *res = NULL;
|
|
|
|
|
int unbound = lookup_method(self, attr, &cref.ref);
|
|
|
|
|
if (unbound >= 0) {
|
|
|
|
|
PyObject *meth = PyStackRef_AsPyObjectBorrow(cref.ref);
|
|
|
|
|
if (unbound) {
|
|
|
|
|
res = _PyObject_Call_Prepend(tstate, meth, self, args, kwds);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
res = _PyObject_Call(tstate, meth, args, kwds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_PyThreadState_PopCStackRef(tstate, &cref);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-13 11:26:44 +02:00
|
|
|
/* A variation of PyObject_CallMethod* that uses lookup_method()
|
|
|
|
|
instead of PyObject_GetAttrString().
|
|
|
|
|
|
|
|
|
|
args is an argument vector of length nargs. The first element in this
|
|
|
|
|
vector is the special object "self" which is used for the method lookup */
|
2001-10-21 22:28:58 +00:00
|
|
|
static PyObject *
|
2022-02-08 13:39:07 -07:00
|
|
|
vectorcall_method(PyObject *name, PyObject *const *args, Py_ssize_t nargs)
|
2001-08-28 18:22:14 +00:00
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
assert(nargs >= 1);
|
2019-11-08 10:05:17 +01:00
|
|
|
|
|
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
2025-03-26 14:38:47 -04:00
|
|
|
PyObject *retval = NULL;
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *self = args[0];
|
2025-03-26 14:38:47 -04:00
|
|
|
_PyCStackRef cref;
|
|
|
|
|
_PyThreadState_PushCStackRef(tstate, &cref);
|
|
|
|
|
int unbound = lookup_method(self, name, &cref.ref);
|
|
|
|
|
if (unbound >= 0) {
|
|
|
|
|
PyObject *func = PyStackRef_AsPyObjectBorrow(cref.ref);
|
|
|
|
|
retval = vectorcall_unbound(tstate, unbound, func, args, nargs);
|
|
|
|
|
}
|
|
|
|
|
_PyThreadState_PopCStackRef(tstate, &cref);
|
2010-05-09 15:52:27 +00:00
|
|
|
return retval;
|
2001-09-14 17:51:50 +00:00
|
|
|
}
|
|
|
|
|
|
2019-06-13 11:26:44 +02:00
|
|
|
/* Clone of vectorcall_method() that returns NotImplemented
|
|
|
|
|
* when the lookup fails. */
|
2001-10-21 22:28:58 +00:00
|
|
|
static PyObject *
|
2022-02-08 13:39:07 -07:00
|
|
|
vectorcall_maybe(PyThreadState *tstate, PyObject *name,
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *const *args, Py_ssize_t nargs)
|
2001-09-14 17:51:50 +00:00
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
assert(nargs >= 1);
|
2019-11-08 10:05:17 +01:00
|
|
|
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *self = args[0];
|
2025-03-26 14:38:47 -04:00
|
|
|
_PyCStackRef cref;
|
|
|
|
|
_PyThreadState_PushCStackRef(tstate, &cref);
|
|
|
|
|
int unbound = lookup_maybe_method(self, name, &cref.ref);
|
|
|
|
|
PyObject *func = PyStackRef_AsPyObjectBorrow(cref.ref);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (func == NULL) {
|
2025-03-26 14:38:47 -04:00
|
|
|
_PyThreadState_PopCStackRef(tstate, &cref);
|
|
|
|
|
if (!PyErr_Occurred()) {
|
2011-08-10 20:28:54 -05:00
|
|
|
Py_RETURN_NOTIMPLEMENTED;
|
2025-03-26 14:38:47 -04:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2019-11-08 10:05:17 +01:00
|
|
|
PyObject *retval = vectorcall_unbound(tstate, unbound, func, args, nargs);
|
2025-03-26 14:38:47 -04:00
|
|
|
_PyThreadState_PopCStackRef(tstate, &cref);
|
2010-05-09 15:52:27 +00:00
|
|
|
return retval;
|
2001-08-28 18:22:14 +00:00
|
|
|
}
|
|
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
/* Call the method with the name `attr` on `self`. Returns NULL if the
|
|
|
|
|
method is missing or an error occurs. No exception is set if
|
|
|
|
|
the method is missing. If attr_is_none is not NULL, it is set to 1 if
|
|
|
|
|
the attribute was found and was None, or 0 if it was not found. */
|
|
|
|
|
static PyObject *
|
|
|
|
|
maybe_call_special_no_args(PyObject *self, PyObject *attr, int *attr_is_none)
|
|
|
|
|
{
|
|
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
|
|
|
|
_PyCStackRef cref;
|
|
|
|
|
_PyThreadState_PushCStackRef(tstate, &cref);
|
|
|
|
|
|
|
|
|
|
PyObject *res = NULL;
|
|
|
|
|
int unbound = lookup_maybe_method(self, attr, &cref.ref);
|
|
|
|
|
PyObject *func = PyStackRef_AsPyObjectBorrow(cref.ref);
|
|
|
|
|
if (attr_is_none != NULL) {
|
|
|
|
|
*attr_is_none = (func == Py_None);
|
|
|
|
|
}
|
|
|
|
|
if (func != NULL && (func != Py_None || attr_is_none == NULL)) {
|
|
|
|
|
res = call_unbound_noarg(unbound, func, self);
|
|
|
|
|
}
|
|
|
|
|
_PyThreadState_PopCStackRef(tstate, &cref);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
maybe_call_special_one_arg(PyObject *self, PyObject *attr, PyObject *arg,
|
|
|
|
|
int *attr_is_none)
|
|
|
|
|
{
|
|
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
|
|
|
|
_PyCStackRef cref;
|
|
|
|
|
_PyThreadState_PushCStackRef(tstate, &cref);
|
|
|
|
|
|
|
|
|
|
PyObject *res = NULL;
|
|
|
|
|
int unbound = lookup_maybe_method(self, attr, &cref.ref);
|
|
|
|
|
PyObject *func = PyStackRef_AsPyObjectBorrow(cref.ref);
|
|
|
|
|
if (attr_is_none != NULL) {
|
|
|
|
|
*attr_is_none = (func == Py_None);
|
|
|
|
|
}
|
|
|
|
|
if (func != NULL && (func != Py_None || attr_is_none == NULL)) {
|
|
|
|
|
PyObject *args[] = { self, arg };
|
|
|
|
|
res = vectorcall_unbound(tstate, unbound, func, args, 2);
|
|
|
|
|
}
|
|
|
|
|
_PyThreadState_PopCStackRef(tstate, &cref);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
_PyObject_MaybeCallSpecialNoArgs(PyObject *self, PyObject *attr)
|
|
|
|
|
{
|
|
|
|
|
return maybe_call_special_no_args(self, attr, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
_PyObject_MaybeCallSpecialOneArg(PyObject *self, PyObject *attr, PyObject *arg)
|
|
|
|
|
{
|
|
|
|
|
return maybe_call_special_one_arg(self, attr, arg, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-07 21:39:16 +00:00
|
|
|
/*
|
2002-11-14 19:49:16 +00:00
|
|
|
Method resolution order algorithm C3 described in
|
|
|
|
|
"A Monotonic Superclass Linearization for Dylan",
|
|
|
|
|
by Kim Barrett, Bob Cassel, Paul Haahr,
|
2002-12-07 21:39:16 +00:00
|
|
|
David A. Moon, Keith Playford, and P. Tucker Withington.
|
2002-11-14 19:49:16 +00:00
|
|
|
(OOPSLA 1996)
|
|
|
|
|
|
2002-11-25 21:36:54 +00:00
|
|
|
Some notes about the rules implied by C3:
|
|
|
|
|
|
2002-12-07 21:39:16 +00:00
|
|
|
No duplicate bases.
|
2002-11-25 21:36:54 +00:00
|
|
|
It isn't legal to repeat a class in a list of base classes.
|
|
|
|
|
|
|
|
|
|
The next three properties are the 3 constraints in "C3".
|
|
|
|
|
|
2016-08-04 13:07:31 +00:00
|
|
|
Local precedence order.
|
2002-11-25 21:36:54 +00:00
|
|
|
If A precedes B in C's MRO, then A will precede B in the MRO of all
|
|
|
|
|
subclasses of C.
|
|
|
|
|
|
|
|
|
|
Monotonicity.
|
|
|
|
|
The MRO of a class must be an extension without reordering of the
|
|
|
|
|
MRO of each of its superclasses.
|
|
|
|
|
|
|
|
|
|
Extended Precedence Graph (EPG).
|
|
|
|
|
Linearization is consistent if there is a path in the EPG from
|
|
|
|
|
each class to all its successors in the linearization. See
|
|
|
|
|
the paper for definition of EPG.
|
2002-11-14 19:49:16 +00:00
|
|
|
*/
|
|
|
|
|
|
2002-12-07 21:39:16 +00:00
|
|
|
static int
|
2025-01-10 04:32:53 +01:00
|
|
|
tail_contains(PyObject *tuple, Py_ssize_t whence, PyObject *o)
|
2017-12-20 19:21:02 +02:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_ssize_t j, size;
|
2017-12-20 19:21:02 +02:00
|
|
|
size = PyTuple_GET_SIZE(tuple);
|
2002-11-14 19:49:16 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
for (j = whence+1; j < size; j++) {
|
2017-12-20 19:21:02 +02:00
|
|
|
if (PyTuple_GET_ITEM(tuple, j) == o)
|
2010-05-09 15:52:27 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2002-11-14 19:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
2002-11-25 21:36:54 +00:00
|
|
|
static PyObject *
|
|
|
|
|
class_name(PyObject *cls)
|
|
|
|
|
{
|
2019-09-01 12:03:39 +03:00
|
|
|
PyObject *name;
|
2023-07-12 08:57:10 +03:00
|
|
|
if (PyObject_GetOptionalAttr(cls, &_Py_ID(__name__), &name) == 0) {
|
2010-05-09 15:52:27 +00:00
|
|
|
name = PyObject_Repr(cls);
|
|
|
|
|
}
|
|
|
|
|
return name;
|
2002-11-25 21:36:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2017-12-20 19:21:02 +02:00
|
|
|
check_duplicates(PyObject *tuple)
|
2002-11-25 21:36:54 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_ssize_t i, j, n;
|
|
|
|
|
/* Let's use a quadratic time algorithm,
|
2017-12-20 19:21:02 +02:00
|
|
|
assuming that the bases tuples is short.
|
2010-05-09 15:52:27 +00:00
|
|
|
*/
|
2017-12-20 19:21:02 +02:00
|
|
|
n = PyTuple_GET_SIZE(tuple);
|
2010-05-09 15:52:27 +00:00
|
|
|
for (i = 0; i < n; i++) {
|
2017-12-20 19:21:02 +02:00
|
|
|
PyObject *o = PyTuple_GET_ITEM(tuple, i);
|
2010-05-09 15:52:27 +00:00
|
|
|
for (j = i + 1; j < n; j++) {
|
2017-12-20 19:21:02 +02:00
|
|
|
if (PyTuple_GET_ITEM(tuple, j) == o) {
|
2010-05-09 15:52:27 +00:00
|
|
|
o = class_name(o);
|
|
|
|
|
if (o != NULL) {
|
2019-09-01 12:03:39 +03:00
|
|
|
if (PyUnicode_Check(o)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"duplicate base class %U", o);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"duplicate base class");
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(o);
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2002-11-25 21:36:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Raise a TypeError for an MRO order disagreement.
|
|
|
|
|
|
|
|
|
|
It's hard to produce a good error message. In the absence of better
|
|
|
|
|
insight into error reporting, report the classes that were candidates
|
2010-05-09 15:52:27 +00:00
|
|
|
to be put next into the MRO. There is some conflict between the
|
2002-11-25 21:36:54 +00:00
|
|
|
order in which they should be put in the MRO, but it's hard to
|
|
|
|
|
diagnose what constraint can't be satisfied.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static void
|
2025-01-10 04:32:53 +01:00
|
|
|
set_mro_error(PyObject **to_merge, Py_ssize_t to_merge_size, Py_ssize_t *remain)
|
2002-11-25 21:36:54 +00:00
|
|
|
{
|
2017-12-20 19:21:02 +02:00
|
|
|
Py_ssize_t i, n, off;
|
2010-05-09 15:52:27 +00:00
|
|
|
char buf[1000];
|
|
|
|
|
PyObject *k, *v;
|
|
|
|
|
PyObject *set = PyDict_New();
|
|
|
|
|
if (!set) return;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < to_merge_size; i++) {
|
2017-12-20 19:21:02 +02:00
|
|
|
PyObject *L = to_merge[i];
|
|
|
|
|
if (remain[i] < PyTuple_GET_SIZE(L)) {
|
|
|
|
|
PyObject *c = PyTuple_GET_ITEM(L, remain[i]);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (PyDict_SetItem(set, c, Py_None) < 0) {
|
|
|
|
|
Py_DECREF(set);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-12-16 16:18:57 +02:00
|
|
|
n = PyDict_GET_SIZE(set);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
off = PyOS_snprintf(buf, sizeof(buf), "Cannot create a \
|
2023-08-14 18:26:18 +09:00
|
|
|
consistent method resolution order (MRO) for bases");
|
2010-05-09 15:52:27 +00:00
|
|
|
i = 0;
|
|
|
|
|
while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) {
|
|
|
|
|
PyObject *name = class_name(k);
|
2019-09-01 12:03:39 +03:00
|
|
|
const char *name_str = NULL;
|
2010-05-19 01:42:46 +00:00
|
|
|
if (name != NULL) {
|
2019-09-01 12:03:39 +03:00
|
|
|
if (PyUnicode_Check(name)) {
|
|
|
|
|
name_str = PyUnicode_AsUTF8(name);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2010-05-19 01:50:45 +00:00
|
|
|
name_str = "?";
|
2019-09-01 12:03:39 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (name_str == NULL) {
|
|
|
|
|
Py_XDECREF(name);
|
|
|
|
|
Py_DECREF(set);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2010-05-19 01:42:46 +00:00
|
|
|
off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s", name_str);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_XDECREF(name);
|
|
|
|
|
if (--n && (size_t)(off+1) < sizeof(buf)) {
|
|
|
|
|
buf[off++] = ',';
|
|
|
|
|
buf[off] = '\0';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, buf);
|
|
|
|
|
Py_DECREF(set);
|
2002-11-25 21:36:54 +00:00
|
|
|
}
|
|
|
|
|
|
2002-12-07 21:39:16 +00:00
|
|
|
static int
|
2017-12-20 19:21:02 +02:00
|
|
|
pmerge(PyObject *acc, PyObject **to_merge, Py_ssize_t to_merge_size)
|
2015-02-05 22:29:14 -05:00
|
|
|
{
|
|
|
|
|
int res = 0;
|
2017-12-20 19:21:02 +02:00
|
|
|
Py_ssize_t i, j, empty_cnt;
|
2025-01-10 04:32:53 +01:00
|
|
|
Py_ssize_t *remain;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* remain stores an index into each sublist of to_merge.
|
|
|
|
|
remain[i] is the index of the next base in to_merge[i]
|
|
|
|
|
that is not included in acc.
|
|
|
|
|
*/
|
2025-01-10 04:32:53 +01:00
|
|
|
remain = PyMem_New(Py_ssize_t, to_merge_size);
|
2013-07-12 00:42:14 +02:00
|
|
|
if (remain == NULL) {
|
|
|
|
|
PyErr_NoMemory();
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2013-07-12 00:42:14 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
for (i = 0; i < to_merge_size; i++)
|
|
|
|
|
remain[i] = 0;
|
2002-11-14 19:49:16 +00:00
|
|
|
|
|
|
|
|
again:
|
2010-05-09 15:52:27 +00:00
|
|
|
empty_cnt = 0;
|
|
|
|
|
for (i = 0; i < to_merge_size; i++) {
|
|
|
|
|
PyObject *candidate;
|
|
|
|
|
|
2017-12-20 19:21:02 +02:00
|
|
|
PyObject *cur_tuple = to_merge[i];
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2017-12-20 19:21:02 +02:00
|
|
|
if (remain[i] >= PyTuple_GET_SIZE(cur_tuple)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
empty_cnt++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Choose next candidate for MRO.
|
|
|
|
|
|
|
|
|
|
The input sequences alone can determine the choice.
|
|
|
|
|
If not, choose the class which appears in the MRO
|
|
|
|
|
of the earliest direct superclass of the new class.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-12-20 19:21:02 +02:00
|
|
|
candidate = PyTuple_GET_ITEM(cur_tuple, remain[i]);
|
2010-05-09 15:52:27 +00:00
|
|
|
for (j = 0; j < to_merge_size; j++) {
|
2017-12-20 19:21:02 +02:00
|
|
|
PyObject *j_lst = to_merge[j];
|
2015-02-05 22:29:14 -05:00
|
|
|
if (tail_contains(j_lst, remain[j], candidate))
|
2010-05-09 15:52:27 +00:00
|
|
|
goto skip; /* continue outer loop */
|
|
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
res = PyList_Append(acc, candidate);
|
|
|
|
|
if (res < 0)
|
|
|
|
|
goto out;
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
for (j = 0; j < to_merge_size; j++) {
|
2017-12-20 19:21:02 +02:00
|
|
|
PyObject *j_lst = to_merge[j];
|
|
|
|
|
if (remain[j] < PyTuple_GET_SIZE(j_lst) &&
|
|
|
|
|
PyTuple_GET_ITEM(j_lst, remain[j]) == candidate) {
|
2010-05-09 15:52:27 +00:00
|
|
|
remain[j]++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
goto again;
|
|
|
|
|
skip: ;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
if (empty_cnt != to_merge_size) {
|
2017-12-20 19:21:02 +02:00
|
|
|
set_mro_error(to_merge, to_merge_size, remain);
|
2015-02-05 22:29:14 -05:00
|
|
|
res = -1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
|
|
|
|
|
out:
|
2020-12-01 09:56:42 +01:00
|
|
|
PyMem_Free(remain);
|
2015-02-05 22:29:14 -05:00
|
|
|
|
|
|
|
|
return res;
|
2002-11-14 19:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
2024-02-15 10:54:57 -08:00
|
|
|
mro_implementation_unlocked(PyTypeObject *type)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2024-02-15 10:54:57 -08:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
if (!_PyType_IsReady(type)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
if (PyType_Ready(type) < 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *bases = lookup_tp_bases(type);
|
2022-01-22 18:56:11 +01:00
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(bases);
|
|
|
|
|
for (Py_ssize_t i = 0; i < n; i++) {
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *base = _PyType_CAST(PyTuple_GET_ITEM(bases, i));
|
2023-05-01 20:34:43 -06:00
|
|
|
if (lookup_tp_mro(base) == NULL) {
|
2017-12-20 15:58:21 +01:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"Cannot extend an incomplete type '%.100s'",
|
|
|
|
|
base->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
assert(PyTuple_Check(lookup_tp_mro(base)));
|
2017-12-20 19:21:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (n == 1) {
|
|
|
|
|
/* Fast path: if there is a single base, constructing the MRO
|
|
|
|
|
* is trivial.
|
|
|
|
|
*/
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *base = _PyType_CAST(PyTuple_GET_ITEM(bases, 0));
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *base_mro = lookup_tp_mro(base);
|
|
|
|
|
Py_ssize_t k = PyTuple_GET_SIZE(base_mro);
|
2022-01-22 18:56:11 +01:00
|
|
|
PyObject *result = PyTuple_New(k + 1);
|
2017-12-20 15:58:21 +01:00
|
|
|
if (result == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
|
2022-11-10 23:40:31 +01:00
|
|
|
;
|
|
|
|
|
PyTuple_SET_ITEM(result, 0, Py_NewRef(type));
|
2022-01-22 18:56:11 +01:00
|
|
|
for (Py_ssize_t i = 0; i < k; i++) {
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *cls = PyTuple_GET_ITEM(base_mro, i);
|
2022-11-10 23:40:31 +01:00
|
|
|
PyTuple_SET_ITEM(result, i + 1, Py_NewRef(cls));
|
2017-12-20 15:58:21 +01:00
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-20 19:21:02 +02:00
|
|
|
/* This is just a basic sanity check. */
|
|
|
|
|
if (check_duplicates(bases) < 0) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Find a superclass linearization that honors the constraints
|
2017-12-20 19:21:02 +02:00
|
|
|
of the explicit tuples of bases and the constraints implied by
|
2010-05-09 15:52:27 +00:00
|
|
|
each base class.
|
|
|
|
|
|
2017-12-20 19:21:02 +02:00
|
|
|
to_merge is an array of tuples, where each tuple is a superclass
|
2010-05-09 15:52:27 +00:00
|
|
|
linearization implied by a base class. The last element of
|
2017-12-20 19:21:02 +02:00
|
|
|
to_merge is the declared tuple of bases.
|
2010-05-09 15:52:27 +00:00
|
|
|
*/
|
2022-01-22 18:56:11 +01:00
|
|
|
PyObject **to_merge = PyMem_New(PyObject *, n + 1);
|
2017-12-20 19:21:02 +02:00
|
|
|
if (to_merge == NULL) {
|
|
|
|
|
PyErr_NoMemory();
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
2017-12-20 19:21:02 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
for (Py_ssize_t i = 0; i < n; i++) {
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *base = _PyType_CAST(PyTuple_GET_ITEM(bases, i));
|
2023-05-01 20:34:43 -06:00
|
|
|
to_merge[i] = lookup_tp_mro(base);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2017-12-20 19:21:02 +02:00
|
|
|
to_merge[n] = bases;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
PyObject *result = PyList_New(1);
|
2017-12-20 19:21:02 +02:00
|
|
|
if (result == NULL) {
|
2020-12-01 09:56:42 +01:00
|
|
|
PyMem_Free(to_merge);
|
2017-12-20 19:21:02 +02:00
|
|
|
return NULL;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
|
2022-11-10 23:40:31 +01:00
|
|
|
PyList_SET_ITEM(result, 0, Py_NewRef(type));
|
2017-12-20 19:21:02 +02:00
|
|
|
if (pmerge(result, to_merge, n + 1) < 0) {
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_CLEAR(result);
|
2017-12-20 19:21:02 +02:00
|
|
|
}
|
2020-12-01 09:56:42 +01:00
|
|
|
PyMem_Free(to_merge);
|
2022-01-22 18:56:11 +01:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return result;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
static PyObject *
|
|
|
|
|
mro_implementation(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
PyObject *mro;
|
2024-06-21 15:50:18 -04:00
|
|
|
BEGIN_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
mro = mro_implementation_unlocked(type);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
return mro;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
type.mro
|
|
|
|
|
|
|
|
|
|
Return a type's method resolution order.
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
2017-03-19 08:46:44 +02:00
|
|
|
type_mro_impl(PyTypeObject *self)
|
|
|
|
|
/*[clinic end generated code: output=bffc4a39b5b57027 input=28414f4e156db28d]*/
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2017-12-20 15:58:21 +01:00
|
|
|
PyObject *seq;
|
|
|
|
|
seq = mro_implementation(self);
|
|
|
|
|
if (seq != NULL && !PyList_Check(seq)) {
|
|
|
|
|
Py_SETREF(seq, PySequence_List(seq));
|
|
|
|
|
}
|
|
|
|
|
return seq;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2015-02-05 22:29:14 -05:00
|
|
|
mro_check(PyTypeObject *type, PyObject *mro)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2015-02-05 22:29:14 -05:00
|
|
|
PyTypeObject *solid;
|
|
|
|
|
Py_ssize_t i, n;
|
|
|
|
|
|
|
|
|
|
solid = solid_base(type);
|
|
|
|
|
|
|
|
|
|
n = PyTuple_GET_SIZE(mro);
|
|
|
|
|
for (i = 0; i < n; i++) {
|
2022-01-21 21:39:01 +01:00
|
|
|
PyObject *obj = PyTuple_GET_ITEM(mro, i);
|
|
|
|
|
if (!PyType_Check(obj)) {
|
2015-02-05 22:29:14 -05:00
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_TypeError,
|
|
|
|
|
"mro() returned a non-class ('%.500s')",
|
2022-01-21 21:39:01 +01:00
|
|
|
Py_TYPE(obj)->tp_name);
|
2015-02-05 22:29:14 -05:00
|
|
|
return -1;
|
|
|
|
|
}
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *base = (PyTypeObject*)obj;
|
2015-02-05 22:29:14 -05:00
|
|
|
|
2024-03-15 12:35:29 -04:00
|
|
|
if (!is_subtype_with_mro(lookup_tp_mro(solid), solid, solid_base(base))) {
|
2015-02-05 22:29:14 -05:00
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_TypeError,
|
|
|
|
|
"mro() returned base with unsuitable layout ('%.500s')",
|
|
|
|
|
base->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Lookups an mcls.mro method, invokes it and checks the result (if needed,
|
|
|
|
|
in case of a custom mro() implementation).
|
|
|
|
|
|
|
|
|
|
Keep in mind that during execution of this function type->tp_mro
|
|
|
|
|
can be replaced due to possible reentrance (for example,
|
|
|
|
|
through type_set_bases):
|
|
|
|
|
|
|
|
|
|
- when looking up the mcls.mro attribute (it could be
|
|
|
|
|
a user-provided descriptor);
|
|
|
|
|
|
|
|
|
|
- from inside a custom mro() itself;
|
|
|
|
|
|
|
|
|
|
- through a finalizer of the return value of mro().
|
|
|
|
|
*/
|
|
|
|
|
static PyObject *
|
|
|
|
|
mro_invoke(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
PyObject *mro_result;
|
|
|
|
|
PyObject *new_mro;
|
2024-02-15 10:54:57 -08:00
|
|
|
|
|
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
2020-03-06 16:53:17 -06:00
|
|
|
const int custom = !Py_IS_TYPE(type, &PyType_Type);
|
2015-02-05 22:29:14 -05:00
|
|
|
|
|
|
|
|
if (custom) {
|
2025-03-26 14:38:47 -04:00
|
|
|
mro_result = call_method_noarg((PyObject *)type, &_Py_ID(mro));
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
else {
|
2024-02-15 10:54:57 -08:00
|
|
|
mro_result = mro_implementation_unlocked(type);
|
2015-02-05 22:29:14 -05:00
|
|
|
}
|
|
|
|
|
if (mro_result == NULL)
|
|
|
|
|
return NULL;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
new_mro = PySequence_Tuple(mro_result);
|
|
|
|
|
Py_DECREF(mro_result);
|
2021-04-22 00:10:16 +02:00
|
|
|
if (new_mro == NULL) {
|
2015-02-05 22:29:14 -05:00
|
|
|
return NULL;
|
2021-04-22 00:10:16 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-22 00:10:16 +02:00
|
|
|
if (PyTuple_GET_SIZE(new_mro) == 0) {
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_DECREF(new_mro);
|
2021-04-22 00:10:16 +02:00
|
|
|
PyErr_Format(PyExc_TypeError, "type MRO must not be empty");
|
2015-02-05 22:29:14 -05:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-22 00:10:16 +02:00
|
|
|
if (custom && mro_check(type, new_mro) < 0) {
|
|
|
|
|
Py_DECREF(new_mro);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
return new_mro;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Calculates and assigns a new MRO to type->tp_mro.
|
|
|
|
|
Return values and invariants:
|
|
|
|
|
|
|
|
|
|
- Returns 1 if a new MRO value has been set to type->tp_mro due to
|
|
|
|
|
this call of mro_internal (no tricky reentrancy and no errors).
|
|
|
|
|
|
|
|
|
|
In case if p_old_mro argument is not NULL, a previous value
|
|
|
|
|
of type->tp_mro is put there, and the ownership of this
|
|
|
|
|
reference is transferred to a caller.
|
|
|
|
|
Otherwise, the previous value (if any) is decref'ed.
|
|
|
|
|
|
|
|
|
|
- Returns 0 in case when type->tp_mro gets changed because of
|
|
|
|
|
reentering here through a custom mro() (see a comment to mro_invoke).
|
|
|
|
|
|
|
|
|
|
In this case, a refcount of an old type->tp_mro is adjusted
|
|
|
|
|
somewhere deeper in the call stack (by the innermost mro_internal
|
|
|
|
|
or its caller) and may become zero upon returning from here.
|
|
|
|
|
This also implies that the whole hierarchy of subclasses of the type
|
|
|
|
|
has seen the new value and updated their MRO accordingly.
|
|
|
|
|
|
|
|
|
|
- Returns -1 in case of an error.
|
|
|
|
|
*/
|
|
|
|
|
static int
|
2025-04-28 23:38:29 -07:00
|
|
|
mro_internal_unlocked(PyTypeObject *type, int initial, PyObject **p_old_mro)
|
2015-02-05 22:29:14 -05:00
|
|
|
{
|
2024-02-15 10:54:57 -08:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
PyObject *new_mro, *old_mro;
|
|
|
|
|
int reent;
|
|
|
|
|
|
|
|
|
|
/* Keep a reference to be able to do a reentrancy check below.
|
|
|
|
|
Don't let old_mro be GC'ed and its address be reused for
|
|
|
|
|
another object, like (suddenly!) a new tp_mro. */
|
2023-05-01 20:34:43 -06:00
|
|
|
old_mro = Py_XNewRef(lookup_tp_mro(type));
|
2015-02-05 22:29:14 -05:00
|
|
|
new_mro = mro_invoke(type); /* might cause reentrance */
|
2023-05-01 20:34:43 -06:00
|
|
|
reent = (lookup_tp_mro(type) != old_mro);
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_XDECREF(old_mro);
|
2021-04-22 00:10:16 +02:00
|
|
|
if (new_mro == NULL) {
|
2015-02-05 22:29:14 -05:00
|
|
|
return -1;
|
2021-04-22 00:10:16 +02:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
|
|
|
|
|
if (reent) {
|
|
|
|
|
Py_DECREF(new_mro);
|
|
|
|
|
return 0;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
set_tp_mro(type, new_mro, initial);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
type_mro_modified(type, new_mro);
|
2011-12-12 18:54:29 +01:00
|
|
|
/* corner case: the super class might have been hidden
|
2010-05-09 15:52:27 +00:00
|
|
|
from the custom MRO */
|
2023-05-01 20:34:43 -06:00
|
|
|
type_mro_modified(type, lookup_tp_bases(type));
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2023-04-24 16:30:13 -06:00
|
|
|
// XXX Expand this to Py_TPFLAGS_IMMUTABLETYPE?
|
|
|
|
|
if (!(type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
type_modified_unlocked(type);
|
2023-04-24 16:30:13 -06:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* For static builtin types, this is only called during init
|
|
|
|
|
before the method cache has been populated. */
|
2024-06-19 17:38:45 +01:00
|
|
|
assert(type->tp_version_tag);
|
2023-04-24 16:30:13 -06:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
if (p_old_mro != NULL)
|
|
|
|
|
*p_old_mro = old_mro; /* transfer the ownership */
|
|
|
|
|
else
|
|
|
|
|
Py_XDECREF(old_mro);
|
|
|
|
|
|
|
|
|
|
return 1;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2025-04-28 23:38:29 -07:00
|
|
|
static int
|
|
|
|
|
mro_internal(PyTypeObject *type, PyObject **p_old_mro)
|
|
|
|
|
{
|
|
|
|
|
int res;
|
|
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
res = mro_internal_unlocked(type, 0, p_old_mro);
|
|
|
|
|
END_TYPE_LOCK();
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
/* Calculate the best base amongst multiple base classes.
|
|
|
|
|
This is the first one that's on the path to the "solid base". */
|
|
|
|
|
|
|
|
|
|
static PyTypeObject *
|
2025-04-28 23:38:29 -07:00
|
|
|
best_base(PyObject *bases)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_ssize_t i, n;
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *base, *winner, *candidate;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
assert(PyTuple_Check(bases));
|
|
|
|
|
n = PyTuple_GET_SIZE(bases);
|
|
|
|
|
assert(n > 0);
|
|
|
|
|
base = NULL;
|
|
|
|
|
winner = NULL;
|
|
|
|
|
for (i = 0; i < n; i++) {
|
2022-01-21 21:39:01 +01:00
|
|
|
PyObject *base_proto = PyTuple_GET_ITEM(bases, i);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!PyType_Check(base_proto)) {
|
|
|
|
|
PyErr_SetString(
|
|
|
|
|
PyExc_TypeError,
|
|
|
|
|
"bases must be types");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *base_i = (PyTypeObject *)base_proto;
|
|
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
if (!_PyType_IsReady(base_i)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
if (PyType_Ready(base_i) < 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2020-04-08 01:42:27 +02:00
|
|
|
if (!_PyType_HasFeature(base_i, Py_TPFLAGS_BASETYPE)) {
|
2015-10-06 19:36:54 -07:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"type '%.100s' is not an acceptable base type",
|
|
|
|
|
base_i->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
candidate = solid_base(base_i);
|
|
|
|
|
if (winner == NULL) {
|
|
|
|
|
winner = candidate;
|
|
|
|
|
base = base_i;
|
|
|
|
|
}
|
|
|
|
|
else if (PyType_IsSubtype(winner, candidate))
|
|
|
|
|
;
|
|
|
|
|
else if (PyType_IsSubtype(candidate, winner)) {
|
|
|
|
|
winner = candidate;
|
|
|
|
|
base = base_i;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PyErr_SetString(
|
|
|
|
|
PyExc_TypeError,
|
|
|
|
|
"multiple bases have "
|
|
|
|
|
"instance lay-out conflict");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-12-12 18:54:29 +01:00
|
|
|
assert (base != NULL);
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return base;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2022-08-17 12:50:53 +01:00
|
|
|
shape_differs(PyTypeObject *t1, PyTypeObject *t2)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2022-08-17 12:50:53 +01:00
|
|
|
return (
|
|
|
|
|
t1->tp_basicsize != t2->tp_basicsize ||
|
|
|
|
|
t1->tp_itemsize != t2->tp_itemsize
|
|
|
|
|
);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyTypeObject *
|
|
|
|
|
solid_base(PyTypeObject *type)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *base;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2022-08-17 12:50:53 +01:00
|
|
|
if (type->tp_base) {
|
2010-05-09 15:52:27 +00:00
|
|
|
base = solid_base(type->tp_base);
|
2022-08-17 12:50:53 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2010-05-09 15:52:27 +00:00
|
|
|
base = &PyBaseObject_Type;
|
2022-08-17 12:50:53 +01:00
|
|
|
}
|
|
|
|
|
if (shape_differs(type, base)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return type;
|
2022-08-17 12:50:53 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2010-05-09 15:52:27 +00:00
|
|
|
return base;
|
2022-08-17 12:50:53 +01:00
|
|
|
}
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2002-07-17 16:30:39 +00:00
|
|
|
static void object_dealloc(PyObject *);
|
2021-10-13 14:19:34 +01:00
|
|
|
static PyObject *object_new(PyTypeObject *, PyObject *, PyObject *);
|
2002-07-17 16:30:39 +00:00
|
|
|
static int object_init(PyObject *, PyObject *, PyObject *);
|
|
|
|
|
static int update_slot(PyTypeObject *, PyObject *);
|
|
|
|
|
static void fixup_slot_dispatchers(PyTypeObject *);
|
2021-04-10 23:15:32 +02:00
|
|
|
static int type_new_set_names(PyTypeObject *);
|
|
|
|
|
static int type_new_init_subclass(PyTypeObject *, PyObject *);
|
2001-08-02 04:15:00 +00:00
|
|
|
|
Merged revisions 55325-55327 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55326 | guido.van.rossum | 2007-05-14 15:07:35 -0700 (Mon, 14 May 2007) | 2 lines
Don't use err.message, use err.args[0].
................
r55327 | guido.van.rossum | 2007-05-14 15:11:37 -0700 (Mon, 14 May 2007) | 259 lines
Merged revisions 54988-55226,55228-55323 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r54995 | neal.norwitz | 2007-04-26 23:45:32 -0700 (Thu, 26 Apr 2007) | 3 lines
This gets the test working on Solaris. It seems a little hokey to me,
but the test passed on Linux and Solaris, hopefully other platforms too.
........
r55002 | georg.brandl | 2007-04-27 12:20:00 -0700 (Fri, 27 Apr 2007) | 2 lines
Version fix (bug #1708710)
........
r55021 | neal.norwitz | 2007-04-29 16:53:24 -0700 (Sun, 29 Apr 2007) | 1 line
There really are some tests that are problematic.
........
r55024 | kristjan.jonsson | 2007-04-30 08:17:46 -0700 (Mon, 30 Apr 2007) | 1 line
Complete revamp of PCBuild8 directory. Use subdirectories for each project under the main pcbuild solution. Now make extensive use of property sheets to simplify project configuration. x64 build fully supported, and the process for building PGO version (Profiler Guided Optimization) simplified. All projects are now present, except _ssl, which needs to be reimplemented. Also, some of the projects that require external libraries need extra work to fully compile on x64.
........
r55025 | thomas.heller | 2007-04-30 08:44:17 -0700 (Mon, 30 Apr 2007) | 4 lines
Make sure to call PyErr_NoMemory() in several places where
PyMem_Malloc() could potentially fail.
Will backport to the release25-maint branch.
........
r55027 | thomas.heller | 2007-04-30 09:04:57 -0700 (Mon, 30 Apr 2007) | 8 lines
When accessing the .value attribute of a c_wchar_p instance, and the
instance does not point to a valid wchar_t zero-terminated string,
raise a ValueError. c_char_p does this already.
The ValueError message now contains the correct pointer address.
Will backport to release25-maint.
........
r55036 | georg.brandl | 2007-04-30 23:04:11 -0700 (Mon, 30 Apr 2007) | 2 lines
Bug #1710295: exceptions are now new-style classes.
........
r55038 | georg.brandl | 2007-04-30 23:08:15 -0700 (Mon, 30 Apr 2007) | 2 lines
Patch #1710352: add missing public functions to locale.__all__.
........
r55041 | vinay.sajip | 2007-05-01 03:20:03 -0700 (Tue, 01 May 2007) | 1 line
Added new optional credentials argument to SMTPHandler.__init__, and smtp.login() is now called in SMTPHandler.emit() if credentials are specified.
........
r55042 | vinay.sajip | 2007-05-01 03:21:45 -0700 (Tue, 01 May 2007) | 1 line
Added documentation for new optional credentials argument to SMTPHandler.__init__().
........
r55070 | neal.norwitz | 2007-05-01 21:47:55 -0700 (Tue, 01 May 2007) | 3 lines
Stop using PyMem_FREE while the GIL is not held. For details see:
http://mail.python.org/pipermail/python-dev/2007-May/072896.html
........
r55080 | armin.rigo | 2007-05-02 12:23:31 -0700 (Wed, 02 May 2007) | 6 lines
Fix for #1303614 and #1174712:
- __dict__ descriptor abuse for subclasses of built-in types
- subclassing from both ModuleType and another built-in types
Thanks zseil for the patch.
........
r55083 | georg.brandl | 2007-05-02 13:02:29 -0700 (Wed, 02 May 2007) | 3 lines
Actually raise an exception before calling ast_error_finish.
Triggers an assertion otherwise.
........
r55087 | neal.norwitz | 2007-05-02 23:47:18 -0700 (Wed, 02 May 2007) | 1 line
Handle a couple of uncaught errors. This should be backported
........
r55090 | neal.norwitz | 2007-05-03 00:20:57 -0700 (Thu, 03 May 2007) | 4 lines
Remove dead code. This code couldn't be reached because earlier in
the function there is another check for z != Py_None.
........
r55092 | thomas.heller | 2007-05-03 05:02:08 -0700 (Thu, 03 May 2007) | 1 line
Fix building _ctypes.pyd for x64 / Windows.
........
r55093 | thomas.heller | 2007-05-03 05:05:20 -0700 (Thu, 03 May 2007) | 1 line
Don't truncate pointers to integers (on win64 platform).
........
r55094 | walter.doerwald | 2007-05-03 08:13:55 -0700 (Thu, 03 May 2007) | 3 lines
Clarify the behaviour of PyUnicode_DecodeUTF16(): A BOM is only skipped
in native order mode, and only if it's the first two bytes.
........
r55101 | kristjan.jonsson | 2007-05-03 13:04:53 -0700 (Thu, 03 May 2007) | 2 lines
Fix pcbuild8 after recent overhaul: Added the version resource to python26.dll. Adjust stacksize to 2Mb and made large address aware for 32 bits, and set stacksize to 3Mb for 64 bits.
Todo: Set .dll optimized load addresses, and side-by-side packaging of the python26.dll.
........
r55102 | kristjan.jonsson | 2007-05-03 13:09:56 -0700 (Thu, 03 May 2007) | 1 line
Fix those parts in the testsuite that assumed that sys.maxint would cause overflow on x64. Now the testsuite is well behaved on that platform.
........
r55103 | kristjan.jonsson | 2007-05-03 13:27:03 -0700 (Thu, 03 May 2007) | 11 lines
Fix problems in x64 build that were discovered by the testsuite:
- Reenable modules on x64 that had been disabled aeons ago for Itanium.
- Cleared up confusion about compilers for 64 bit windows. There is only Itanium and x64. Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above.
- Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms.
- Fixed thread_nt.h. The emulated InterlockedCompareExchange function didn?\194?\180t work on x64, probaby due to the lack of a "volatile" specifier. Anyway, win95 is no longer a target platform.
- Itertools module used wrong constant to check for overflow in count()
- PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member.
- PyLong_FromSsize_t() incorrectly specified that the operand were unsigned.
With these changes, the x64 passes the testsuite, for those modules present.
........
r55107 | kristjan.jonsson | 2007-05-03 17:25:08 -0700 (Thu, 03 May 2007) | 1 line
Revert compiler comment to AMD64 for x64/AMD64 builds.
........
r55115 | thomas.heller | 2007-05-04 00:14:39 -0700 (Fri, 04 May 2007) | 4 lines
Fix some ctypes test crashes, when running with a debug Python
version on win64 by using proper argtypes and restype function
attributes.
........
r55117 | thomas.heller | 2007-05-04 01:20:41 -0700 (Fri, 04 May 2007) | 4 lines
On 64-bit Windows, ffi_arg must be 8 bytes long. This fixes the
remaining crashes in the ctypes tests, when functions return float or
double types.
........
r55120 | kristjan.jonsson | 2007-05-04 08:48:15 -0700 (Fri, 04 May 2007) | 1 line
Update the pcbuild8 solution. Straightened out the _ctypes project by using a .vsproj file and a masm64.rules file to avoid redundancy
........
r55121 | kristjan.jonsson | 2007-05-04 10:28:06 -0700 (Fri, 04 May 2007) | 1 line
Minor fix of PCBuild8/_ctypes vcproj, moving include dir into the .vsprops file.
........
r55129 | thomas.heller | 2007-05-04 12:54:22 -0700 (Fri, 04 May 2007) | 3 lines
Do not truncate 64-bit pointers to 32-bit integers.
Fixes SF #1703286, will backport to release25-maint.
........
r55131 | thomas.heller | 2007-05-04 12:56:32 -0700 (Fri, 04 May 2007) | 1 line
Oops, these tests do not run on Windows CE.
........
r55140 | brett.cannon | 2007-05-04 18:34:02 -0700 (Fri, 04 May 2007) | 2 lines
Deprecate BaseException.message as per PEP 352.
........
r55154 | georg.brandl | 2007-05-05 11:55:37 -0700 (Sat, 05 May 2007) | 2 lines
Bug #1713535: typo in logging example.
........
r55158 | vinay.sajip | 2007-05-06 10:53:37 -0700 (Sun, 06 May 2007) | 1 line
Updates of recent changes to logging.
........
r55165 | neal.norwitz | 2007-05-07 00:02:26 -0700 (Mon, 07 May 2007) | 1 line
Verify changes to the trunk go to the normal checkins list
........
r55169 | kristjan.jonsson | 2007-05-07 09:46:54 -0700 (Mon, 07 May 2007) | 1 line
As per Armin Rigo's suggestion, remove special handing from intobject.c to deal with the peculiarities of classobject's implementation of the number protocol. The nb_long method of classobject now falls back to nb_int if there is no __long__ attribute present.
........
r55197 | collin.winter | 2007-05-08 21:14:36 -0700 (Tue, 08 May 2007) | 9 lines
Fix a bug in test.test_support.open_urlresource().
If the call to requires() doesn't precede the filesystem check, we get the following situation:
1. ./python Lib/test/regrtest.py test_foo # test needs urlfetch, not enabled, so skipped
2. ./python Lib/test/regrtest.py -u urlfetch test_foo # test runs
3. ./python Lib/test/regrtest.py test_foo # test runs (!)
By moving the call to requires() *before* the filesystem check, the fact that fetched files are cached on the local disk becomes an implementation detail, rather than a semantics-changing point of note.
........
r55198 | neal.norwitz | 2007-05-08 23:43:15 -0700 (Tue, 08 May 2007) | 1 line
Add markup for True/False. Will backport
........
r55205 | walter.doerwald | 2007-05-09 11:10:47 -0700 (Wed, 09 May 2007) | 4 lines
Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr()
instead of memchr().
........
r55241 | neal.norwitz | 2007-05-10 22:55:15 -0700 (Thu, 10 May 2007) | 6 lines
Don't ever report a failure when the sum of the reference count differences
are zero. This should help reduce the false positives.
The message about references leaking is maintained to provide as much
info as possible rather than simply suppressing the message at the source.
........
r55242 | neal.norwitz | 2007-05-10 23:23:01 -0700 (Thu, 10 May 2007) | 1 line
Fix typo in docstring (the module is popen2, not 3).
........
r55244 | neal.norwitz | 2007-05-10 23:56:52 -0700 (Thu, 10 May 2007) | 1 line
Remove trailing whitespace in docstring
........
r55245 | neal.norwitz | 2007-05-10 23:57:33 -0700 (Thu, 10 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module.
........
r55247 | neal.norwitz | 2007-05-11 00:13:30 -0700 (Fri, 11 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module. (forgot the doc)
........
r55253 | georg.brandl | 2007-05-11 02:41:37 -0700 (Fri, 11 May 2007) | 3 lines
Remove an XXX that is unnecessary.
........
r55258 | georg.brandl | 2007-05-11 04:04:26 -0700 (Fri, 11 May 2007) | 2 lines
Patch #1714700: clarify os.linesep vs. tfiles opened in text mode.
(backport)
........
r55259 | georg.brandl | 2007-05-11 04:43:56 -0700 (Fri, 11 May 2007) | 2 lines
Update DDJ link.
........
r55273 | raymond.hettinger | 2007-05-11 10:59:59 -0700 (Fri, 11 May 2007) | 1 line
Better tests for posixpath.commonprefix
........
r55287 | georg.brandl | 2007-05-12 14:06:41 -0700 (Sat, 12 May 2007) | 2 lines
Bug #1046945: document SWIG options of distutils.
........
r55290 | georg.brandl | 2007-05-13 01:04:07 -0700 (Sun, 13 May 2007) | 2 lines
Add bz2 to content encodings.
........
r55297 | neal.norwitz | 2007-05-13 13:45:05 -0700 (Sun, 13 May 2007) | 3 lines
Remove Amoeba doc which was removed in version 1.0! according to Misc/HISTORY.
Hopefully Guido won't shed a tear. :-)
........
r55298 | neal.norwitz | 2007-05-13 13:54:19 -0700 (Sun, 13 May 2007) | 1 line
Remove references to stdwin which was removed long ago.
........
r55299 | neal.norwitz | 2007-05-13 14:13:42 -0700 (Sun, 13 May 2007) | 3 lines
Remove support for freebsd[23] which haven't been released since 2000
or earlier. http://www.freebsd.org/releases/index.html
........
r55320 | raymond.hettinger | 2007-05-14 13:52:31 -0700 (Mon, 14 May 2007) | 1 line
Small speedup.
........
................
2007-05-14 22:51:27 +00:00
|
|
|
/*
|
|
|
|
|
* Helpers for __dict__ descriptor. We don't want to expose the dicts
|
|
|
|
|
* inherited from various builtin types. The builtin base usually provides
|
|
|
|
|
* its own __dict__ descriptor, so we use that when we can.
|
|
|
|
|
*/
|
|
|
|
|
static PyTypeObject *
|
|
|
|
|
get_builtin_base_with_dict(PyTypeObject *type)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
while (type->tp_base != NULL) {
|
|
|
|
|
if (type->tp_dictoffset != 0 &&
|
|
|
|
|
!(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
|
|
|
|
|
return type;
|
|
|
|
|
type = type->tp_base;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
Merged revisions 55325-55327 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55326 | guido.van.rossum | 2007-05-14 15:07:35 -0700 (Mon, 14 May 2007) | 2 lines
Don't use err.message, use err.args[0].
................
r55327 | guido.van.rossum | 2007-05-14 15:11:37 -0700 (Mon, 14 May 2007) | 259 lines
Merged revisions 54988-55226,55228-55323 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r54995 | neal.norwitz | 2007-04-26 23:45:32 -0700 (Thu, 26 Apr 2007) | 3 lines
This gets the test working on Solaris. It seems a little hokey to me,
but the test passed on Linux and Solaris, hopefully other platforms too.
........
r55002 | georg.brandl | 2007-04-27 12:20:00 -0700 (Fri, 27 Apr 2007) | 2 lines
Version fix (bug #1708710)
........
r55021 | neal.norwitz | 2007-04-29 16:53:24 -0700 (Sun, 29 Apr 2007) | 1 line
There really are some tests that are problematic.
........
r55024 | kristjan.jonsson | 2007-04-30 08:17:46 -0700 (Mon, 30 Apr 2007) | 1 line
Complete revamp of PCBuild8 directory. Use subdirectories for each project under the main pcbuild solution. Now make extensive use of property sheets to simplify project configuration. x64 build fully supported, and the process for building PGO version (Profiler Guided Optimization) simplified. All projects are now present, except _ssl, which needs to be reimplemented. Also, some of the projects that require external libraries need extra work to fully compile on x64.
........
r55025 | thomas.heller | 2007-04-30 08:44:17 -0700 (Mon, 30 Apr 2007) | 4 lines
Make sure to call PyErr_NoMemory() in several places where
PyMem_Malloc() could potentially fail.
Will backport to the release25-maint branch.
........
r55027 | thomas.heller | 2007-04-30 09:04:57 -0700 (Mon, 30 Apr 2007) | 8 lines
When accessing the .value attribute of a c_wchar_p instance, and the
instance does not point to a valid wchar_t zero-terminated string,
raise a ValueError. c_char_p does this already.
The ValueError message now contains the correct pointer address.
Will backport to release25-maint.
........
r55036 | georg.brandl | 2007-04-30 23:04:11 -0700 (Mon, 30 Apr 2007) | 2 lines
Bug #1710295: exceptions are now new-style classes.
........
r55038 | georg.brandl | 2007-04-30 23:08:15 -0700 (Mon, 30 Apr 2007) | 2 lines
Patch #1710352: add missing public functions to locale.__all__.
........
r55041 | vinay.sajip | 2007-05-01 03:20:03 -0700 (Tue, 01 May 2007) | 1 line
Added new optional credentials argument to SMTPHandler.__init__, and smtp.login() is now called in SMTPHandler.emit() if credentials are specified.
........
r55042 | vinay.sajip | 2007-05-01 03:21:45 -0700 (Tue, 01 May 2007) | 1 line
Added documentation for new optional credentials argument to SMTPHandler.__init__().
........
r55070 | neal.norwitz | 2007-05-01 21:47:55 -0700 (Tue, 01 May 2007) | 3 lines
Stop using PyMem_FREE while the GIL is not held. For details see:
http://mail.python.org/pipermail/python-dev/2007-May/072896.html
........
r55080 | armin.rigo | 2007-05-02 12:23:31 -0700 (Wed, 02 May 2007) | 6 lines
Fix for #1303614 and #1174712:
- __dict__ descriptor abuse for subclasses of built-in types
- subclassing from both ModuleType and another built-in types
Thanks zseil for the patch.
........
r55083 | georg.brandl | 2007-05-02 13:02:29 -0700 (Wed, 02 May 2007) | 3 lines
Actually raise an exception before calling ast_error_finish.
Triggers an assertion otherwise.
........
r55087 | neal.norwitz | 2007-05-02 23:47:18 -0700 (Wed, 02 May 2007) | 1 line
Handle a couple of uncaught errors. This should be backported
........
r55090 | neal.norwitz | 2007-05-03 00:20:57 -0700 (Thu, 03 May 2007) | 4 lines
Remove dead code. This code couldn't be reached because earlier in
the function there is another check for z != Py_None.
........
r55092 | thomas.heller | 2007-05-03 05:02:08 -0700 (Thu, 03 May 2007) | 1 line
Fix building _ctypes.pyd for x64 / Windows.
........
r55093 | thomas.heller | 2007-05-03 05:05:20 -0700 (Thu, 03 May 2007) | 1 line
Don't truncate pointers to integers (on win64 platform).
........
r55094 | walter.doerwald | 2007-05-03 08:13:55 -0700 (Thu, 03 May 2007) | 3 lines
Clarify the behaviour of PyUnicode_DecodeUTF16(): A BOM is only skipped
in native order mode, and only if it's the first two bytes.
........
r55101 | kristjan.jonsson | 2007-05-03 13:04:53 -0700 (Thu, 03 May 2007) | 2 lines
Fix pcbuild8 after recent overhaul: Added the version resource to python26.dll. Adjust stacksize to 2Mb and made large address aware for 32 bits, and set stacksize to 3Mb for 64 bits.
Todo: Set .dll optimized load addresses, and side-by-side packaging of the python26.dll.
........
r55102 | kristjan.jonsson | 2007-05-03 13:09:56 -0700 (Thu, 03 May 2007) | 1 line
Fix those parts in the testsuite that assumed that sys.maxint would cause overflow on x64. Now the testsuite is well behaved on that platform.
........
r55103 | kristjan.jonsson | 2007-05-03 13:27:03 -0700 (Thu, 03 May 2007) | 11 lines
Fix problems in x64 build that were discovered by the testsuite:
- Reenable modules on x64 that had been disabled aeons ago for Itanium.
- Cleared up confusion about compilers for 64 bit windows. There is only Itanium and x64. Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above.
- Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms.
- Fixed thread_nt.h. The emulated InterlockedCompareExchange function didn?\194?\180t work on x64, probaby due to the lack of a "volatile" specifier. Anyway, win95 is no longer a target platform.
- Itertools module used wrong constant to check for overflow in count()
- PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member.
- PyLong_FromSsize_t() incorrectly specified that the operand were unsigned.
With these changes, the x64 passes the testsuite, for those modules present.
........
r55107 | kristjan.jonsson | 2007-05-03 17:25:08 -0700 (Thu, 03 May 2007) | 1 line
Revert compiler comment to AMD64 for x64/AMD64 builds.
........
r55115 | thomas.heller | 2007-05-04 00:14:39 -0700 (Fri, 04 May 2007) | 4 lines
Fix some ctypes test crashes, when running with a debug Python
version on win64 by using proper argtypes and restype function
attributes.
........
r55117 | thomas.heller | 2007-05-04 01:20:41 -0700 (Fri, 04 May 2007) | 4 lines
On 64-bit Windows, ffi_arg must be 8 bytes long. This fixes the
remaining crashes in the ctypes tests, when functions return float or
double types.
........
r55120 | kristjan.jonsson | 2007-05-04 08:48:15 -0700 (Fri, 04 May 2007) | 1 line
Update the pcbuild8 solution. Straightened out the _ctypes project by using a .vsproj file and a masm64.rules file to avoid redundancy
........
r55121 | kristjan.jonsson | 2007-05-04 10:28:06 -0700 (Fri, 04 May 2007) | 1 line
Minor fix of PCBuild8/_ctypes vcproj, moving include dir into the .vsprops file.
........
r55129 | thomas.heller | 2007-05-04 12:54:22 -0700 (Fri, 04 May 2007) | 3 lines
Do not truncate 64-bit pointers to 32-bit integers.
Fixes SF #1703286, will backport to release25-maint.
........
r55131 | thomas.heller | 2007-05-04 12:56:32 -0700 (Fri, 04 May 2007) | 1 line
Oops, these tests do not run on Windows CE.
........
r55140 | brett.cannon | 2007-05-04 18:34:02 -0700 (Fri, 04 May 2007) | 2 lines
Deprecate BaseException.message as per PEP 352.
........
r55154 | georg.brandl | 2007-05-05 11:55:37 -0700 (Sat, 05 May 2007) | 2 lines
Bug #1713535: typo in logging example.
........
r55158 | vinay.sajip | 2007-05-06 10:53:37 -0700 (Sun, 06 May 2007) | 1 line
Updates of recent changes to logging.
........
r55165 | neal.norwitz | 2007-05-07 00:02:26 -0700 (Mon, 07 May 2007) | 1 line
Verify changes to the trunk go to the normal checkins list
........
r55169 | kristjan.jonsson | 2007-05-07 09:46:54 -0700 (Mon, 07 May 2007) | 1 line
As per Armin Rigo's suggestion, remove special handing from intobject.c to deal with the peculiarities of classobject's implementation of the number protocol. The nb_long method of classobject now falls back to nb_int if there is no __long__ attribute present.
........
r55197 | collin.winter | 2007-05-08 21:14:36 -0700 (Tue, 08 May 2007) | 9 lines
Fix a bug in test.test_support.open_urlresource().
If the call to requires() doesn't precede the filesystem check, we get the following situation:
1. ./python Lib/test/regrtest.py test_foo # test needs urlfetch, not enabled, so skipped
2. ./python Lib/test/regrtest.py -u urlfetch test_foo # test runs
3. ./python Lib/test/regrtest.py test_foo # test runs (!)
By moving the call to requires() *before* the filesystem check, the fact that fetched files are cached on the local disk becomes an implementation detail, rather than a semantics-changing point of note.
........
r55198 | neal.norwitz | 2007-05-08 23:43:15 -0700 (Tue, 08 May 2007) | 1 line
Add markup for True/False. Will backport
........
r55205 | walter.doerwald | 2007-05-09 11:10:47 -0700 (Wed, 09 May 2007) | 4 lines
Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr()
instead of memchr().
........
r55241 | neal.norwitz | 2007-05-10 22:55:15 -0700 (Thu, 10 May 2007) | 6 lines
Don't ever report a failure when the sum of the reference count differences
are zero. This should help reduce the false positives.
The message about references leaking is maintained to provide as much
info as possible rather than simply suppressing the message at the source.
........
r55242 | neal.norwitz | 2007-05-10 23:23:01 -0700 (Thu, 10 May 2007) | 1 line
Fix typo in docstring (the module is popen2, not 3).
........
r55244 | neal.norwitz | 2007-05-10 23:56:52 -0700 (Thu, 10 May 2007) | 1 line
Remove trailing whitespace in docstring
........
r55245 | neal.norwitz | 2007-05-10 23:57:33 -0700 (Thu, 10 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module.
........
r55247 | neal.norwitz | 2007-05-11 00:13:30 -0700 (Fri, 11 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module. (forgot the doc)
........
r55253 | georg.brandl | 2007-05-11 02:41:37 -0700 (Fri, 11 May 2007) | 3 lines
Remove an XXX that is unnecessary.
........
r55258 | georg.brandl | 2007-05-11 04:04:26 -0700 (Fri, 11 May 2007) | 2 lines
Patch #1714700: clarify os.linesep vs. tfiles opened in text mode.
(backport)
........
r55259 | georg.brandl | 2007-05-11 04:43:56 -0700 (Fri, 11 May 2007) | 2 lines
Update DDJ link.
........
r55273 | raymond.hettinger | 2007-05-11 10:59:59 -0700 (Fri, 11 May 2007) | 1 line
Better tests for posixpath.commonprefix
........
r55287 | georg.brandl | 2007-05-12 14:06:41 -0700 (Sat, 12 May 2007) | 2 lines
Bug #1046945: document SWIG options of distutils.
........
r55290 | georg.brandl | 2007-05-13 01:04:07 -0700 (Sun, 13 May 2007) | 2 lines
Add bz2 to content encodings.
........
r55297 | neal.norwitz | 2007-05-13 13:45:05 -0700 (Sun, 13 May 2007) | 3 lines
Remove Amoeba doc which was removed in version 1.0! according to Misc/HISTORY.
Hopefully Guido won't shed a tear. :-)
........
r55298 | neal.norwitz | 2007-05-13 13:54:19 -0700 (Sun, 13 May 2007) | 1 line
Remove references to stdwin which was removed long ago.
........
r55299 | neal.norwitz | 2007-05-13 14:13:42 -0700 (Sun, 13 May 2007) | 3 lines
Remove support for freebsd[23] which haven't been released since 2000
or earlier. http://www.freebsd.org/releases/index.html
........
r55320 | raymond.hettinger | 2007-05-14 13:52:31 -0700 (Mon, 14 May 2007) | 1 line
Small speedup.
........
................
2007-05-14 22:51:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
get_dict_descriptor(PyTypeObject *type)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *descr;
|
Merged revisions 55325-55327 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55326 | guido.van.rossum | 2007-05-14 15:07:35 -0700 (Mon, 14 May 2007) | 2 lines
Don't use err.message, use err.args[0].
................
r55327 | guido.van.rossum | 2007-05-14 15:11:37 -0700 (Mon, 14 May 2007) | 259 lines
Merged revisions 54988-55226,55228-55323 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r54995 | neal.norwitz | 2007-04-26 23:45:32 -0700 (Thu, 26 Apr 2007) | 3 lines
This gets the test working on Solaris. It seems a little hokey to me,
but the test passed on Linux and Solaris, hopefully other platforms too.
........
r55002 | georg.brandl | 2007-04-27 12:20:00 -0700 (Fri, 27 Apr 2007) | 2 lines
Version fix (bug #1708710)
........
r55021 | neal.norwitz | 2007-04-29 16:53:24 -0700 (Sun, 29 Apr 2007) | 1 line
There really are some tests that are problematic.
........
r55024 | kristjan.jonsson | 2007-04-30 08:17:46 -0700 (Mon, 30 Apr 2007) | 1 line
Complete revamp of PCBuild8 directory. Use subdirectories for each project under the main pcbuild solution. Now make extensive use of property sheets to simplify project configuration. x64 build fully supported, and the process for building PGO version (Profiler Guided Optimization) simplified. All projects are now present, except _ssl, which needs to be reimplemented. Also, some of the projects that require external libraries need extra work to fully compile on x64.
........
r55025 | thomas.heller | 2007-04-30 08:44:17 -0700 (Mon, 30 Apr 2007) | 4 lines
Make sure to call PyErr_NoMemory() in several places where
PyMem_Malloc() could potentially fail.
Will backport to the release25-maint branch.
........
r55027 | thomas.heller | 2007-04-30 09:04:57 -0700 (Mon, 30 Apr 2007) | 8 lines
When accessing the .value attribute of a c_wchar_p instance, and the
instance does not point to a valid wchar_t zero-terminated string,
raise a ValueError. c_char_p does this already.
The ValueError message now contains the correct pointer address.
Will backport to release25-maint.
........
r55036 | georg.brandl | 2007-04-30 23:04:11 -0700 (Mon, 30 Apr 2007) | 2 lines
Bug #1710295: exceptions are now new-style classes.
........
r55038 | georg.brandl | 2007-04-30 23:08:15 -0700 (Mon, 30 Apr 2007) | 2 lines
Patch #1710352: add missing public functions to locale.__all__.
........
r55041 | vinay.sajip | 2007-05-01 03:20:03 -0700 (Tue, 01 May 2007) | 1 line
Added new optional credentials argument to SMTPHandler.__init__, and smtp.login() is now called in SMTPHandler.emit() if credentials are specified.
........
r55042 | vinay.sajip | 2007-05-01 03:21:45 -0700 (Tue, 01 May 2007) | 1 line
Added documentation for new optional credentials argument to SMTPHandler.__init__().
........
r55070 | neal.norwitz | 2007-05-01 21:47:55 -0700 (Tue, 01 May 2007) | 3 lines
Stop using PyMem_FREE while the GIL is not held. For details see:
http://mail.python.org/pipermail/python-dev/2007-May/072896.html
........
r55080 | armin.rigo | 2007-05-02 12:23:31 -0700 (Wed, 02 May 2007) | 6 lines
Fix for #1303614 and #1174712:
- __dict__ descriptor abuse for subclasses of built-in types
- subclassing from both ModuleType and another built-in types
Thanks zseil for the patch.
........
r55083 | georg.brandl | 2007-05-02 13:02:29 -0700 (Wed, 02 May 2007) | 3 lines
Actually raise an exception before calling ast_error_finish.
Triggers an assertion otherwise.
........
r55087 | neal.norwitz | 2007-05-02 23:47:18 -0700 (Wed, 02 May 2007) | 1 line
Handle a couple of uncaught errors. This should be backported
........
r55090 | neal.norwitz | 2007-05-03 00:20:57 -0700 (Thu, 03 May 2007) | 4 lines
Remove dead code. This code couldn't be reached because earlier in
the function there is another check for z != Py_None.
........
r55092 | thomas.heller | 2007-05-03 05:02:08 -0700 (Thu, 03 May 2007) | 1 line
Fix building _ctypes.pyd for x64 / Windows.
........
r55093 | thomas.heller | 2007-05-03 05:05:20 -0700 (Thu, 03 May 2007) | 1 line
Don't truncate pointers to integers (on win64 platform).
........
r55094 | walter.doerwald | 2007-05-03 08:13:55 -0700 (Thu, 03 May 2007) | 3 lines
Clarify the behaviour of PyUnicode_DecodeUTF16(): A BOM is only skipped
in native order mode, and only if it's the first two bytes.
........
r55101 | kristjan.jonsson | 2007-05-03 13:04:53 -0700 (Thu, 03 May 2007) | 2 lines
Fix pcbuild8 after recent overhaul: Added the version resource to python26.dll. Adjust stacksize to 2Mb and made large address aware for 32 bits, and set stacksize to 3Mb for 64 bits.
Todo: Set .dll optimized load addresses, and side-by-side packaging of the python26.dll.
........
r55102 | kristjan.jonsson | 2007-05-03 13:09:56 -0700 (Thu, 03 May 2007) | 1 line
Fix those parts in the testsuite that assumed that sys.maxint would cause overflow on x64. Now the testsuite is well behaved on that platform.
........
r55103 | kristjan.jonsson | 2007-05-03 13:27:03 -0700 (Thu, 03 May 2007) | 11 lines
Fix problems in x64 build that were discovered by the testsuite:
- Reenable modules on x64 that had been disabled aeons ago for Itanium.
- Cleared up confusion about compilers for 64 bit windows. There is only Itanium and x64. Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above.
- Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms.
- Fixed thread_nt.h. The emulated InterlockedCompareExchange function didn?\194?\180t work on x64, probaby due to the lack of a "volatile" specifier. Anyway, win95 is no longer a target platform.
- Itertools module used wrong constant to check for overflow in count()
- PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member.
- PyLong_FromSsize_t() incorrectly specified that the operand were unsigned.
With these changes, the x64 passes the testsuite, for those modules present.
........
r55107 | kristjan.jonsson | 2007-05-03 17:25:08 -0700 (Thu, 03 May 2007) | 1 line
Revert compiler comment to AMD64 for x64/AMD64 builds.
........
r55115 | thomas.heller | 2007-05-04 00:14:39 -0700 (Fri, 04 May 2007) | 4 lines
Fix some ctypes test crashes, when running with a debug Python
version on win64 by using proper argtypes and restype function
attributes.
........
r55117 | thomas.heller | 2007-05-04 01:20:41 -0700 (Fri, 04 May 2007) | 4 lines
On 64-bit Windows, ffi_arg must be 8 bytes long. This fixes the
remaining crashes in the ctypes tests, when functions return float or
double types.
........
r55120 | kristjan.jonsson | 2007-05-04 08:48:15 -0700 (Fri, 04 May 2007) | 1 line
Update the pcbuild8 solution. Straightened out the _ctypes project by using a .vsproj file and a masm64.rules file to avoid redundancy
........
r55121 | kristjan.jonsson | 2007-05-04 10:28:06 -0700 (Fri, 04 May 2007) | 1 line
Minor fix of PCBuild8/_ctypes vcproj, moving include dir into the .vsprops file.
........
r55129 | thomas.heller | 2007-05-04 12:54:22 -0700 (Fri, 04 May 2007) | 3 lines
Do not truncate 64-bit pointers to 32-bit integers.
Fixes SF #1703286, will backport to release25-maint.
........
r55131 | thomas.heller | 2007-05-04 12:56:32 -0700 (Fri, 04 May 2007) | 1 line
Oops, these tests do not run on Windows CE.
........
r55140 | brett.cannon | 2007-05-04 18:34:02 -0700 (Fri, 04 May 2007) | 2 lines
Deprecate BaseException.message as per PEP 352.
........
r55154 | georg.brandl | 2007-05-05 11:55:37 -0700 (Sat, 05 May 2007) | 2 lines
Bug #1713535: typo in logging example.
........
r55158 | vinay.sajip | 2007-05-06 10:53:37 -0700 (Sun, 06 May 2007) | 1 line
Updates of recent changes to logging.
........
r55165 | neal.norwitz | 2007-05-07 00:02:26 -0700 (Mon, 07 May 2007) | 1 line
Verify changes to the trunk go to the normal checkins list
........
r55169 | kristjan.jonsson | 2007-05-07 09:46:54 -0700 (Mon, 07 May 2007) | 1 line
As per Armin Rigo's suggestion, remove special handing from intobject.c to deal with the peculiarities of classobject's implementation of the number protocol. The nb_long method of classobject now falls back to nb_int if there is no __long__ attribute present.
........
r55197 | collin.winter | 2007-05-08 21:14:36 -0700 (Tue, 08 May 2007) | 9 lines
Fix a bug in test.test_support.open_urlresource().
If the call to requires() doesn't precede the filesystem check, we get the following situation:
1. ./python Lib/test/regrtest.py test_foo # test needs urlfetch, not enabled, so skipped
2. ./python Lib/test/regrtest.py -u urlfetch test_foo # test runs
3. ./python Lib/test/regrtest.py test_foo # test runs (!)
By moving the call to requires() *before* the filesystem check, the fact that fetched files are cached on the local disk becomes an implementation detail, rather than a semantics-changing point of note.
........
r55198 | neal.norwitz | 2007-05-08 23:43:15 -0700 (Tue, 08 May 2007) | 1 line
Add markup for True/False. Will backport
........
r55205 | walter.doerwald | 2007-05-09 11:10:47 -0700 (Wed, 09 May 2007) | 4 lines
Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr()
instead of memchr().
........
r55241 | neal.norwitz | 2007-05-10 22:55:15 -0700 (Thu, 10 May 2007) | 6 lines
Don't ever report a failure when the sum of the reference count differences
are zero. This should help reduce the false positives.
The message about references leaking is maintained to provide as much
info as possible rather than simply suppressing the message at the source.
........
r55242 | neal.norwitz | 2007-05-10 23:23:01 -0700 (Thu, 10 May 2007) | 1 line
Fix typo in docstring (the module is popen2, not 3).
........
r55244 | neal.norwitz | 2007-05-10 23:56:52 -0700 (Thu, 10 May 2007) | 1 line
Remove trailing whitespace in docstring
........
r55245 | neal.norwitz | 2007-05-10 23:57:33 -0700 (Thu, 10 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module.
........
r55247 | neal.norwitz | 2007-05-11 00:13:30 -0700 (Fri, 11 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module. (forgot the doc)
........
r55253 | georg.brandl | 2007-05-11 02:41:37 -0700 (Fri, 11 May 2007) | 3 lines
Remove an XXX that is unnecessary.
........
r55258 | georg.brandl | 2007-05-11 04:04:26 -0700 (Fri, 11 May 2007) | 2 lines
Patch #1714700: clarify os.linesep vs. tfiles opened in text mode.
(backport)
........
r55259 | georg.brandl | 2007-05-11 04:43:56 -0700 (Fri, 11 May 2007) | 2 lines
Update DDJ link.
........
r55273 | raymond.hettinger | 2007-05-11 10:59:59 -0700 (Fri, 11 May 2007) | 1 line
Better tests for posixpath.commonprefix
........
r55287 | georg.brandl | 2007-05-12 14:06:41 -0700 (Sat, 12 May 2007) | 2 lines
Bug #1046945: document SWIG options of distutils.
........
r55290 | georg.brandl | 2007-05-13 01:04:07 -0700 (Sun, 13 May 2007) | 2 lines
Add bz2 to content encodings.
........
r55297 | neal.norwitz | 2007-05-13 13:45:05 -0700 (Sun, 13 May 2007) | 3 lines
Remove Amoeba doc which was removed in version 1.0! according to Misc/HISTORY.
Hopefully Guido won't shed a tear. :-)
........
r55298 | neal.norwitz | 2007-05-13 13:54:19 -0700 (Sun, 13 May 2007) | 1 line
Remove references to stdwin which was removed long ago.
........
r55299 | neal.norwitz | 2007-05-13 14:13:42 -0700 (Sun, 13 May 2007) | 3 lines
Remove support for freebsd[23] which haven't been released since 2000
or earlier. http://www.freebsd.org/releases/index.html
........
r55320 | raymond.hettinger | 2007-05-14 13:52:31 -0700 (Mon, 14 May 2007) | 1 line
Small speedup.
........
................
2007-05-14 22:51:27 +00:00
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
descr = _PyType_Lookup(type, &_Py_ID(__dict__));
|
2010-05-09 15:52:27 +00:00
|
|
|
if (descr == NULL || !PyDescr_IsData(descr))
|
|
|
|
|
return NULL;
|
Merged revisions 55325-55327 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55326 | guido.van.rossum | 2007-05-14 15:07:35 -0700 (Mon, 14 May 2007) | 2 lines
Don't use err.message, use err.args[0].
................
r55327 | guido.van.rossum | 2007-05-14 15:11:37 -0700 (Mon, 14 May 2007) | 259 lines
Merged revisions 54988-55226,55228-55323 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r54995 | neal.norwitz | 2007-04-26 23:45:32 -0700 (Thu, 26 Apr 2007) | 3 lines
This gets the test working on Solaris. It seems a little hokey to me,
but the test passed on Linux and Solaris, hopefully other platforms too.
........
r55002 | georg.brandl | 2007-04-27 12:20:00 -0700 (Fri, 27 Apr 2007) | 2 lines
Version fix (bug #1708710)
........
r55021 | neal.norwitz | 2007-04-29 16:53:24 -0700 (Sun, 29 Apr 2007) | 1 line
There really are some tests that are problematic.
........
r55024 | kristjan.jonsson | 2007-04-30 08:17:46 -0700 (Mon, 30 Apr 2007) | 1 line
Complete revamp of PCBuild8 directory. Use subdirectories for each project under the main pcbuild solution. Now make extensive use of property sheets to simplify project configuration. x64 build fully supported, and the process for building PGO version (Profiler Guided Optimization) simplified. All projects are now present, except _ssl, which needs to be reimplemented. Also, some of the projects that require external libraries need extra work to fully compile on x64.
........
r55025 | thomas.heller | 2007-04-30 08:44:17 -0700 (Mon, 30 Apr 2007) | 4 lines
Make sure to call PyErr_NoMemory() in several places where
PyMem_Malloc() could potentially fail.
Will backport to the release25-maint branch.
........
r55027 | thomas.heller | 2007-04-30 09:04:57 -0700 (Mon, 30 Apr 2007) | 8 lines
When accessing the .value attribute of a c_wchar_p instance, and the
instance does not point to a valid wchar_t zero-terminated string,
raise a ValueError. c_char_p does this already.
The ValueError message now contains the correct pointer address.
Will backport to release25-maint.
........
r55036 | georg.brandl | 2007-04-30 23:04:11 -0700 (Mon, 30 Apr 2007) | 2 lines
Bug #1710295: exceptions are now new-style classes.
........
r55038 | georg.brandl | 2007-04-30 23:08:15 -0700 (Mon, 30 Apr 2007) | 2 lines
Patch #1710352: add missing public functions to locale.__all__.
........
r55041 | vinay.sajip | 2007-05-01 03:20:03 -0700 (Tue, 01 May 2007) | 1 line
Added new optional credentials argument to SMTPHandler.__init__, and smtp.login() is now called in SMTPHandler.emit() if credentials are specified.
........
r55042 | vinay.sajip | 2007-05-01 03:21:45 -0700 (Tue, 01 May 2007) | 1 line
Added documentation for new optional credentials argument to SMTPHandler.__init__().
........
r55070 | neal.norwitz | 2007-05-01 21:47:55 -0700 (Tue, 01 May 2007) | 3 lines
Stop using PyMem_FREE while the GIL is not held. For details see:
http://mail.python.org/pipermail/python-dev/2007-May/072896.html
........
r55080 | armin.rigo | 2007-05-02 12:23:31 -0700 (Wed, 02 May 2007) | 6 lines
Fix for #1303614 and #1174712:
- __dict__ descriptor abuse for subclasses of built-in types
- subclassing from both ModuleType and another built-in types
Thanks zseil for the patch.
........
r55083 | georg.brandl | 2007-05-02 13:02:29 -0700 (Wed, 02 May 2007) | 3 lines
Actually raise an exception before calling ast_error_finish.
Triggers an assertion otherwise.
........
r55087 | neal.norwitz | 2007-05-02 23:47:18 -0700 (Wed, 02 May 2007) | 1 line
Handle a couple of uncaught errors. This should be backported
........
r55090 | neal.norwitz | 2007-05-03 00:20:57 -0700 (Thu, 03 May 2007) | 4 lines
Remove dead code. This code couldn't be reached because earlier in
the function there is another check for z != Py_None.
........
r55092 | thomas.heller | 2007-05-03 05:02:08 -0700 (Thu, 03 May 2007) | 1 line
Fix building _ctypes.pyd for x64 / Windows.
........
r55093 | thomas.heller | 2007-05-03 05:05:20 -0700 (Thu, 03 May 2007) | 1 line
Don't truncate pointers to integers (on win64 platform).
........
r55094 | walter.doerwald | 2007-05-03 08:13:55 -0700 (Thu, 03 May 2007) | 3 lines
Clarify the behaviour of PyUnicode_DecodeUTF16(): A BOM is only skipped
in native order mode, and only if it's the first two bytes.
........
r55101 | kristjan.jonsson | 2007-05-03 13:04:53 -0700 (Thu, 03 May 2007) | 2 lines
Fix pcbuild8 after recent overhaul: Added the version resource to python26.dll. Adjust stacksize to 2Mb and made large address aware for 32 bits, and set stacksize to 3Mb for 64 bits.
Todo: Set .dll optimized load addresses, and side-by-side packaging of the python26.dll.
........
r55102 | kristjan.jonsson | 2007-05-03 13:09:56 -0700 (Thu, 03 May 2007) | 1 line
Fix those parts in the testsuite that assumed that sys.maxint would cause overflow on x64. Now the testsuite is well behaved on that platform.
........
r55103 | kristjan.jonsson | 2007-05-03 13:27:03 -0700 (Thu, 03 May 2007) | 11 lines
Fix problems in x64 build that were discovered by the testsuite:
- Reenable modules on x64 that had been disabled aeons ago for Itanium.
- Cleared up confusion about compilers for 64 bit windows. There is only Itanium and x64. Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above.
- Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms.
- Fixed thread_nt.h. The emulated InterlockedCompareExchange function didn?\194?\180t work on x64, probaby due to the lack of a "volatile" specifier. Anyway, win95 is no longer a target platform.
- Itertools module used wrong constant to check for overflow in count()
- PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member.
- PyLong_FromSsize_t() incorrectly specified that the operand were unsigned.
With these changes, the x64 passes the testsuite, for those modules present.
........
r55107 | kristjan.jonsson | 2007-05-03 17:25:08 -0700 (Thu, 03 May 2007) | 1 line
Revert compiler comment to AMD64 for x64/AMD64 builds.
........
r55115 | thomas.heller | 2007-05-04 00:14:39 -0700 (Fri, 04 May 2007) | 4 lines
Fix some ctypes test crashes, when running with a debug Python
version on win64 by using proper argtypes and restype function
attributes.
........
r55117 | thomas.heller | 2007-05-04 01:20:41 -0700 (Fri, 04 May 2007) | 4 lines
On 64-bit Windows, ffi_arg must be 8 bytes long. This fixes the
remaining crashes in the ctypes tests, when functions return float or
double types.
........
r55120 | kristjan.jonsson | 2007-05-04 08:48:15 -0700 (Fri, 04 May 2007) | 1 line
Update the pcbuild8 solution. Straightened out the _ctypes project by using a .vsproj file and a masm64.rules file to avoid redundancy
........
r55121 | kristjan.jonsson | 2007-05-04 10:28:06 -0700 (Fri, 04 May 2007) | 1 line
Minor fix of PCBuild8/_ctypes vcproj, moving include dir into the .vsprops file.
........
r55129 | thomas.heller | 2007-05-04 12:54:22 -0700 (Fri, 04 May 2007) | 3 lines
Do not truncate 64-bit pointers to 32-bit integers.
Fixes SF #1703286, will backport to release25-maint.
........
r55131 | thomas.heller | 2007-05-04 12:56:32 -0700 (Fri, 04 May 2007) | 1 line
Oops, these tests do not run on Windows CE.
........
r55140 | brett.cannon | 2007-05-04 18:34:02 -0700 (Fri, 04 May 2007) | 2 lines
Deprecate BaseException.message as per PEP 352.
........
r55154 | georg.brandl | 2007-05-05 11:55:37 -0700 (Sat, 05 May 2007) | 2 lines
Bug #1713535: typo in logging example.
........
r55158 | vinay.sajip | 2007-05-06 10:53:37 -0700 (Sun, 06 May 2007) | 1 line
Updates of recent changes to logging.
........
r55165 | neal.norwitz | 2007-05-07 00:02:26 -0700 (Mon, 07 May 2007) | 1 line
Verify changes to the trunk go to the normal checkins list
........
r55169 | kristjan.jonsson | 2007-05-07 09:46:54 -0700 (Mon, 07 May 2007) | 1 line
As per Armin Rigo's suggestion, remove special handing from intobject.c to deal with the peculiarities of classobject's implementation of the number protocol. The nb_long method of classobject now falls back to nb_int if there is no __long__ attribute present.
........
r55197 | collin.winter | 2007-05-08 21:14:36 -0700 (Tue, 08 May 2007) | 9 lines
Fix a bug in test.test_support.open_urlresource().
If the call to requires() doesn't precede the filesystem check, we get the following situation:
1. ./python Lib/test/regrtest.py test_foo # test needs urlfetch, not enabled, so skipped
2. ./python Lib/test/regrtest.py -u urlfetch test_foo # test runs
3. ./python Lib/test/regrtest.py test_foo # test runs (!)
By moving the call to requires() *before* the filesystem check, the fact that fetched files are cached on the local disk becomes an implementation detail, rather than a semantics-changing point of note.
........
r55198 | neal.norwitz | 2007-05-08 23:43:15 -0700 (Tue, 08 May 2007) | 1 line
Add markup for True/False. Will backport
........
r55205 | walter.doerwald | 2007-05-09 11:10:47 -0700 (Wed, 09 May 2007) | 4 lines
Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr()
instead of memchr().
........
r55241 | neal.norwitz | 2007-05-10 22:55:15 -0700 (Thu, 10 May 2007) | 6 lines
Don't ever report a failure when the sum of the reference count differences
are zero. This should help reduce the false positives.
The message about references leaking is maintained to provide as much
info as possible rather than simply suppressing the message at the source.
........
r55242 | neal.norwitz | 2007-05-10 23:23:01 -0700 (Thu, 10 May 2007) | 1 line
Fix typo in docstring (the module is popen2, not 3).
........
r55244 | neal.norwitz | 2007-05-10 23:56:52 -0700 (Thu, 10 May 2007) | 1 line
Remove trailing whitespace in docstring
........
r55245 | neal.norwitz | 2007-05-10 23:57:33 -0700 (Thu, 10 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module.
........
r55247 | neal.norwitz | 2007-05-11 00:13:30 -0700 (Fri, 11 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module. (forgot the doc)
........
r55253 | georg.brandl | 2007-05-11 02:41:37 -0700 (Fri, 11 May 2007) | 3 lines
Remove an XXX that is unnecessary.
........
r55258 | georg.brandl | 2007-05-11 04:04:26 -0700 (Fri, 11 May 2007) | 2 lines
Patch #1714700: clarify os.linesep vs. tfiles opened in text mode.
(backport)
........
r55259 | georg.brandl | 2007-05-11 04:43:56 -0700 (Fri, 11 May 2007) | 2 lines
Update DDJ link.
........
r55273 | raymond.hettinger | 2007-05-11 10:59:59 -0700 (Fri, 11 May 2007) | 1 line
Better tests for posixpath.commonprefix
........
r55287 | georg.brandl | 2007-05-12 14:06:41 -0700 (Sat, 12 May 2007) | 2 lines
Bug #1046945: document SWIG options of distutils.
........
r55290 | georg.brandl | 2007-05-13 01:04:07 -0700 (Sun, 13 May 2007) | 2 lines
Add bz2 to content encodings.
........
r55297 | neal.norwitz | 2007-05-13 13:45:05 -0700 (Sun, 13 May 2007) | 3 lines
Remove Amoeba doc which was removed in version 1.0! according to Misc/HISTORY.
Hopefully Guido won't shed a tear. :-)
........
r55298 | neal.norwitz | 2007-05-13 13:54:19 -0700 (Sun, 13 May 2007) | 1 line
Remove references to stdwin which was removed long ago.
........
r55299 | neal.norwitz | 2007-05-13 14:13:42 -0700 (Sun, 13 May 2007) | 3 lines
Remove support for freebsd[23] which haven't been released since 2000
or earlier. http://www.freebsd.org/releases/index.html
........
r55320 | raymond.hettinger | 2007-05-14 13:52:31 -0700 (Mon, 14 May 2007) | 1 line
Small speedup.
........
................
2007-05-14 22:51:27 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return descr;
|
Merged revisions 55325-55327 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55326 | guido.van.rossum | 2007-05-14 15:07:35 -0700 (Mon, 14 May 2007) | 2 lines
Don't use err.message, use err.args[0].
................
r55327 | guido.van.rossum | 2007-05-14 15:11:37 -0700 (Mon, 14 May 2007) | 259 lines
Merged revisions 54988-55226,55228-55323 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r54995 | neal.norwitz | 2007-04-26 23:45:32 -0700 (Thu, 26 Apr 2007) | 3 lines
This gets the test working on Solaris. It seems a little hokey to me,
but the test passed on Linux and Solaris, hopefully other platforms too.
........
r55002 | georg.brandl | 2007-04-27 12:20:00 -0700 (Fri, 27 Apr 2007) | 2 lines
Version fix (bug #1708710)
........
r55021 | neal.norwitz | 2007-04-29 16:53:24 -0700 (Sun, 29 Apr 2007) | 1 line
There really are some tests that are problematic.
........
r55024 | kristjan.jonsson | 2007-04-30 08:17:46 -0700 (Mon, 30 Apr 2007) | 1 line
Complete revamp of PCBuild8 directory. Use subdirectories for each project under the main pcbuild solution. Now make extensive use of property sheets to simplify project configuration. x64 build fully supported, and the process for building PGO version (Profiler Guided Optimization) simplified. All projects are now present, except _ssl, which needs to be reimplemented. Also, some of the projects that require external libraries need extra work to fully compile on x64.
........
r55025 | thomas.heller | 2007-04-30 08:44:17 -0700 (Mon, 30 Apr 2007) | 4 lines
Make sure to call PyErr_NoMemory() in several places where
PyMem_Malloc() could potentially fail.
Will backport to the release25-maint branch.
........
r55027 | thomas.heller | 2007-04-30 09:04:57 -0700 (Mon, 30 Apr 2007) | 8 lines
When accessing the .value attribute of a c_wchar_p instance, and the
instance does not point to a valid wchar_t zero-terminated string,
raise a ValueError. c_char_p does this already.
The ValueError message now contains the correct pointer address.
Will backport to release25-maint.
........
r55036 | georg.brandl | 2007-04-30 23:04:11 -0700 (Mon, 30 Apr 2007) | 2 lines
Bug #1710295: exceptions are now new-style classes.
........
r55038 | georg.brandl | 2007-04-30 23:08:15 -0700 (Mon, 30 Apr 2007) | 2 lines
Patch #1710352: add missing public functions to locale.__all__.
........
r55041 | vinay.sajip | 2007-05-01 03:20:03 -0700 (Tue, 01 May 2007) | 1 line
Added new optional credentials argument to SMTPHandler.__init__, and smtp.login() is now called in SMTPHandler.emit() if credentials are specified.
........
r55042 | vinay.sajip | 2007-05-01 03:21:45 -0700 (Tue, 01 May 2007) | 1 line
Added documentation for new optional credentials argument to SMTPHandler.__init__().
........
r55070 | neal.norwitz | 2007-05-01 21:47:55 -0700 (Tue, 01 May 2007) | 3 lines
Stop using PyMem_FREE while the GIL is not held. For details see:
http://mail.python.org/pipermail/python-dev/2007-May/072896.html
........
r55080 | armin.rigo | 2007-05-02 12:23:31 -0700 (Wed, 02 May 2007) | 6 lines
Fix for #1303614 and #1174712:
- __dict__ descriptor abuse for subclasses of built-in types
- subclassing from both ModuleType and another built-in types
Thanks zseil for the patch.
........
r55083 | georg.brandl | 2007-05-02 13:02:29 -0700 (Wed, 02 May 2007) | 3 lines
Actually raise an exception before calling ast_error_finish.
Triggers an assertion otherwise.
........
r55087 | neal.norwitz | 2007-05-02 23:47:18 -0700 (Wed, 02 May 2007) | 1 line
Handle a couple of uncaught errors. This should be backported
........
r55090 | neal.norwitz | 2007-05-03 00:20:57 -0700 (Thu, 03 May 2007) | 4 lines
Remove dead code. This code couldn't be reached because earlier in
the function there is another check for z != Py_None.
........
r55092 | thomas.heller | 2007-05-03 05:02:08 -0700 (Thu, 03 May 2007) | 1 line
Fix building _ctypes.pyd for x64 / Windows.
........
r55093 | thomas.heller | 2007-05-03 05:05:20 -0700 (Thu, 03 May 2007) | 1 line
Don't truncate pointers to integers (on win64 platform).
........
r55094 | walter.doerwald | 2007-05-03 08:13:55 -0700 (Thu, 03 May 2007) | 3 lines
Clarify the behaviour of PyUnicode_DecodeUTF16(): A BOM is only skipped
in native order mode, and only if it's the first two bytes.
........
r55101 | kristjan.jonsson | 2007-05-03 13:04:53 -0700 (Thu, 03 May 2007) | 2 lines
Fix pcbuild8 after recent overhaul: Added the version resource to python26.dll. Adjust stacksize to 2Mb and made large address aware for 32 bits, and set stacksize to 3Mb for 64 bits.
Todo: Set .dll optimized load addresses, and side-by-side packaging of the python26.dll.
........
r55102 | kristjan.jonsson | 2007-05-03 13:09:56 -0700 (Thu, 03 May 2007) | 1 line
Fix those parts in the testsuite that assumed that sys.maxint would cause overflow on x64. Now the testsuite is well behaved on that platform.
........
r55103 | kristjan.jonsson | 2007-05-03 13:27:03 -0700 (Thu, 03 May 2007) | 11 lines
Fix problems in x64 build that were discovered by the testsuite:
- Reenable modules on x64 that had been disabled aeons ago for Itanium.
- Cleared up confusion about compilers for 64 bit windows. There is only Itanium and x64. Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above.
- Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms.
- Fixed thread_nt.h. The emulated InterlockedCompareExchange function didn?\194?\180t work on x64, probaby due to the lack of a "volatile" specifier. Anyway, win95 is no longer a target platform.
- Itertools module used wrong constant to check for overflow in count()
- PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member.
- PyLong_FromSsize_t() incorrectly specified that the operand were unsigned.
With these changes, the x64 passes the testsuite, for those modules present.
........
r55107 | kristjan.jonsson | 2007-05-03 17:25:08 -0700 (Thu, 03 May 2007) | 1 line
Revert compiler comment to AMD64 for x64/AMD64 builds.
........
r55115 | thomas.heller | 2007-05-04 00:14:39 -0700 (Fri, 04 May 2007) | 4 lines
Fix some ctypes test crashes, when running with a debug Python
version on win64 by using proper argtypes and restype function
attributes.
........
r55117 | thomas.heller | 2007-05-04 01:20:41 -0700 (Fri, 04 May 2007) | 4 lines
On 64-bit Windows, ffi_arg must be 8 bytes long. This fixes the
remaining crashes in the ctypes tests, when functions return float or
double types.
........
r55120 | kristjan.jonsson | 2007-05-04 08:48:15 -0700 (Fri, 04 May 2007) | 1 line
Update the pcbuild8 solution. Straightened out the _ctypes project by using a .vsproj file and a masm64.rules file to avoid redundancy
........
r55121 | kristjan.jonsson | 2007-05-04 10:28:06 -0700 (Fri, 04 May 2007) | 1 line
Minor fix of PCBuild8/_ctypes vcproj, moving include dir into the .vsprops file.
........
r55129 | thomas.heller | 2007-05-04 12:54:22 -0700 (Fri, 04 May 2007) | 3 lines
Do not truncate 64-bit pointers to 32-bit integers.
Fixes SF #1703286, will backport to release25-maint.
........
r55131 | thomas.heller | 2007-05-04 12:56:32 -0700 (Fri, 04 May 2007) | 1 line
Oops, these tests do not run on Windows CE.
........
r55140 | brett.cannon | 2007-05-04 18:34:02 -0700 (Fri, 04 May 2007) | 2 lines
Deprecate BaseException.message as per PEP 352.
........
r55154 | georg.brandl | 2007-05-05 11:55:37 -0700 (Sat, 05 May 2007) | 2 lines
Bug #1713535: typo in logging example.
........
r55158 | vinay.sajip | 2007-05-06 10:53:37 -0700 (Sun, 06 May 2007) | 1 line
Updates of recent changes to logging.
........
r55165 | neal.norwitz | 2007-05-07 00:02:26 -0700 (Mon, 07 May 2007) | 1 line
Verify changes to the trunk go to the normal checkins list
........
r55169 | kristjan.jonsson | 2007-05-07 09:46:54 -0700 (Mon, 07 May 2007) | 1 line
As per Armin Rigo's suggestion, remove special handing from intobject.c to deal with the peculiarities of classobject's implementation of the number protocol. The nb_long method of classobject now falls back to nb_int if there is no __long__ attribute present.
........
r55197 | collin.winter | 2007-05-08 21:14:36 -0700 (Tue, 08 May 2007) | 9 lines
Fix a bug in test.test_support.open_urlresource().
If the call to requires() doesn't precede the filesystem check, we get the following situation:
1. ./python Lib/test/regrtest.py test_foo # test needs urlfetch, not enabled, so skipped
2. ./python Lib/test/regrtest.py -u urlfetch test_foo # test runs
3. ./python Lib/test/regrtest.py test_foo # test runs (!)
By moving the call to requires() *before* the filesystem check, the fact that fetched files are cached on the local disk becomes an implementation detail, rather than a semantics-changing point of note.
........
r55198 | neal.norwitz | 2007-05-08 23:43:15 -0700 (Tue, 08 May 2007) | 1 line
Add markup for True/False. Will backport
........
r55205 | walter.doerwald | 2007-05-09 11:10:47 -0700 (Wed, 09 May 2007) | 4 lines
Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr()
instead of memchr().
........
r55241 | neal.norwitz | 2007-05-10 22:55:15 -0700 (Thu, 10 May 2007) | 6 lines
Don't ever report a failure when the sum of the reference count differences
are zero. This should help reduce the false positives.
The message about references leaking is maintained to provide as much
info as possible rather than simply suppressing the message at the source.
........
r55242 | neal.norwitz | 2007-05-10 23:23:01 -0700 (Thu, 10 May 2007) | 1 line
Fix typo in docstring (the module is popen2, not 3).
........
r55244 | neal.norwitz | 2007-05-10 23:56:52 -0700 (Thu, 10 May 2007) | 1 line
Remove trailing whitespace in docstring
........
r55245 | neal.norwitz | 2007-05-10 23:57:33 -0700 (Thu, 10 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module.
........
r55247 | neal.norwitz | 2007-05-11 00:13:30 -0700 (Fri, 11 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module. (forgot the doc)
........
r55253 | georg.brandl | 2007-05-11 02:41:37 -0700 (Fri, 11 May 2007) | 3 lines
Remove an XXX that is unnecessary.
........
r55258 | georg.brandl | 2007-05-11 04:04:26 -0700 (Fri, 11 May 2007) | 2 lines
Patch #1714700: clarify os.linesep vs. tfiles opened in text mode.
(backport)
........
r55259 | georg.brandl | 2007-05-11 04:43:56 -0700 (Fri, 11 May 2007) | 2 lines
Update DDJ link.
........
r55273 | raymond.hettinger | 2007-05-11 10:59:59 -0700 (Fri, 11 May 2007) | 1 line
Better tests for posixpath.commonprefix
........
r55287 | georg.brandl | 2007-05-12 14:06:41 -0700 (Sat, 12 May 2007) | 2 lines
Bug #1046945: document SWIG options of distutils.
........
r55290 | georg.brandl | 2007-05-13 01:04:07 -0700 (Sun, 13 May 2007) | 2 lines
Add bz2 to content encodings.
........
r55297 | neal.norwitz | 2007-05-13 13:45:05 -0700 (Sun, 13 May 2007) | 3 lines
Remove Amoeba doc which was removed in version 1.0! according to Misc/HISTORY.
Hopefully Guido won't shed a tear. :-)
........
r55298 | neal.norwitz | 2007-05-13 13:54:19 -0700 (Sun, 13 May 2007) | 1 line
Remove references to stdwin which was removed long ago.
........
r55299 | neal.norwitz | 2007-05-13 14:13:42 -0700 (Sun, 13 May 2007) | 3 lines
Remove support for freebsd[23] which haven't been released since 2000
or earlier. http://www.freebsd.org/releases/index.html
........
r55320 | raymond.hettinger | 2007-05-14 13:52:31 -0700 (Mon, 14 May 2007) | 1 line
Small speedup.
........
................
2007-05-14 22:51:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
raise_dict_descr_error(PyObject *obj)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"this __dict__ descriptor does not support "
|
|
|
|
|
"'%.200s' objects", Py_TYPE(obj)->tp_name);
|
Merged revisions 55325-55327 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55326 | guido.van.rossum | 2007-05-14 15:07:35 -0700 (Mon, 14 May 2007) | 2 lines
Don't use err.message, use err.args[0].
................
r55327 | guido.van.rossum | 2007-05-14 15:11:37 -0700 (Mon, 14 May 2007) | 259 lines
Merged revisions 54988-55226,55228-55323 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r54995 | neal.norwitz | 2007-04-26 23:45:32 -0700 (Thu, 26 Apr 2007) | 3 lines
This gets the test working on Solaris. It seems a little hokey to me,
but the test passed on Linux and Solaris, hopefully other platforms too.
........
r55002 | georg.brandl | 2007-04-27 12:20:00 -0700 (Fri, 27 Apr 2007) | 2 lines
Version fix (bug #1708710)
........
r55021 | neal.norwitz | 2007-04-29 16:53:24 -0700 (Sun, 29 Apr 2007) | 1 line
There really are some tests that are problematic.
........
r55024 | kristjan.jonsson | 2007-04-30 08:17:46 -0700 (Mon, 30 Apr 2007) | 1 line
Complete revamp of PCBuild8 directory. Use subdirectories for each project under the main pcbuild solution. Now make extensive use of property sheets to simplify project configuration. x64 build fully supported, and the process for building PGO version (Profiler Guided Optimization) simplified. All projects are now present, except _ssl, which needs to be reimplemented. Also, some of the projects that require external libraries need extra work to fully compile on x64.
........
r55025 | thomas.heller | 2007-04-30 08:44:17 -0700 (Mon, 30 Apr 2007) | 4 lines
Make sure to call PyErr_NoMemory() in several places where
PyMem_Malloc() could potentially fail.
Will backport to the release25-maint branch.
........
r55027 | thomas.heller | 2007-04-30 09:04:57 -0700 (Mon, 30 Apr 2007) | 8 lines
When accessing the .value attribute of a c_wchar_p instance, and the
instance does not point to a valid wchar_t zero-terminated string,
raise a ValueError. c_char_p does this already.
The ValueError message now contains the correct pointer address.
Will backport to release25-maint.
........
r55036 | georg.brandl | 2007-04-30 23:04:11 -0700 (Mon, 30 Apr 2007) | 2 lines
Bug #1710295: exceptions are now new-style classes.
........
r55038 | georg.brandl | 2007-04-30 23:08:15 -0700 (Mon, 30 Apr 2007) | 2 lines
Patch #1710352: add missing public functions to locale.__all__.
........
r55041 | vinay.sajip | 2007-05-01 03:20:03 -0700 (Tue, 01 May 2007) | 1 line
Added new optional credentials argument to SMTPHandler.__init__, and smtp.login() is now called in SMTPHandler.emit() if credentials are specified.
........
r55042 | vinay.sajip | 2007-05-01 03:21:45 -0700 (Tue, 01 May 2007) | 1 line
Added documentation for new optional credentials argument to SMTPHandler.__init__().
........
r55070 | neal.norwitz | 2007-05-01 21:47:55 -0700 (Tue, 01 May 2007) | 3 lines
Stop using PyMem_FREE while the GIL is not held. For details see:
http://mail.python.org/pipermail/python-dev/2007-May/072896.html
........
r55080 | armin.rigo | 2007-05-02 12:23:31 -0700 (Wed, 02 May 2007) | 6 lines
Fix for #1303614 and #1174712:
- __dict__ descriptor abuse for subclasses of built-in types
- subclassing from both ModuleType and another built-in types
Thanks zseil for the patch.
........
r55083 | georg.brandl | 2007-05-02 13:02:29 -0700 (Wed, 02 May 2007) | 3 lines
Actually raise an exception before calling ast_error_finish.
Triggers an assertion otherwise.
........
r55087 | neal.norwitz | 2007-05-02 23:47:18 -0700 (Wed, 02 May 2007) | 1 line
Handle a couple of uncaught errors. This should be backported
........
r55090 | neal.norwitz | 2007-05-03 00:20:57 -0700 (Thu, 03 May 2007) | 4 lines
Remove dead code. This code couldn't be reached because earlier in
the function there is another check for z != Py_None.
........
r55092 | thomas.heller | 2007-05-03 05:02:08 -0700 (Thu, 03 May 2007) | 1 line
Fix building _ctypes.pyd for x64 / Windows.
........
r55093 | thomas.heller | 2007-05-03 05:05:20 -0700 (Thu, 03 May 2007) | 1 line
Don't truncate pointers to integers (on win64 platform).
........
r55094 | walter.doerwald | 2007-05-03 08:13:55 -0700 (Thu, 03 May 2007) | 3 lines
Clarify the behaviour of PyUnicode_DecodeUTF16(): A BOM is only skipped
in native order mode, and only if it's the first two bytes.
........
r55101 | kristjan.jonsson | 2007-05-03 13:04:53 -0700 (Thu, 03 May 2007) | 2 lines
Fix pcbuild8 after recent overhaul: Added the version resource to python26.dll. Adjust stacksize to 2Mb and made large address aware for 32 bits, and set stacksize to 3Mb for 64 bits.
Todo: Set .dll optimized load addresses, and side-by-side packaging of the python26.dll.
........
r55102 | kristjan.jonsson | 2007-05-03 13:09:56 -0700 (Thu, 03 May 2007) | 1 line
Fix those parts in the testsuite that assumed that sys.maxint would cause overflow on x64. Now the testsuite is well behaved on that platform.
........
r55103 | kristjan.jonsson | 2007-05-03 13:27:03 -0700 (Thu, 03 May 2007) | 11 lines
Fix problems in x64 build that were discovered by the testsuite:
- Reenable modules on x64 that had been disabled aeons ago for Itanium.
- Cleared up confusion about compilers for 64 bit windows. There is only Itanium and x64. Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above.
- Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms.
- Fixed thread_nt.h. The emulated InterlockedCompareExchange function didn?\194?\180t work on x64, probaby due to the lack of a "volatile" specifier. Anyway, win95 is no longer a target platform.
- Itertools module used wrong constant to check for overflow in count()
- PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member.
- PyLong_FromSsize_t() incorrectly specified that the operand were unsigned.
With these changes, the x64 passes the testsuite, for those modules present.
........
r55107 | kristjan.jonsson | 2007-05-03 17:25:08 -0700 (Thu, 03 May 2007) | 1 line
Revert compiler comment to AMD64 for x64/AMD64 builds.
........
r55115 | thomas.heller | 2007-05-04 00:14:39 -0700 (Fri, 04 May 2007) | 4 lines
Fix some ctypes test crashes, when running with a debug Python
version on win64 by using proper argtypes and restype function
attributes.
........
r55117 | thomas.heller | 2007-05-04 01:20:41 -0700 (Fri, 04 May 2007) | 4 lines
On 64-bit Windows, ffi_arg must be 8 bytes long. This fixes the
remaining crashes in the ctypes tests, when functions return float or
double types.
........
r55120 | kristjan.jonsson | 2007-05-04 08:48:15 -0700 (Fri, 04 May 2007) | 1 line
Update the pcbuild8 solution. Straightened out the _ctypes project by using a .vsproj file and a masm64.rules file to avoid redundancy
........
r55121 | kristjan.jonsson | 2007-05-04 10:28:06 -0700 (Fri, 04 May 2007) | 1 line
Minor fix of PCBuild8/_ctypes vcproj, moving include dir into the .vsprops file.
........
r55129 | thomas.heller | 2007-05-04 12:54:22 -0700 (Fri, 04 May 2007) | 3 lines
Do not truncate 64-bit pointers to 32-bit integers.
Fixes SF #1703286, will backport to release25-maint.
........
r55131 | thomas.heller | 2007-05-04 12:56:32 -0700 (Fri, 04 May 2007) | 1 line
Oops, these tests do not run on Windows CE.
........
r55140 | brett.cannon | 2007-05-04 18:34:02 -0700 (Fri, 04 May 2007) | 2 lines
Deprecate BaseException.message as per PEP 352.
........
r55154 | georg.brandl | 2007-05-05 11:55:37 -0700 (Sat, 05 May 2007) | 2 lines
Bug #1713535: typo in logging example.
........
r55158 | vinay.sajip | 2007-05-06 10:53:37 -0700 (Sun, 06 May 2007) | 1 line
Updates of recent changes to logging.
........
r55165 | neal.norwitz | 2007-05-07 00:02:26 -0700 (Mon, 07 May 2007) | 1 line
Verify changes to the trunk go to the normal checkins list
........
r55169 | kristjan.jonsson | 2007-05-07 09:46:54 -0700 (Mon, 07 May 2007) | 1 line
As per Armin Rigo's suggestion, remove special handing from intobject.c to deal with the peculiarities of classobject's implementation of the number protocol. The nb_long method of classobject now falls back to nb_int if there is no __long__ attribute present.
........
r55197 | collin.winter | 2007-05-08 21:14:36 -0700 (Tue, 08 May 2007) | 9 lines
Fix a bug in test.test_support.open_urlresource().
If the call to requires() doesn't precede the filesystem check, we get the following situation:
1. ./python Lib/test/regrtest.py test_foo # test needs urlfetch, not enabled, so skipped
2. ./python Lib/test/regrtest.py -u urlfetch test_foo # test runs
3. ./python Lib/test/regrtest.py test_foo # test runs (!)
By moving the call to requires() *before* the filesystem check, the fact that fetched files are cached on the local disk becomes an implementation detail, rather than a semantics-changing point of note.
........
r55198 | neal.norwitz | 2007-05-08 23:43:15 -0700 (Tue, 08 May 2007) | 1 line
Add markup for True/False. Will backport
........
r55205 | walter.doerwald | 2007-05-09 11:10:47 -0700 (Wed, 09 May 2007) | 4 lines
Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr()
instead of memchr().
........
r55241 | neal.norwitz | 2007-05-10 22:55:15 -0700 (Thu, 10 May 2007) | 6 lines
Don't ever report a failure when the sum of the reference count differences
are zero. This should help reduce the false positives.
The message about references leaking is maintained to provide as much
info as possible rather than simply suppressing the message at the source.
........
r55242 | neal.norwitz | 2007-05-10 23:23:01 -0700 (Thu, 10 May 2007) | 1 line
Fix typo in docstring (the module is popen2, not 3).
........
r55244 | neal.norwitz | 2007-05-10 23:56:52 -0700 (Thu, 10 May 2007) | 1 line
Remove trailing whitespace in docstring
........
r55245 | neal.norwitz | 2007-05-10 23:57:33 -0700 (Thu, 10 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module.
........
r55247 | neal.norwitz | 2007-05-11 00:13:30 -0700 (Fri, 11 May 2007) | 1 line
Deprecate os.popen* and popen2 module in favor of the subprocess module. (forgot the doc)
........
r55253 | georg.brandl | 2007-05-11 02:41:37 -0700 (Fri, 11 May 2007) | 3 lines
Remove an XXX that is unnecessary.
........
r55258 | georg.brandl | 2007-05-11 04:04:26 -0700 (Fri, 11 May 2007) | 2 lines
Patch #1714700: clarify os.linesep vs. tfiles opened in text mode.
(backport)
........
r55259 | georg.brandl | 2007-05-11 04:43:56 -0700 (Fri, 11 May 2007) | 2 lines
Update DDJ link.
........
r55273 | raymond.hettinger | 2007-05-11 10:59:59 -0700 (Fri, 11 May 2007) | 1 line
Better tests for posixpath.commonprefix
........
r55287 | georg.brandl | 2007-05-12 14:06:41 -0700 (Sat, 12 May 2007) | 2 lines
Bug #1046945: document SWIG options of distutils.
........
r55290 | georg.brandl | 2007-05-13 01:04:07 -0700 (Sun, 13 May 2007) | 2 lines
Add bz2 to content encodings.
........
r55297 | neal.norwitz | 2007-05-13 13:45:05 -0700 (Sun, 13 May 2007) | 3 lines
Remove Amoeba doc which was removed in version 1.0! according to Misc/HISTORY.
Hopefully Guido won't shed a tear. :-)
........
r55298 | neal.norwitz | 2007-05-13 13:54:19 -0700 (Sun, 13 May 2007) | 1 line
Remove references to stdwin which was removed long ago.
........
r55299 | neal.norwitz | 2007-05-13 14:13:42 -0700 (Sun, 13 May 2007) | 3 lines
Remove support for freebsd[23] which haven't been released since 2000
or earlier. http://www.freebsd.org/releases/index.html
........
r55320 | raymond.hettinger | 2007-05-14 13:52:31 -0700 (Mon, 14 May 2007) | 1 line
Small speedup.
........
................
2007-05-14 22:51:27 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-30 20:00:07 +00:00
|
|
|
static PyObject *
|
|
|
|
|
subtype_dict(PyObject *obj, void *context)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *base;
|
|
|
|
|
|
|
|
|
|
base = get_builtin_base_with_dict(Py_TYPE(obj));
|
|
|
|
|
if (base != NULL) {
|
|
|
|
|
descrgetfunc func;
|
|
|
|
|
PyObject *descr = get_dict_descriptor(base);
|
|
|
|
|
if (descr == NULL) {
|
|
|
|
|
raise_dict_descr_error(obj);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
func = Py_TYPE(descr)->tp_descr_get;
|
|
|
|
|
if (func == NULL) {
|
|
|
|
|
raise_dict_descr_error(obj);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return func(descr, obj, (PyObject *)(Py_TYPE(obj)));
|
|
|
|
|
}
|
2012-02-19 19:59:10 -05:00
|
|
|
return PyObject_GenericGetDict(obj, context);
|
2001-08-30 20:00:07 +00:00
|
|
|
}
|
|
|
|
|
|
2001-10-26 04:26:12 +00:00
|
|
|
static int
|
|
|
|
|
subtype_setdict(PyObject *obj, PyObject *value, void *context)
|
|
|
|
|
{
|
2016-01-05 21:27:54 +02:00
|
|
|
PyObject **dictptr;
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *base;
|
|
|
|
|
|
|
|
|
|
base = get_builtin_base_with_dict(Py_TYPE(obj));
|
|
|
|
|
if (base != NULL) {
|
|
|
|
|
descrsetfunc func;
|
|
|
|
|
PyObject *descr = get_dict_descriptor(base);
|
|
|
|
|
if (descr == NULL) {
|
|
|
|
|
raise_dict_descr_error(obj);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
func = Py_TYPE(descr)->tp_descr_set;
|
|
|
|
|
if (func == NULL) {
|
|
|
|
|
raise_dict_descr_error(obj);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return func(descr, obj, value);
|
|
|
|
|
}
|
2012-02-19 19:59:10 -05:00
|
|
|
/* Almost like PyObject_GenericSetDict, but allow __dict__ to be deleted. */
|
2012-02-19 20:36:12 -05:00
|
|
|
if (value != NULL && !PyDict_Check(value)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"__dict__ must be set to a dictionary, "
|
|
|
|
|
"not a '%.200s'", Py_TYPE(value)->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2024-04-21 22:57:05 -07:00
|
|
|
|
2024-04-02 11:59:21 +01:00
|
|
|
if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
|
2024-04-29 15:49:01 -04:00
|
|
|
return _PyObject_SetManagedDict(obj, value);
|
2024-04-02 11:59:21 +01:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
dictptr = _PyObject_ComputedDictPointer(obj);
|
|
|
|
|
if (dictptr == NULL) {
|
|
|
|
|
PyErr_SetString(PyExc_AttributeError,
|
|
|
|
|
"This object has no __dict__");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
Py_CLEAR(*dictptr);
|
|
|
|
|
*dictptr = Py_XNewRef(value);
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
2001-10-26 04:26:12 +00:00
|
|
|
}
|
|
|
|
|
|
2002-08-12 19:05:44 +00:00
|
|
|
static PyObject *
|
|
|
|
|
subtype_getweakref(PyObject *obj, void *context)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject **weaklistptr;
|
|
|
|
|
PyObject *result;
|
2018-10-26 18:39:11 +02:00
|
|
|
PyTypeObject *type = Py_TYPE(obj);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2018-10-26 18:39:11 +02:00
|
|
|
if (type->tp_weaklistoffset == 0) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_SetString(PyExc_AttributeError,
|
|
|
|
|
"This object has no __weakref__");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2018-10-26 18:39:11 +02:00
|
|
|
_PyObject_ASSERT((PyObject *)type,
|
2022-08-16 13:57:18 +01:00
|
|
|
type->tp_weaklistoffset > 0 ||
|
|
|
|
|
type->tp_weaklistoffset == MANAGED_WEAKREF_OFFSET);
|
2018-10-26 18:39:11 +02:00
|
|
|
_PyObject_ASSERT((PyObject *)type,
|
2022-08-16 13:57:18 +01:00
|
|
|
((type->tp_weaklistoffset + (Py_ssize_t)sizeof(PyObject *))
|
|
|
|
|
<= type->tp_basicsize));
|
2018-10-26 18:39:11 +02:00
|
|
|
weaklistptr = (PyObject **)((char *)obj + type->tp_weaklistoffset);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (*weaklistptr == NULL)
|
|
|
|
|
result = Py_None;
|
|
|
|
|
else
|
|
|
|
|
result = *weaklistptr;
|
2022-11-10 23:40:31 +01:00
|
|
|
return Py_NewRef(result);
|
2002-08-12 19:05:44 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-07 13:41:37 +00:00
|
|
|
/* Three variants on the subtype_getsets list. */
|
|
|
|
|
|
|
|
|
|
static PyGetSetDef subtype_getsets_full[] = {
|
2010-05-09 15:52:27 +00:00
|
|
|
{"__dict__", subtype_dict, subtype_setdict,
|
2023-11-19 21:30:07 +03:00
|
|
|
PyDoc_STR("dictionary for instance variables")},
|
2010-05-09 15:52:27 +00:00
|
|
|
{"__weakref__", subtype_getweakref, NULL,
|
2023-11-19 21:30:07 +03:00
|
|
|
PyDoc_STR("list of weak references to the object")},
|
2010-05-09 15:52:27 +00:00
|
|
|
{0}
|
2001-08-30 20:00:07 +00:00
|
|
|
};
|
|
|
|
|
|
2003-01-07 13:41:37 +00:00
|
|
|
static PyGetSetDef subtype_getsets_dict_only[] = {
|
2010-05-09 15:52:27 +00:00
|
|
|
{"__dict__", subtype_dict, subtype_setdict,
|
2023-11-19 21:30:07 +03:00
|
|
|
PyDoc_STR("dictionary for instance variables")},
|
2010-05-09 15:52:27 +00:00
|
|
|
{0}
|
2003-01-07 13:41:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static PyGetSetDef subtype_getsets_weakref_only[] = {
|
2010-05-09 15:52:27 +00:00
|
|
|
{"__weakref__", subtype_getweakref, NULL,
|
2023-11-19 21:30:07 +03:00
|
|
|
PyDoc_STR("list of weak references to the object")},
|
2010-05-09 15:52:27 +00:00
|
|
|
{0}
|
2003-01-07 13:41:37 +00:00
|
|
|
};
|
|
|
|
|
|
2002-06-04 19:52:53 +00:00
|
|
|
static int
|
|
|
|
|
valid_identifier(PyObject *s)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!PyUnicode_Check(s)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"__slots__ items must be strings, not '%.200s'",
|
|
|
|
|
Py_TYPE(s)->tp_name);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (!PyUnicode_IsIdentifier(s)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"__slots__ must be identifiers");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
2002-06-04 19:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
static int
|
|
|
|
|
type_init(PyObject *cls, PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
assert(args != NULL && PyTuple_Check(args));
|
|
|
|
|
assert(kwds == NULL || PyDict_Check(kwds));
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
|
2021-06-16 18:04:38 +05:00
|
|
|
if (kwds != NULL && PyTuple_GET_SIZE(args) == 1 &&
|
|
|
|
|
PyDict_GET_SIZE(kwds) != 0) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"type.__init__() takes no keyword arguments");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
|
2021-06-16 18:04:38 +05:00
|
|
|
if ((PyTuple_GET_SIZE(args) != 1 && PyTuple_GET_SIZE(args) != 3)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"type.__init__() takes 1 or 3 arguments");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
|
2021-06-16 18:04:38 +05:00
|
|
|
return 0;
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-27 03:00:55 +01:00
|
|
|
|
2012-10-30 23:40:45 +01:00
|
|
|
unsigned long
|
2011-02-05 20:35:29 +00:00
|
|
|
PyType_GetFlags(PyTypeObject *type)
|
|
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
return FT_ATOMIC_LOAD_ULONG_RELAXED(type->tp_flags);
|
2011-02-05 20:35:29 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-27 03:00:55 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
PyType_SUPPORTS_WEAKREFS(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
return _PyType_SUPPORTS_WEAKREFS(type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-10-23 22:04:16 +10:00
|
|
|
/* Determine the most derived metatype. */
|
|
|
|
|
PyTypeObject *
|
|
|
|
|
_PyType_CalculateMetaclass(PyTypeObject *metatype, PyObject *bases)
|
|
|
|
|
{
|
|
|
|
|
Py_ssize_t i, nbases;
|
|
|
|
|
PyTypeObject *winner;
|
|
|
|
|
PyObject *tmp;
|
|
|
|
|
PyTypeObject *tmptype;
|
|
|
|
|
|
|
|
|
|
/* Determine the proper metatype to deal with this,
|
|
|
|
|
and check for metatype conflicts while we're at it.
|
|
|
|
|
Note that if some other metatype wins to contract,
|
|
|
|
|
it's possible that its instances are not types. */
|
|
|
|
|
|
|
|
|
|
nbases = PyTuple_GET_SIZE(bases);
|
|
|
|
|
winner = metatype;
|
|
|
|
|
for (i = 0; i < nbases; i++) {
|
|
|
|
|
tmp = PyTuple_GET_ITEM(bases, i);
|
|
|
|
|
tmptype = Py_TYPE(tmp);
|
|
|
|
|
if (PyType_IsSubtype(winner, tmptype))
|
|
|
|
|
continue;
|
|
|
|
|
if (PyType_IsSubtype(tmptype, winner)) {
|
|
|
|
|
winner = tmptype;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
/* else: */
|
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"metaclass conflict: "
|
|
|
|
|
"the metaclass of a derived class "
|
|
|
|
|
"must be a (non-strict) subclass "
|
|
|
|
|
"of the metaclasses of all its bases");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return winner;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
// Forward declaration
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
2021-04-10 23:15:32 +02:00
|
|
|
type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
typedef struct {
|
|
|
|
|
PyTypeObject *metatype;
|
|
|
|
|
PyObject *args;
|
|
|
|
|
PyObject *kwds;
|
|
|
|
|
PyObject *orig_dict;
|
|
|
|
|
PyObject *name;
|
|
|
|
|
PyObject *bases;
|
|
|
|
|
PyTypeObject *base;
|
|
|
|
|
PyObject *slots;
|
|
|
|
|
Py_ssize_t nslot;
|
|
|
|
|
int add_dict;
|
|
|
|
|
int add_weak;
|
|
|
|
|
int may_add_dict;
|
|
|
|
|
int may_add_weak;
|
|
|
|
|
} type_new_ctx;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
/* Check for valid slot names and two special cases */
|
2021-04-10 23:15:32 +02:00
|
|
|
static int
|
|
|
|
|
type_new_visit_slots(type_new_ctx *ctx)
|
|
|
|
|
{
|
|
|
|
|
PyObject *slots = ctx->slots;
|
|
|
|
|
Py_ssize_t nslot = ctx->nslot;
|
|
|
|
|
for (Py_ssize_t i = 0; i < nslot; i++) {
|
|
|
|
|
PyObject *name = PyTuple_GET_ITEM(slots, i);
|
|
|
|
|
if (!valid_identifier(name)) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
assert(PyUnicode_Check(name));
|
2022-02-08 13:39:07 -07:00
|
|
|
if (_PyUnicode_Equal(name, &_Py_ID(__dict__))) {
|
2021-04-10 23:15:32 +02:00
|
|
|
if (!ctx->may_add_dict || ctx->add_dict != 0) {
|
2017-12-14 23:32:56 +01:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
2021-04-10 23:15:32 +02:00
|
|
|
"__dict__ slot disallowed: "
|
|
|
|
|
"we already got one");
|
|
|
|
|
return -1;
|
2017-12-14 23:32:56 +01:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
ctx->add_dict++;
|
2017-12-14 23:32:56 +01:00
|
|
|
}
|
2022-02-08 13:39:07 -07:00
|
|
|
if (_PyUnicode_Equal(name, &_Py_ID(__weakref__))) {
|
2021-04-10 23:15:32 +02:00
|
|
|
if (!ctx->may_add_weak || ctx->add_weak != 0) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"__weakref__ slot disallowed: "
|
2023-01-01 16:41:33 +01:00
|
|
|
"we already got one");
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
ctx->add_weak++;
|
2017-10-01 10:37:47 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2017-10-01 10:37:47 +02:00
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
/* Copy slots into a list, mangle names and sort them.
|
|
|
|
|
Sorted names are needed for __class__ assignment.
|
|
|
|
|
Convert them back to tuple at the end.
|
|
|
|
|
*/
|
2021-04-10 23:15:32 +02:00
|
|
|
static PyObject*
|
|
|
|
|
type_new_copy_slots(type_new_ctx *ctx, PyObject *dict)
|
|
|
|
|
{
|
|
|
|
|
PyObject *slots = ctx->slots;
|
|
|
|
|
Py_ssize_t nslot = ctx->nslot;
|
2017-10-01 10:37:47 +02:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
Py_ssize_t new_nslot = nslot - ctx->add_dict - ctx->add_weak;
|
|
|
|
|
PyObject *new_slots = PyList_New(new_nslot);
|
|
|
|
|
if (new_slots == NULL) {
|
|
|
|
|
return NULL;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
Py_ssize_t j = 0;
|
|
|
|
|
for (Py_ssize_t i = 0; i < nslot; i++) {
|
|
|
|
|
PyObject *slot = PyTuple_GET_ITEM(slots, i);
|
2022-02-08 13:39:07 -07:00
|
|
|
if ((ctx->add_dict && _PyUnicode_Equal(slot, &_Py_ID(__dict__))) ||
|
|
|
|
|
(ctx->add_weak && _PyUnicode_Equal(slot, &_Py_ID(__weakref__))))
|
2021-04-10 23:15:32 +02:00
|
|
|
{
|
|
|
|
|
continue;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
slot =_Py_Mangle(ctx->name, slot);
|
|
|
|
|
if (!slot) {
|
2012-02-25 01:22:36 +01:00
|
|
|
goto error;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
|
|
|
|
PyList_SET_ITEM(new_slots, j, slot);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
int r = PyDict_Contains(dict, slot);
|
|
|
|
|
if (r < 0) {
|
2012-02-25 01:22:36 +01:00
|
|
|
goto error;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
if (r > 0) {
|
2023-05-15 20:36:23 -07:00
|
|
|
/* CPython inserts these names (when needed)
|
2021-04-10 23:15:32 +02:00
|
|
|
into the namespace when creating a class. They will be deleted
|
|
|
|
|
below so won't act as class variables. */
|
2022-02-08 13:39:07 -07:00
|
|
|
if (!_PyUnicode_Equal(slot, &_Py_ID(__qualname__)) &&
|
2023-05-15 20:36:23 -07:00
|
|
|
!_PyUnicode_Equal(slot, &_Py_ID(__classcell__)) &&
|
|
|
|
|
!_PyUnicode_Equal(slot, &_Py_ID(__classdictcell__)))
|
2021-04-10 23:15:32 +02:00
|
|
|
{
|
|
|
|
|
PyErr_Format(PyExc_ValueError,
|
|
|
|
|
"%R in __slots__ conflicts with class variable",
|
|
|
|
|
slot);
|
2012-02-25 01:22:36 +01:00
|
|
|
goto error;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
assert(j == new_nslot);
|
|
|
|
|
|
|
|
|
|
if (PyList_Sort(new_slots) == -1) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *tuple = PyList_AsTuple(new_slots);
|
|
|
|
|
Py_DECREF(new_slots);
|
|
|
|
|
if (tuple == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(PyTuple_GET_SIZE(tuple) == new_nslot);
|
|
|
|
|
return tuple;
|
|
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
Py_DECREF(new_slots);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
type_new_slots_bases(type_new_ctx *ctx)
|
|
|
|
|
{
|
|
|
|
|
Py_ssize_t nbases = PyTuple_GET_SIZE(ctx->bases);
|
|
|
|
|
if (nbases > 1 &&
|
|
|
|
|
((ctx->may_add_dict && ctx->add_dict == 0) ||
|
|
|
|
|
(ctx->may_add_weak && ctx->add_weak == 0)))
|
|
|
|
|
{
|
|
|
|
|
for (Py_ssize_t i = 0; i < nbases; i++) {
|
2022-01-22 18:56:11 +01:00
|
|
|
PyObject *obj = PyTuple_GET_ITEM(ctx->bases, i);
|
|
|
|
|
if (obj == (PyObject *)ctx->base) {
|
2021-04-10 23:15:32 +02:00
|
|
|
/* Skip primary base */
|
2010-05-09 15:52:27 +00:00
|
|
|
continue;
|
2011-08-16 22:26:48 -05:00
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
PyTypeObject *base = _PyType_CAST(obj);
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
if (ctx->may_add_dict && ctx->add_dict == 0 &&
|
2022-01-22 18:56:11 +01:00
|
|
|
base->tp_dictoffset != 0)
|
2021-04-10 23:15:32 +02:00
|
|
|
{
|
2021-04-11 23:57:09 +02:00
|
|
|
ctx->add_dict++;
|
2020-10-26 12:47:57 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
if (ctx->may_add_weak && ctx->add_weak == 0 &&
|
2022-01-22 18:56:11 +01:00
|
|
|
base->tp_weaklistoffset != 0)
|
2021-04-10 23:15:32 +02:00
|
|
|
{
|
|
|
|
|
ctx->add_weak++;
|
2011-08-16 18:53:26 -05:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
if (ctx->may_add_dict && ctx->add_dict == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (ctx->may_add_weak && ctx->add_weak == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
/* Nothing more to check */
|
|
|
|
|
break;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
type_new_slots_impl(type_new_ctx *ctx, PyObject *dict)
|
|
|
|
|
{
|
|
|
|
|
/* Are slots allowed? */
|
|
|
|
|
if (ctx->nslot > 0 && ctx->base->tp_itemsize != 0) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"nonempty __slots__ not supported for subtype of '%s'",
|
|
|
|
|
ctx->base->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type_new_visit_slots(ctx) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *new_slots = type_new_copy_slots(ctx, dict);
|
|
|
|
|
if (new_slots == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
assert(PyTuple_CheckExact(new_slots));
|
|
|
|
|
|
|
|
|
|
Py_XSETREF(ctx->slots, new_slots);
|
|
|
|
|
ctx->nslot = PyTuple_GET_SIZE(new_slots);
|
|
|
|
|
|
|
|
|
|
/* Secondary bases may provide weakrefs or dict */
|
|
|
|
|
type_new_slots_bases(ctx);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static Py_ssize_t
|
|
|
|
|
type_new_slots(type_new_ctx *ctx, PyObject *dict)
|
|
|
|
|
{
|
|
|
|
|
// Check for a __slots__ sequence variable in dict, and count it
|
|
|
|
|
ctx->add_dict = 0;
|
|
|
|
|
ctx->add_weak = 0;
|
|
|
|
|
ctx->may_add_dict = (ctx->base->tp_dictoffset == 0);
|
|
|
|
|
ctx->may_add_weak = (ctx->base->tp_weaklistoffset == 0
|
|
|
|
|
&& ctx->base->tp_itemsize == 0);
|
|
|
|
|
|
|
|
|
|
if (ctx->slots == NULL) {
|
|
|
|
|
if (ctx->may_add_dict) {
|
|
|
|
|
ctx->add_dict++;
|
|
|
|
|
}
|
|
|
|
|
if (ctx->may_add_weak) {
|
|
|
|
|
ctx->add_weak++;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
else {
|
|
|
|
|
/* Have slots */
|
|
|
|
|
if (type_new_slots_impl(ctx, dict) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
static PyTypeObject*
|
|
|
|
|
type_new_alloc(type_new_ctx *ctx)
|
|
|
|
|
{
|
|
|
|
|
PyTypeObject *metatype = ctx->metatype;
|
|
|
|
|
PyTypeObject *type;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
// Allocate the type object
|
|
|
|
|
type = (PyTypeObject *)metatype->tp_alloc(metatype, ctx->nslot);
|
|
|
|
|
if (type == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
PyHeapTypeObject *et = (PyHeapTypeObject *)type;
|
|
|
|
|
|
|
|
|
|
// Initialize tp_flags.
|
2020-10-14 18:44:07 -07:00
|
|
|
// All heap types need GC, since we can create a reference cycle by storing
|
2021-04-10 23:15:32 +02:00
|
|
|
// an instance on one of its parents.
|
2025-02-25 21:24:20 -08:00
|
|
|
type_set_flags(type, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE |
|
|
|
|
|
Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
// Initialize essential fields
|
2015-05-11 22:57:16 -04:00
|
|
|
type->tp_as_async = &et->as_async;
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_as_number = &et->as_number;
|
|
|
|
|
type->tp_as_sequence = &et->as_sequence;
|
|
|
|
|
type->tp_as_mapping = &et->as_mapping;
|
|
|
|
|
type->tp_as_buffer = &et->as_buffer;
|
2021-04-10 23:15:32 +02:00
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
set_tp_bases(type, Py_NewRef(ctx->bases), 1);
|
2021-04-10 23:15:32 +02:00
|
|
|
type->tp_base = (PyTypeObject *)Py_NewRef(ctx->base);
|
|
|
|
|
|
|
|
|
|
type->tp_dealloc = subtype_dealloc;
|
|
|
|
|
/* Always override allocation strategy to use regular heap */
|
|
|
|
|
type->tp_alloc = PyType_GenericAlloc;
|
|
|
|
|
type->tp_free = PyObject_GC_Del;
|
|
|
|
|
|
|
|
|
|
type->tp_traverse = subtype_traverse;
|
|
|
|
|
type->tp_clear = subtype_clear;
|
|
|
|
|
|
|
|
|
|
et->ht_name = Py_NewRef(ctx->name);
|
|
|
|
|
et->ht_module = NULL;
|
2021-10-21 11:46:20 +02:00
|
|
|
et->_ht_tpname = NULL;
|
2024-09-18 16:18:19 +09:00
|
|
|
et->ht_token = NULL;
|
2021-04-10 23:15:32 +02:00
|
|
|
|
2024-08-06 14:36:57 -04:00
|
|
|
#ifdef Py_GIL_DISABLED
|
2024-10-01 13:05:42 -04:00
|
|
|
et->unique_id = _PyObject_AssignUniqueId((PyObject *)et);
|
2024-08-06 14:36:57 -04:00
|
|
|
#endif
|
2024-04-12 13:36:20 -04:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
type_new_set_name(const type_new_ctx *ctx, PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
Py_ssize_t name_size;
|
|
|
|
|
type->tp_name = PyUnicode_AsUTF8AndSize(ctx->name, &name_size);
|
|
|
|
|
if (!type->tp_name) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2015-12-30 21:40:49 +02:00
|
|
|
if (strlen(type->tp_name) != (size_t)name_size) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError,
|
|
|
|
|
"type name must not contain null characters");
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
2015-12-30 21:40:49 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
/* Set __module__ in the dict */
|
2021-04-10 23:15:32 +02:00
|
|
|
static int
|
2025-04-17 03:04:42 -07:00
|
|
|
type_new_set_module(PyObject *dict)
|
2021-04-10 23:15:32 +02:00
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
int r = PyDict_Contains(dict, &_Py_ID(__module__));
|
2020-10-26 12:47:57 +02:00
|
|
|
if (r < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
2020-10-26 12:47:57 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
if (r > 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *globals = PyEval_GetGlobals();
|
|
|
|
|
if (globals == NULL) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-14 11:25:39 +02:00
|
|
|
PyObject *module;
|
|
|
|
|
r = PyDict_GetItemRef(globals, &_Py_ID(__name__), &module);
|
|
|
|
|
if (module) {
|
|
|
|
|
r = PyDict_SetItem(dict, &_Py_ID(__module__), module);
|
|
|
|
|
Py_DECREF(module);
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
2023-11-14 11:25:39 +02:00
|
|
|
return r;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
/* Set ht_qualname to dict['__qualname__'] if available, else to
|
|
|
|
|
__name__. The __qualname__ accessor will look for ht_qualname. */
|
2021-04-10 23:15:32 +02:00
|
|
|
static int
|
2025-04-17 03:04:42 -07:00
|
|
|
type_new_set_ht_name(PyTypeObject *type, PyObject *dict)
|
2021-04-10 23:15:32 +02:00
|
|
|
{
|
|
|
|
|
PyHeapTypeObject *et = (PyHeapTypeObject *)type;
|
2023-11-14 11:25:39 +02:00
|
|
|
PyObject *qualname;
|
|
|
|
|
if (PyDict_GetItemRef(dict, &_Py_ID(__qualname__), &qualname) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2012-02-25 01:22:36 +01:00
|
|
|
if (qualname != NULL) {
|
|
|
|
|
if (!PyUnicode_Check(qualname)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
2021-04-10 23:15:32 +02:00
|
|
|
"type __qualname__ must be a str, not %s",
|
|
|
|
|
Py_TYPE(qualname)->tp_name);
|
2023-11-14 11:25:39 +02:00
|
|
|
Py_DECREF(qualname);
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2023-11-14 11:25:39 +02:00
|
|
|
et->ht_qualname = qualname;
|
2023-05-01 20:34:43 -06:00
|
|
|
if (PyDict_DelItem(dict, &_Py_ID(__qualname__)) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
2012-02-25 01:22:36 +01:00
|
|
|
}
|
|
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
else {
|
|
|
|
|
et->ht_qualname = Py_NewRef(et->ht_name);
|
2019-02-25 17:59:46 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
2012-02-25 01:22:36 +01:00
|
|
|
|
2020-05-07 15:39:59 +02:00
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
/* Set tp_doc to a copy of dict['__doc__'], if the latter is there
|
|
|
|
|
and is a string. The __doc__ accessor will first look for tp_doc;
|
|
|
|
|
if that fails, it will still look into __dict__. */
|
2021-04-10 23:15:32 +02:00
|
|
|
static int
|
2025-04-17 03:04:42 -07:00
|
|
|
type_new_set_doc(PyTypeObject *type, PyObject* dict)
|
2021-04-10 23:15:32 +02:00
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *doc = PyDict_GetItemWithError(dict, &_Py_ID(__doc__));
|
2021-04-10 23:15:32 +02:00
|
|
|
if (doc == NULL) {
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
2019-02-25 17:59:46 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
// no __doc__ key
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (!PyUnicode_Check(doc)) {
|
|
|
|
|
// ignore non-string __doc__
|
|
|
|
|
return 0;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
2023-11-07 23:36:13 +01:00
|
|
|
const char *doc_str = PyUnicode_AsUTF8(doc);
|
2021-04-10 23:15:32 +02:00
|
|
|
if (doc_str == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Silently truncate the docstring if it contains a null byte
|
2023-11-07 23:36:13 +01:00
|
|
|
Py_ssize_t size = strlen(doc_str) + 1;
|
2024-01-26 11:11:35 +01:00
|
|
|
char *tp_doc = (char *)PyMem_Malloc(size);
|
2021-04-10 23:15:32 +02:00
|
|
|
if (tp_doc == NULL) {
|
|
|
|
|
PyErr_NoMemory();
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memcpy(tp_doc, doc_str, size);
|
|
|
|
|
type->tp_doc = tp_doc;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2025-04-17 03:04:42 -07:00
|
|
|
type_new_staticmethod(PyObject *dict, PyObject *attr)
|
2021-04-10 23:15:32 +02:00
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *func = PyDict_GetItemWithError(dict, attr);
|
2021-04-10 23:15:32 +02:00
|
|
|
if (func == NULL) {
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
2016-06-05 10:48:36 +03:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
return 0;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
if (!PyFunction_Check(func)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *static_func = PyStaticMethod_New(func);
|
|
|
|
|
if (static_func == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
if (PyDict_SetItem(dict, attr, static_func) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
Py_DECREF(static_func);
|
|
|
|
|
return -1;
|
2019-02-25 17:59:46 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
Py_DECREF(static_func);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
static int
|
2025-04-17 03:04:42 -07:00
|
|
|
type_new_classmethod(PyObject *dict, PyObject *attr)
|
2021-04-10 23:15:32 +02:00
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *func = PyDict_GetItemWithError(dict, attr);
|
2021-04-10 23:15:32 +02:00
|
|
|
if (func == NULL) {
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
2016-07-30 16:26:03 +10:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
return 0;
|
2016-07-30 16:26:03 +10:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
if (!PyFunction_Check(func)) {
|
|
|
|
|
return 0;
|
2019-02-25 17:59:46 +02:00
|
|
|
}
|
2016-07-30 16:26:03 +10:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
PyObject *method = PyClassMethod_New(func);
|
|
|
|
|
if (method == NULL) {
|
|
|
|
|
return -1;
|
2018-01-05 00:21:41 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
if (PyDict_SetItem(dict, attr, method) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
Py_DECREF(method);
|
|
|
|
|
return -1;
|
2019-02-25 17:59:46 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
Py_DECREF(method);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2018-01-05 00:21:41 +02:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
/* Add descriptors for custom slots from __slots__, or for __dict__ */
|
2021-04-10 23:15:32 +02:00
|
|
|
static int
|
|
|
|
|
type_new_descriptors(const type_new_ctx *ctx, PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
PyHeapTypeObject *et = (PyHeapTypeObject *)type;
|
|
|
|
|
Py_ssize_t slotoffset = ctx->base->tp_basicsize;
|
2012-02-25 01:22:36 +01:00
|
|
|
if (et->ht_slots != NULL) {
|
2022-01-28 00:39:52 +01:00
|
|
|
PyMemberDef *mp = _PyHeapType_GET_MEMBERS(et);
|
2021-04-10 23:15:32 +02:00
|
|
|
Py_ssize_t nslot = PyTuple_GET_SIZE(et->ht_slots);
|
|
|
|
|
for (Py_ssize_t i = 0; i < nslot; i++, mp++) {
|
2016-11-20 09:13:07 +02:00
|
|
|
mp->name = PyUnicode_AsUTF8(
|
2012-02-25 01:22:36 +01:00
|
|
|
PyTuple_GET_ITEM(et->ht_slots, i));
|
2021-04-10 23:15:32 +02:00
|
|
|
if (mp->name == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2023-07-25 15:28:30 +02:00
|
|
|
mp->type = Py_T_OBJECT_EX;
|
2010-05-09 15:52:27 +00:00
|
|
|
mp->offset = slotoffset;
|
|
|
|
|
|
|
|
|
|
/* __dict__ and __weakref__ are already filtered out */
|
|
|
|
|
assert(strcmp(mp->name, "__dict__") != 0);
|
|
|
|
|
assert(strcmp(mp->name, "__weakref__") != 0);
|
|
|
|
|
|
|
|
|
|
slotoffset += sizeof(PyObject *);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
if (ctx->add_weak) {
|
2022-08-16 13:57:18 +01:00
|
|
|
assert((type->tp_flags & Py_TPFLAGS_MANAGED_WEAKREF) == 0);
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_MANAGED_WEAKREF);
|
2022-08-16 13:57:18 +01:00
|
|
|
type->tp_weaklistoffset = MANAGED_WEAKREF_OFFSET;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2022-08-15 12:29:27 +01:00
|
|
|
if (ctx->add_dict) {
|
2021-12-07 16:02:53 +00:00
|
|
|
assert((type->tp_flags & Py_TPFLAGS_MANAGED_DICT) == 0);
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_MANAGED_DICT);
|
2022-08-15 12:29:27 +01:00
|
|
|
type->tp_dictoffset = -1;
|
2021-10-13 14:19:34 +01:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_basicsize = slotoffset;
|
2021-04-10 23:15:32 +02:00
|
|
|
type->tp_itemsize = ctx->base->tp_itemsize;
|
2022-01-28 00:39:52 +01:00
|
|
|
type->tp_members = _PyHeapType_GET_MEMBERS(et);
|
2021-04-10 23:15:32 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
static void
|
|
|
|
|
type_new_set_slots(const type_new_ctx *ctx, PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
if (type->tp_weaklistoffset && type->tp_dictoffset) {
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_getset = subtype_getsets_full;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
|
|
|
|
else if (type->tp_weaklistoffset && !type->tp_dictoffset) {
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_getset = subtype_getsets_weakref_only;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
|
|
|
|
else if (!type->tp_weaklistoffset && type->tp_dictoffset) {
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_getset = subtype_getsets_dict_only;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_getset = NULL;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* Special case some slots */
|
2021-04-10 23:15:32 +02:00
|
|
|
if (type->tp_dictoffset != 0 || ctx->nslot > 0) {
|
|
|
|
|
PyTypeObject *base = ctx->base;
|
|
|
|
|
if (base->tp_getattr == NULL && base->tp_getattro == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_getattro = PyObject_GenericGetAttr;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
|
|
|
|
if (base->tp_setattr == NULL && base->tp_setattro == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_setattro = PyObject_GenericSetAttr;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
/* store type in class' cell if one is supplied */
|
2021-04-10 23:15:32 +02:00
|
|
|
static int
|
2025-04-17 03:04:42 -07:00
|
|
|
type_new_set_classcell(PyTypeObject *type, PyObject *dict)
|
2021-04-10 23:15:32 +02:00
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *cell = PyDict_GetItemWithError(dict, &_Py_ID(__classcell__));
|
2021-04-10 23:15:32 +02:00
|
|
|
if (cell == NULL) {
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
2016-12-05 16:47:55 +10:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* At least one method requires a reference to its defining class */
|
|
|
|
|
if (!PyCell_Check(cell)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"__classcell__ must be a nonlocal cell, not %.200R",
|
|
|
|
|
Py_TYPE(cell));
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(void)PyCell_Set(cell, (PyObject *) type);
|
2023-05-01 20:34:43 -06:00
|
|
|
if (PyDict_DelItem(dict, &_Py_ID(__classcell__)) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-15 20:36:23 -07:00
|
|
|
static int
|
2025-04-17 03:04:42 -07:00
|
|
|
type_new_set_classdictcell(PyObject *dict)
|
2023-05-15 20:36:23 -07:00
|
|
|
{
|
|
|
|
|
PyObject *cell = PyDict_GetItemWithError(dict, &_Py_ID(__classdictcell__));
|
|
|
|
|
if (cell == NULL) {
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* At least one method requires a reference to the dict of its defining class */
|
|
|
|
|
if (!PyCell_Check(cell)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"__classdictcell__ must be a nonlocal cell, not %.200R",
|
|
|
|
|
Py_TYPE(cell));
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(void)PyCell_Set(cell, (PyObject *)dict);
|
|
|
|
|
if (PyDict_DelItem(dict, &_Py_ID(__classdictcell__)) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
type_new_set_attrs(const type_new_ctx *ctx, PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
if (type_new_set_name(ctx, type) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-17 03:04:42 -07:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
|
|
|
|
assert(dict);
|
|
|
|
|
|
|
|
|
|
if (type_new_set_module(dict) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-17 03:04:42 -07:00
|
|
|
if (type_new_set_ht_name(type, dict) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-17 03:04:42 -07:00
|
|
|
if (type_new_set_doc(type, dict) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Special-case __new__: if it's a plain function,
|
|
|
|
|
make it a static function */
|
2025-04-17 03:04:42 -07:00
|
|
|
if (type_new_staticmethod(dict, &_Py_ID(__new__)) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Special-case __init_subclass__ and __class_getitem__:
|
|
|
|
|
if they are plain functions, make them classmethods */
|
2025-04-17 03:04:42 -07:00
|
|
|
if (type_new_classmethod(dict, &_Py_ID(__init_subclass__)) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2025-04-17 03:04:42 -07:00
|
|
|
if (type_new_classmethod(dict, &_Py_ID(__class_getitem__)) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type_new_descriptors(ctx, type) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type_new_set_slots(ctx, type);
|
|
|
|
|
|
2025-04-17 03:04:42 -07:00
|
|
|
if (type_new_set_classcell(type, dict) < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2025-04-17 03:04:42 -07:00
|
|
|
if (type_new_set_classdictcell(dict) < 0) {
|
2023-05-15 20:36:23 -07:00
|
|
|
return -1;
|
|
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
type_new_get_slots(type_new_ctx *ctx, PyObject *dict)
|
|
|
|
|
{
|
2022-02-08 13:39:07 -07:00
|
|
|
PyObject *slots = PyDict_GetItemWithError(dict, &_Py_ID(__slots__));
|
2021-04-10 23:15:32 +02:00
|
|
|
if (slots == NULL) {
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
2019-02-25 17:59:46 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
ctx->slots = NULL;
|
|
|
|
|
ctx->nslot = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Make it into a tuple
|
|
|
|
|
PyObject *new_slots;
|
|
|
|
|
if (PyUnicode_Check(slots)) {
|
|
|
|
|
new_slots = PyTuple_Pack(1, slots);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
new_slots = PySequence_Tuple(slots);
|
|
|
|
|
}
|
|
|
|
|
if (new_slots == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
assert(PyTuple_CheckExact(new_slots));
|
|
|
|
|
ctx->slots = new_slots;
|
|
|
|
|
ctx->nslot = PyTuple_GET_SIZE(new_slots);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static PyTypeObject*
|
|
|
|
|
type_new_init(type_new_ctx *ctx)
|
|
|
|
|
{
|
|
|
|
|
PyObject *dict = PyDict_Copy(ctx->orig_dict);
|
|
|
|
|
if (dict == NULL) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type_new_get_slots(ctx, dict) < 0) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
assert(!PyErr_Occurred());
|
|
|
|
|
|
|
|
|
|
if (type_new_slots(ctx, dict) < 0) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyTypeObject *type = type_new_alloc(ctx);
|
|
|
|
|
if (type == NULL) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
set_tp_dict(type, dict);
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
PyHeapTypeObject *et = (PyHeapTypeObject*)type;
|
|
|
|
|
et->ht_slots = ctx->slots;
|
|
|
|
|
ctx->slots = NULL;
|
|
|
|
|
|
|
|
|
|
return type;
|
|
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
Py_CLEAR(ctx->slots);
|
|
|
|
|
Py_XDECREF(dict);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static PyObject*
|
|
|
|
|
type_new_impl(type_new_ctx *ctx)
|
|
|
|
|
{
|
|
|
|
|
PyTypeObject *type = type_new_init(ctx);
|
|
|
|
|
if (type == NULL) {
|
|
|
|
|
return NULL;
|
2019-02-25 17:59:46 +02:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
if (type_new_set_attrs(ctx, type) < 0) {
|
2019-02-25 17:59:46 +02:00
|
|
|
goto error;
|
2016-09-11 14:45:49 +10:00
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Initialize the rest */
|
2021-04-10 23:15:32 +02:00
|
|
|
if (PyType_Ready(type) < 0) {
|
2012-02-25 01:22:36 +01:00
|
|
|
goto error;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
// Put the proper slots in place
|
2010-05-09 15:52:27 +00:00
|
|
|
fixup_slot_dispatchers(type);
|
|
|
|
|
|
2024-01-29 02:05:29 +03:00
|
|
|
if (!_PyDict_HasOnlyStringKeys(type->tp_dict)) {
|
|
|
|
|
if (PyErr_WarnFormat(
|
|
|
|
|
PyExc_RuntimeWarning,
|
|
|
|
|
1,
|
|
|
|
|
"non-string key in the __dict__ of class %.200s",
|
|
|
|
|
type->tp_name) == -1)
|
|
|
|
|
{
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
if (type_new_set_names(type) < 0) {
|
2016-07-30 16:26:03 +10:00
|
|
|
goto error;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
2016-07-30 16:26:03 +10:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
if (type_new_init_subclass(type, ctx->kwds) < 0) {
|
2016-07-30 16:26:03 +10:00
|
|
|
goto error;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
2021-04-30 12:46:15 +02:00
|
|
|
|
|
|
|
|
assert(_PyType_CheckConsistency(type));
|
2021-10-13 14:19:34 +01:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return (PyObject *)type;
|
2012-02-25 01:22:36 +01:00
|
|
|
|
|
|
|
|
error:
|
2021-04-10 23:15:32 +02:00
|
|
|
Py_DECREF(type);
|
2012-02-25 01:22:36 +01:00
|
|
|
return NULL;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
type_new_get_bases(type_new_ctx *ctx, PyObject **type)
|
|
|
|
|
{
|
|
|
|
|
Py_ssize_t nbases = PyTuple_GET_SIZE(ctx->bases);
|
|
|
|
|
if (nbases == 0) {
|
|
|
|
|
// Adjust for empty tuple bases
|
|
|
|
|
ctx->base = &PyBaseObject_Type;
|
|
|
|
|
PyObject *new_bases = PyTuple_Pack(1, ctx->base);
|
|
|
|
|
if (new_bases == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
ctx->bases = new_bases;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Py_ssize_t i = 0; i < nbases; i++) {
|
|
|
|
|
PyObject *base = PyTuple_GET_ITEM(ctx->bases, i);
|
|
|
|
|
if (PyType_Check(base)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2023-09-17 14:23:31 +03:00
|
|
|
int rc = PyObject_HasAttrWithError(base, &_Py_ID(__mro_entries__));
|
|
|
|
|
if (rc < 0) {
|
2021-04-10 23:15:32 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2023-09-17 14:23:31 +03:00
|
|
|
if (rc) {
|
2021-04-10 23:15:32 +02:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"type() doesn't support MRO entry resolution; "
|
|
|
|
|
"use types.new_class()");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Search the bases for the proper metatype to deal with this
|
|
|
|
|
PyTypeObject *winner;
|
|
|
|
|
winner = _PyType_CalculateMetaclass(ctx->metatype, ctx->bases);
|
|
|
|
|
if (winner == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (winner != ctx->metatype) {
|
|
|
|
|
if (winner->tp_new != type_new) {
|
|
|
|
|
/* Pass it to the winner */
|
|
|
|
|
*type = winner->tp_new(winner, ctx->args, ctx->kwds);
|
2021-05-25 22:28:10 +02:00
|
|
|
if (*type == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ctx->metatype = winner;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Calculate best base, and check that all bases are type objects */
|
2025-04-28 23:38:29 -07:00
|
|
|
PyTypeObject *base = best_base(ctx->bases);
|
2021-04-10 23:15:32 +02:00
|
|
|
if (base == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ctx->base = base;
|
|
|
|
|
ctx->bases = Py_NewRef(ctx->bases);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
|
|
|
|
assert(args != NULL && PyTuple_Check(args));
|
|
|
|
|
assert(kwds == NULL || PyDict_Check(kwds));
|
|
|
|
|
|
|
|
|
|
/* Parse arguments: (name, bases, dict) */
|
|
|
|
|
PyObject *name, *bases, *orig_dict;
|
|
|
|
|
if (!PyArg_ParseTuple(args, "UO!O!:type.__new__",
|
|
|
|
|
&name,
|
|
|
|
|
&PyTuple_Type, &bases,
|
|
|
|
|
&PyDict_Type, &orig_dict))
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type_new_ctx ctx = {
|
|
|
|
|
.metatype = metatype,
|
|
|
|
|
.args = args,
|
|
|
|
|
.kwds = kwds,
|
|
|
|
|
.orig_dict = orig_dict,
|
|
|
|
|
.name = name,
|
|
|
|
|
.bases = bases,
|
|
|
|
|
.base = NULL,
|
|
|
|
|
.slots = NULL,
|
|
|
|
|
.nslot = 0,
|
|
|
|
|
.add_dict = 0,
|
|
|
|
|
.add_weak = 0,
|
|
|
|
|
.may_add_dict = 0,
|
|
|
|
|
.may_add_weak = 0};
|
|
|
|
|
PyObject *type = NULL;
|
|
|
|
|
int res = type_new_get_bases(&ctx, &type);
|
|
|
|
|
if (res < 0) {
|
2021-05-25 22:28:10 +02:00
|
|
|
assert(PyErr_Occurred());
|
2021-04-10 23:15:32 +02:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (res == 1) {
|
|
|
|
|
assert(type != NULL);
|
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
assert(ctx.base != NULL);
|
|
|
|
|
assert(ctx.bases != NULL);
|
|
|
|
|
|
|
|
|
|
type = type_new_impl(&ctx);
|
|
|
|
|
Py_DECREF(ctx.bases);
|
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-02-21 21:59:16 -05:00
|
|
|
static PyObject *
|
|
|
|
|
type_vectorcall(PyObject *metatype, PyObject *const *args,
|
|
|
|
|
size_t nargsf, PyObject *kwnames)
|
|
|
|
|
{
|
|
|
|
|
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
|
|
|
|
|
if (nargs == 1 && metatype == (PyObject *)&PyType_Type){
|
|
|
|
|
if (!_PyArg_NoKwnames("type", kwnames)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return Py_NewRef(Py_TYPE(args[0]));
|
|
|
|
|
}
|
|
|
|
|
/* In other (much less common) cases, fall back to
|
|
|
|
|
more flexible calling conventions. */
|
2021-10-13 14:09:13 +02:00
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
2021-02-21 21:59:16 -05:00
|
|
|
return _PyObject_MakeTpCall(tstate, metatype, args, nargs, kwnames);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-11 04:53:46 +08:00
|
|
|
/* An array of type slot offsets corresponding to Py_tp_* constants,
|
|
|
|
|
* for use in e.g. PyType_Spec and PyType_GetSlot.
|
|
|
|
|
* Each entry has two offsets: "slot_offset" and "subslot_offset".
|
|
|
|
|
* If is subslot_offset is -1, slot_offset is an offset within the
|
|
|
|
|
* PyTypeObject struct.
|
|
|
|
|
* Otherwise slot_offset is an offset to a pointer to a sub-slots struct
|
|
|
|
|
* (such as "tp_as_number"), and subslot_offset is the offset within
|
|
|
|
|
* that struct.
|
|
|
|
|
* The actual table is generated by a script.
|
|
|
|
|
*/
|
|
|
|
|
static const PySlot_Offset pyslot_offsets[] = {
|
|
|
|
|
{0, 0},
|
2010-12-03 20:14:31 +00:00
|
|
|
#include "typeslots.inc"
|
|
|
|
|
};
|
|
|
|
|
|
2023-05-04 09:56:53 +02:00
|
|
|
/* Align up to the nearest multiple of alignof(max_align_t)
|
|
|
|
|
* (like _Py_ALIGN_UP, but for a size rather than pointer)
|
|
|
|
|
*/
|
|
|
|
|
static Py_ssize_t
|
|
|
|
|
_align_up(Py_ssize_t size)
|
|
|
|
|
{
|
|
|
|
|
return (size + ALIGNOF_MAX_ALIGN_T - 1) & ~(ALIGNOF_MAX_ALIGN_T - 1);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-09 08:11:08 -07:00
|
|
|
/* Given a PyType_FromMetaclass `bases` argument (NULL, type, or tuple of
|
|
|
|
|
* types), return a tuple of types.
|
|
|
|
|
*/
|
|
|
|
|
inline static PyObject *
|
|
|
|
|
get_bases_tuple(PyObject *bases_in, PyType_Spec *spec)
|
|
|
|
|
{
|
|
|
|
|
if (!bases_in) {
|
|
|
|
|
/* Default: look in the spec, fall back to (type,). */
|
|
|
|
|
PyTypeObject *base = &PyBaseObject_Type; // borrowed ref
|
|
|
|
|
PyObject *bases = NULL; // borrowed ref
|
|
|
|
|
const PyType_Slot *slot;
|
|
|
|
|
for (slot = spec->slots; slot->slot; slot++) {
|
|
|
|
|
switch (slot->slot) {
|
|
|
|
|
case Py_tp_base:
|
|
|
|
|
base = slot->pfunc;
|
|
|
|
|
break;
|
|
|
|
|
case Py_tp_bases:
|
|
|
|
|
bases = slot->pfunc;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!bases) {
|
|
|
|
|
return PyTuple_Pack(1, base);
|
|
|
|
|
}
|
|
|
|
|
if (PyTuple_Check(bases)) {
|
|
|
|
|
return Py_NewRef(bases);
|
|
|
|
|
}
|
|
|
|
|
PyErr_SetString(PyExc_SystemError, "Py_tp_bases is not a tuple");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (PyTuple_Check(bases_in)) {
|
|
|
|
|
return Py_NewRef(bases_in);
|
|
|
|
|
}
|
|
|
|
|
// Not a tuple, should be a single type
|
|
|
|
|
return PyTuple_Pack(1, bases_in);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
static inline int
|
|
|
|
|
check_basicsize_includes_size_and_offsets(PyTypeObject* type)
|
|
|
|
|
{
|
|
|
|
|
if (type->tp_alloc != PyType_GenericAlloc) {
|
|
|
|
|
// Custom allocators can ignore tp_basicsize
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
Py_ssize_t max = (Py_ssize_t)type->tp_basicsize;
|
|
|
|
|
|
|
|
|
|
if (type->tp_base && type->tp_base->tp_basicsize > type->tp_basicsize) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"tp_basicsize for type '%s' (%d) is too small for base '%s' (%d)",
|
|
|
|
|
type->tp_name, type->tp_basicsize,
|
|
|
|
|
type->tp_base->tp_name, type->tp_base->tp_basicsize);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (type->tp_weaklistoffset + (Py_ssize_t)sizeof(PyObject*) > max) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"weaklist offset %d is out of bounds for type '%s' (tp_basicsize = %d)",
|
|
|
|
|
type->tp_weaklistoffset,
|
|
|
|
|
type->tp_name, type->tp_basicsize);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (type->tp_dictoffset + (Py_ssize_t)sizeof(PyObject*) > max) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"dict offset %d is out of bounds for type '%s' (tp_basicsize = %d)",
|
|
|
|
|
type->tp_dictoffset,
|
|
|
|
|
type->tp_name, type->tp_basicsize);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (type->tp_vectorcall_offset + (Py_ssize_t)sizeof(vectorcallfunc*) > max) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"vectorcall offset %d is out of bounds for type '%s' (tp_basicsize = %d)",
|
|
|
|
|
type->tp_vectorcall_offset,
|
|
|
|
|
type->tp_name, type->tp_basicsize);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-25 11:12:48 +02:00
|
|
|
static int
|
|
|
|
|
check_immutable_bases(const char *type_name, PyObject *bases, int skip_first)
|
|
|
|
|
{
|
|
|
|
|
Py_ssize_t i = 0;
|
|
|
|
|
if (skip_first) {
|
|
|
|
|
// When testing the MRO, skip the type itself
|
|
|
|
|
i = 1;
|
|
|
|
|
}
|
|
|
|
|
for (; i<PyTuple_GET_SIZE(bases); i++) {
|
|
|
|
|
PyTypeObject *b = (PyTypeObject*)PyTuple_GET_ITEM(bases, i);
|
|
|
|
|
if (!b) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!_PyType_HasFeature(b, Py_TPFLAGS_IMMUTABLETYPE)) {
|
|
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_TypeError,
|
|
|
|
|
"Creating immutable type %s from mutable base %N",
|
|
|
|
|
type_name, b
|
|
|
|
|
);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-09-05 14:14:05 +02:00
|
|
|
/* Set *dest to the offset specified by a special "__*offset__" member.
|
|
|
|
|
* Return 0 on success, -1 on failure.
|
|
|
|
|
*/
|
|
|
|
|
static inline int
|
|
|
|
|
special_offset_from_member(
|
|
|
|
|
const PyMemberDef *memb /* may be NULL */,
|
|
|
|
|
Py_ssize_t type_data_offset,
|
|
|
|
|
Py_ssize_t *dest /* not NULL */)
|
|
|
|
|
{
|
|
|
|
|
if (memb == NULL) {
|
|
|
|
|
*dest = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (memb->type != Py_T_PYSSIZET) {
|
|
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_SystemError,
|
|
|
|
|
"type of %s must be Py_T_PYSSIZET",
|
|
|
|
|
memb->name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (memb->flags == Py_READONLY) {
|
|
|
|
|
*dest = memb->offset;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else if (memb->flags == (Py_READONLY | Py_RELATIVE_OFFSET)) {
|
|
|
|
|
*dest = memb->offset + type_data_offset;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_SystemError,
|
|
|
|
|
"flags for %s must be Py_READONLY or (Py_READONLY | Py_RELATIVE_OFFSET)",
|
|
|
|
|
memb->name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-13 13:18:49 +02:00
|
|
|
PyObject *
|
|
|
|
|
PyType_FromMetaclass(
|
2023-05-03 15:17:14 +02:00
|
|
|
PyTypeObject *metaclass, PyObject *module,
|
2024-09-13 13:18:49 +02:00
|
|
|
PyType_Spec *spec, PyObject *bases_in)
|
2010-12-03 20:14:31 +00:00
|
|
|
{
|
2022-06-14 11:13:29 +02:00
|
|
|
/* Invariant: A non-NULL value in one of these means this function holds
|
|
|
|
|
* a strong reference or owns allocated memory.
|
|
|
|
|
* These get decrefed/freed/returned at the end, on both success and error.
|
|
|
|
|
*/
|
2022-06-09 08:11:08 -07:00
|
|
|
PyHeapTypeObject *res = NULL;
|
|
|
|
|
PyTypeObject *type;
|
|
|
|
|
PyObject *bases = NULL;
|
2022-06-14 11:13:29 +02:00
|
|
|
char *tp_doc = NULL;
|
|
|
|
|
PyObject *ht_name = NULL;
|
|
|
|
|
char *_ht_tpname = NULL;
|
|
|
|
|
|
2020-10-26 12:47:57 +02:00
|
|
|
int r;
|
2018-11-13 04:09:31 -08:00
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
/* Prepare slots that need special handling.
|
|
|
|
|
* Keep in mind that a slot can be given multiple times:
|
|
|
|
|
* if that would cause trouble (leaks, UB, ...), raise an exception.
|
|
|
|
|
*/
|
|
|
|
|
|
2020-04-09 20:05:38 -05:00
|
|
|
const PyType_Slot *slot;
|
2022-06-10 15:55:09 +02:00
|
|
|
Py_ssize_t nmembers = 0;
|
2024-09-05 14:14:05 +02:00
|
|
|
const PyMemberDef *weaklistoffset_member = NULL;
|
|
|
|
|
const PyMemberDef *dictoffset_member = NULL;
|
|
|
|
|
const PyMemberDef *vectorcalloffset_member = NULL;
|
2020-04-09 20:05:38 -05:00
|
|
|
char *res_start;
|
2018-11-13 04:09:31 -08:00
|
|
|
|
|
|
|
|
for (slot = spec->slots; slot->slot; slot++) {
|
2022-06-14 11:13:29 +02:00
|
|
|
if (slot->slot < 0
|
|
|
|
|
|| (size_t)slot->slot >= Py_ARRAY_LENGTH(pyslot_offsets)) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError, "invalid slot offset");
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
switch (slot->slot) {
|
|
|
|
|
case Py_tp_members:
|
2022-06-10 15:55:09 +02:00
|
|
|
if (nmembers != 0) {
|
|
|
|
|
PyErr_SetString(
|
|
|
|
|
PyExc_SystemError,
|
|
|
|
|
"Multiple Py_tp_members slots are not supported.");
|
2022-06-14 11:13:29 +02:00
|
|
|
goto finally;
|
2022-06-10 15:55:09 +02:00
|
|
|
}
|
2020-04-09 20:05:38 -05:00
|
|
|
for (const PyMemberDef *memb = slot->pfunc; memb->name != NULL; memb++) {
|
2018-11-13 04:09:31 -08:00
|
|
|
nmembers++;
|
2023-05-04 09:56:53 +02:00
|
|
|
if (memb->flags & Py_RELATIVE_OFFSET) {
|
|
|
|
|
if (spec->basicsize > 0) {
|
|
|
|
|
PyErr_SetString(
|
|
|
|
|
PyExc_SystemError,
|
|
|
|
|
"With Py_RELATIVE_OFFSET, basicsize must be negative.");
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
if (memb->offset < 0 || memb->offset >= -spec->basicsize) {
|
|
|
|
|
PyErr_SetString(
|
|
|
|
|
PyExc_SystemError,
|
|
|
|
|
"Member offset out of range (0..-basicsize)");
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-05 14:14:05 +02:00
|
|
|
if (strcmp(memb->name, "__weaklistoffset__") == 0) {
|
|
|
|
|
weaklistoffset_member = memb;
|
|
|
|
|
}
|
2024-11-14 02:09:26 +09:00
|
|
|
else if (strcmp(memb->name, "__dictoffset__") == 0) {
|
2024-09-05 14:14:05 +02:00
|
|
|
dictoffset_member = memb;
|
|
|
|
|
}
|
2024-11-14 02:09:26 +09:00
|
|
|
else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
|
2024-09-05 14:14:05 +02:00
|
|
|
vectorcalloffset_member = memb;
|
|
|
|
|
}
|
2018-11-13 04:09:31 -08:00
|
|
|
}
|
2022-06-14 11:13:29 +02:00
|
|
|
break;
|
|
|
|
|
case Py_tp_doc:
|
|
|
|
|
/* For the docstring slot, which usually points to a static string
|
|
|
|
|
literal, we need to make a copy */
|
|
|
|
|
if (tp_doc != NULL) {
|
|
|
|
|
PyErr_SetString(
|
|
|
|
|
PyExc_SystemError,
|
|
|
|
|
"Multiple Py_tp_doc slots are not supported.");
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
if (slot->pfunc == NULL) {
|
2024-01-26 11:11:35 +01:00
|
|
|
PyMem_Free(tp_doc);
|
2022-06-14 11:13:29 +02:00
|
|
|
tp_doc = NULL;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
size_t len = strlen(slot->pfunc)+1;
|
2024-01-26 11:11:35 +01:00
|
|
|
tp_doc = PyMem_Malloc(len);
|
2022-06-14 11:13:29 +02:00
|
|
|
if (tp_doc == NULL) {
|
|
|
|
|
PyErr_NoMemory();
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
memcpy(tp_doc, slot->pfunc, len);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2018-11-13 04:09:31 -08:00
|
|
|
}
|
|
|
|
|
}
|
2013-07-11 22:42:25 +02:00
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
/* Prepare the type name and qualname */
|
|
|
|
|
|
2018-08-25 21:53:47 +03:00
|
|
|
if (spec->name == NULL) {
|
|
|
|
|
PyErr_SetString(PyExc_SystemError,
|
|
|
|
|
"Type spec does not define the name field.");
|
2022-06-09 08:11:08 -07:00
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
const char *s = strrchr(spec->name, '.');
|
|
|
|
|
if (s == NULL) {
|
|
|
|
|
s = spec->name;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
s++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ht_name = PyUnicode_FromString(s);
|
|
|
|
|
if (!ht_name) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Copy spec->name to a buffer we own.
|
|
|
|
|
*
|
|
|
|
|
* Unfortunately, we can't use tp_name directly (with some
|
|
|
|
|
* flag saying that it should be deallocated with the type),
|
|
|
|
|
* because tp_name is public API and may be set independently
|
|
|
|
|
* of any such flag.
|
|
|
|
|
* So, we use a separate buffer, _ht_tpname, that's always
|
|
|
|
|
* deallocated with the type (if it's non-NULL).
|
|
|
|
|
*/
|
|
|
|
|
Py_ssize_t name_buf_len = strlen(spec->name) + 1;
|
|
|
|
|
_ht_tpname = PyMem_Malloc(name_buf_len);
|
|
|
|
|
if (_ht_tpname == NULL) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
memcpy(_ht_tpname, spec->name, name_buf_len);
|
|
|
|
|
|
2022-06-09 08:11:08 -07:00
|
|
|
/* Get a tuple of bases.
|
|
|
|
|
* bases is a strong reference (unlike bases_in).
|
|
|
|
|
*/
|
|
|
|
|
bases = get_bases_tuple(bases_in, spec);
|
|
|
|
|
if (!bases) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-04 16:13:45 +02:00
|
|
|
/* If this is an immutable type, check if all bases are also immutable,
|
|
|
|
|
* and (for now) fire a deprecation warning if not.
|
|
|
|
|
* (This isn't necessary for static types: those can't have heap bases,
|
|
|
|
|
* and only heap types can be mutable.)
|
|
|
|
|
*/
|
|
|
|
|
if (spec->flags & Py_TPFLAGS_IMMUTABLETYPE) {
|
2024-10-25 11:12:48 +02:00
|
|
|
if (check_immutable_bases(spec->name, bases, 0) < 0) {
|
|
|
|
|
goto finally;
|
2022-08-04 16:13:45 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-09 08:11:08 -07:00
|
|
|
/* Calculate the metaclass */
|
|
|
|
|
|
|
|
|
|
if (!metaclass) {
|
|
|
|
|
metaclass = &PyType_Type;
|
|
|
|
|
}
|
|
|
|
|
metaclass = _PyType_CalculateMetaclass(metaclass, bases);
|
|
|
|
|
if (metaclass == NULL) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
if (!PyType_Check(metaclass)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"Metaclass '%R' is not a subclass of 'type'.",
|
|
|
|
|
metaclass);
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
2023-06-12 17:45:49 +02:00
|
|
|
if (metaclass->tp_new && metaclass->tp_new != PyType_Type.tp_new) {
|
2024-09-13 13:18:49 +02:00
|
|
|
PyErr_SetString(
|
|
|
|
|
PyExc_TypeError,
|
|
|
|
|
"Metaclasses with custom tp_new are not supported.");
|
|
|
|
|
goto finally;
|
2022-06-09 08:11:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Calculate best base, and check that all bases are type objects */
|
2025-04-28 23:38:29 -07:00
|
|
|
PyTypeObject *base = best_base(bases); // borrowed ref
|
2022-06-09 08:11:08 -07:00
|
|
|
if (base == NULL) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
2025-04-28 23:38:29 -07:00
|
|
|
// best_base should check Py_TPFLAGS_BASETYPE & raise a proper exception,
|
|
|
|
|
// here we just check its work
|
2022-06-09 08:11:08 -07:00
|
|
|
assert(_PyType_HasFeature(base, Py_TPFLAGS_BASETYPE));
|
|
|
|
|
|
2023-05-04 09:56:53 +02:00
|
|
|
/* Calculate sizes */
|
|
|
|
|
|
|
|
|
|
Py_ssize_t basicsize = spec->basicsize;
|
|
|
|
|
Py_ssize_t type_data_offset = spec->basicsize;
|
|
|
|
|
if (basicsize == 0) {
|
|
|
|
|
/* Inherit */
|
|
|
|
|
basicsize = base->tp_basicsize;
|
|
|
|
|
}
|
|
|
|
|
else if (basicsize < 0) {
|
|
|
|
|
/* Extend */
|
|
|
|
|
type_data_offset = _align_up(base->tp_basicsize);
|
|
|
|
|
basicsize = type_data_offset + _align_up(-spec->basicsize);
|
|
|
|
|
|
|
|
|
|
/* Inheriting variable-sized types is limited */
|
|
|
|
|
if (base->tp_itemsize
|
|
|
|
|
&& !((base->tp_flags | spec->flags) & Py_TPFLAGS_ITEMS_AT_END))
|
|
|
|
|
{
|
|
|
|
|
PyErr_SetString(
|
|
|
|
|
PyExc_SystemError,
|
|
|
|
|
"Cannot extend variable-size class without Py_TPFLAGS_ITEMS_AT_END.");
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Py_ssize_t itemsize = spec->itemsize;
|
|
|
|
|
|
2024-09-05 14:14:05 +02:00
|
|
|
/* Compute special offsets */
|
|
|
|
|
|
|
|
|
|
Py_ssize_t weaklistoffset = 0;
|
|
|
|
|
if (special_offset_from_member(weaklistoffset_member, type_data_offset,
|
|
|
|
|
&weaklistoffset) < 0) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
Py_ssize_t dictoffset = 0;
|
|
|
|
|
if (special_offset_from_member(dictoffset_member, type_data_offset,
|
|
|
|
|
&dictoffset) < 0) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
Py_ssize_t vectorcalloffset = 0;
|
|
|
|
|
if (special_offset_from_member(vectorcalloffset_member, type_data_offset,
|
|
|
|
|
&vectorcalloffset) < 0) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
/* Allocate the new type
|
|
|
|
|
*
|
|
|
|
|
* Between here and PyType_Ready, we should limit:
|
|
|
|
|
* - calls to Python code
|
|
|
|
|
* - raising exceptions
|
|
|
|
|
* - memory allocations
|
|
|
|
|
*/
|
2022-06-09 08:11:08 -07:00
|
|
|
|
|
|
|
|
res = (PyHeapTypeObject*)metaclass->tp_alloc(metaclass, nmembers);
|
|
|
|
|
if (res == NULL) {
|
|
|
|
|
goto finally;
|
2018-08-25 21:53:47 +03:00
|
|
|
}
|
2022-06-09 08:11:08 -07:00
|
|
|
res_start = (char*)res;
|
2018-08-25 21:53:47 +03:00
|
|
|
|
2021-10-21 11:46:20 +02:00
|
|
|
type = &res->ht_type;
|
|
|
|
|
/* The flags must be initialized early, before the GC traverses us */
|
2025-02-25 21:24:20 -08:00
|
|
|
type_set_flags(type, spec->flags | Py_TPFLAGS_HEAPTYPE);
|
2021-10-21 11:46:20 +02:00
|
|
|
|
|
|
|
|
res->ht_module = Py_XNewRef(module);
|
2020-05-07 15:39:59 +02:00
|
|
|
|
2012-06-23 23:20:45 +02:00
|
|
|
/* Initialize essential fields */
|
2022-06-14 11:13:29 +02:00
|
|
|
|
2015-05-11 22:57:16 -04:00
|
|
|
type->tp_as_async = &res->as_async;
|
2012-06-23 23:20:45 +02:00
|
|
|
type->tp_as_number = &res->as_number;
|
|
|
|
|
type->tp_as_sequence = &res->as_sequence;
|
|
|
|
|
type->tp_as_mapping = &res->as_mapping;
|
|
|
|
|
type->tp_as_buffer = &res->as_buffer;
|
2022-06-09 08:11:08 -07:00
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
/* Set slots we have prepared */
|
|
|
|
|
|
2022-06-09 08:11:08 -07:00
|
|
|
type->tp_base = (PyTypeObject *)Py_NewRef(base);
|
2024-06-03 19:09:18 -04:00
|
|
|
set_tp_bases(type, bases, 1);
|
2022-06-09 08:11:08 -07:00
|
|
|
bases = NULL; // We give our reference to bases to the type
|
2010-12-03 20:14:31 +00:00
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
type->tp_doc = tp_doc;
|
|
|
|
|
tp_doc = NULL; // Give ownership of the allocated memory to the type
|
|
|
|
|
|
|
|
|
|
res->ht_qualname = Py_NewRef(ht_name);
|
|
|
|
|
res->ht_name = ht_name;
|
2023-03-02 16:26:49 +01:00
|
|
|
ht_name = NULL; // Give our reference to the type
|
2022-06-14 11:13:29 +02:00
|
|
|
|
|
|
|
|
type->tp_name = _ht_tpname;
|
|
|
|
|
res->_ht_tpname = _ht_tpname;
|
2023-03-02 16:26:49 +01:00
|
|
|
_ht_tpname = NULL; // Give ownership to the type
|
2022-06-14 11:13:29 +02:00
|
|
|
|
2022-06-09 08:11:08 -07:00
|
|
|
/* Copy the sizes */
|
2022-06-14 11:13:29 +02:00
|
|
|
|
2023-05-04 09:56:53 +02:00
|
|
|
type->tp_basicsize = basicsize;
|
|
|
|
|
type->tp_itemsize = itemsize;
|
2011-01-04 12:59:15 +00:00
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
/* Copy all the ordinary slots */
|
|
|
|
|
|
2010-12-03 20:14:31 +00:00
|
|
|
for (slot = spec->slots; slot->slot; slot++) {
|
2022-06-14 11:13:29 +02:00
|
|
|
switch (slot->slot) {
|
|
|
|
|
case Py_tp_base:
|
|
|
|
|
case Py_tp_bases:
|
|
|
|
|
case Py_tp_doc:
|
2012-06-23 23:20:45 +02:00
|
|
|
/* Processed above */
|
2022-06-14 11:13:29 +02:00
|
|
|
break;
|
|
|
|
|
case Py_tp_members:
|
|
|
|
|
{
|
|
|
|
|
/* Move the slots to the heap type itself */
|
|
|
|
|
size_t len = Py_TYPE(type)->tp_itemsize * nmembers;
|
|
|
|
|
memcpy(_PyHeapType_GET_MEMBERS(res), slot->pfunc, len);
|
|
|
|
|
type->tp_members = _PyHeapType_GET_MEMBERS(res);
|
2023-05-04 09:56:53 +02:00
|
|
|
PyMemberDef *memb;
|
|
|
|
|
Py_ssize_t i;
|
|
|
|
|
for (memb = _PyHeapType_GET_MEMBERS(res), i = nmembers;
|
|
|
|
|
i > 0; ++memb, --i)
|
|
|
|
|
{
|
|
|
|
|
if (memb->flags & Py_RELATIVE_OFFSET) {
|
|
|
|
|
memb->flags &= ~Py_RELATIVE_OFFSET;
|
|
|
|
|
memb->offset += type_data_offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-07-15 19:34:20 +02:00
|
|
|
}
|
2022-06-14 11:13:29 +02:00
|
|
|
break;
|
2024-09-18 16:18:19 +09:00
|
|
|
case Py_tp_token:
|
|
|
|
|
{
|
|
|
|
|
res->ht_token = slot->pfunc == Py_TP_USE_SPEC ? spec : slot->pfunc;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2022-06-14 11:13:29 +02:00
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
/* Copy other slots directly */
|
|
|
|
|
PySlot_Offset slotoffsets = pyslot_offsets[slot->slot];
|
|
|
|
|
short slot_offset = slotoffsets.slot_offset;
|
|
|
|
|
if (slotoffsets.subslot_offset == -1) {
|
2023-05-04 09:56:53 +02:00
|
|
|
/* Set a slot in the main PyTypeObject */
|
2022-06-14 11:13:29 +02:00
|
|
|
*(void**)((char*)res_start + slot_offset) = slot->pfunc;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
void *procs = *(void**)((char*)res_start + slot_offset);
|
|
|
|
|
short subslot_offset = slotoffsets.subslot_offset;
|
|
|
|
|
*(void**)((char*)procs + subslot_offset) = slot->pfunc;
|
|
|
|
|
}
|
2020-11-11 04:53:46 +08:00
|
|
|
}
|
2022-06-14 11:13:29 +02:00
|
|
|
break;
|
2019-06-03 01:31:12 +02:00
|
|
|
}
|
2010-12-03 20:14:31 +00:00
|
|
|
}
|
2012-06-24 00:18:27 +02:00
|
|
|
if (type->tp_dealloc == NULL) {
|
2012-06-23 14:42:38 +02:00
|
|
|
/* It's a heap type, so needs the heap types' dealloc.
|
|
|
|
|
subtype_dealloc will call the base type's tp_dealloc, if
|
|
|
|
|
necessary. */
|
2012-06-24 00:18:27 +02:00
|
|
|
type->tp_dealloc = subtype_dealloc;
|
2012-06-23 14:42:38 +02:00
|
|
|
}
|
2010-12-03 20:14:31 +00:00
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
/* Set up offsets */
|
|
|
|
|
|
|
|
|
|
type->tp_vectorcall_offset = vectorcalloffset;
|
|
|
|
|
type->tp_weaklistoffset = weaklistoffset;
|
|
|
|
|
type->tp_dictoffset = dictoffset;
|
|
|
|
|
|
2024-08-06 14:36:57 -04:00
|
|
|
#ifdef Py_GIL_DISABLED
|
2024-10-15 15:06:41 -04:00
|
|
|
// Assign a unique id to enable per-thread refcounting
|
2024-10-01 13:05:42 -04:00
|
|
|
res->unique_id = _PyObject_AssignUniqueId((PyObject *)res);
|
2024-08-06 14:36:57 -04:00
|
|
|
#endif
|
|
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
/* Ready the type (which includes inheritance).
|
|
|
|
|
*
|
|
|
|
|
* After this call we should generally only touch up what's
|
|
|
|
|
* accessible to Python code, like __dict__.
|
|
|
|
|
*/
|
2020-05-12 05:38:55 +08:00
|
|
|
|
2022-06-09 08:11:08 -07:00
|
|
|
if (PyType_Ready(type) < 0) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
2012-01-29 20:16:37 -05:00
|
|
|
|
2022-06-14 11:13:29 +02:00
|
|
|
if (!check_basicsize_includes_size_and_offsets(type)) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2020-09-02 11:29:06 -05:00
|
|
|
if (type->tp_doc) {
|
|
|
|
|
PyObject *__doc__ = PyUnicode_FromString(_PyType_DocWithoutSignature(type->tp_name, type->tp_doc));
|
2022-06-09 08:11:08 -07:00
|
|
|
if (!__doc__) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
r = PyDict_SetItem(dict, &_Py_ID(__doc__), __doc__);
|
2020-09-02 11:29:06 -05:00
|
|
|
Py_DECREF(__doc__);
|
2022-06-09 08:11:08 -07:00
|
|
|
if (r < 0) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
2020-09-02 11:29:06 -05:00
|
|
|
}
|
|
|
|
|
|
2019-09-19 09:29:05 -07:00
|
|
|
if (weaklistoffset) {
|
2023-05-01 20:34:43 -06:00
|
|
|
if (PyDict_DelItem(dict, &_Py_ID(__weaklistoffset__)) < 0) {
|
2022-06-09 08:11:08 -07:00
|
|
|
goto finally;
|
|
|
|
|
}
|
2019-09-19 09:29:05 -07:00
|
|
|
}
|
|
|
|
|
if (dictoffset) {
|
2023-05-01 20:34:43 -06:00
|
|
|
if (PyDict_DelItem(dict, &_Py_ID(__dictoffset__)) < 0) {
|
2022-06-09 08:11:08 -07:00
|
|
|
goto finally;
|
|
|
|
|
}
|
2019-09-19 09:29:05 -07:00
|
|
|
}
|
|
|
|
|
|
2012-06-23 23:20:45 +02:00
|
|
|
/* Set type.__module__ */
|
2023-05-01 20:34:43 -06:00
|
|
|
r = PyDict_Contains(dict, &_Py_ID(__module__));
|
2020-10-26 12:47:57 +02:00
|
|
|
if (r < 0) {
|
2022-06-09 08:11:08 -07:00
|
|
|
goto finally;
|
2020-10-26 12:47:57 +02:00
|
|
|
}
|
|
|
|
|
if (r == 0) {
|
2020-06-10 18:09:01 +02:00
|
|
|
s = strrchr(spec->name, '.');
|
|
|
|
|
if (s != NULL) {
|
2022-06-14 11:13:29 +02:00
|
|
|
PyObject *modname = PyUnicode_FromStringAndSize(
|
2020-06-10 18:09:01 +02:00
|
|
|
spec->name, (Py_ssize_t)(s - spec->name));
|
|
|
|
|
if (modname == NULL) {
|
2022-06-09 08:11:08 -07:00
|
|
|
goto finally;
|
2020-06-10 18:09:01 +02:00
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
r = PyDict_SetItem(dict, &_Py_ID(__module__), modname);
|
2022-06-14 11:13:29 +02:00
|
|
|
Py_DECREF(modname);
|
2022-06-09 08:11:08 -07:00
|
|
|
if (r != 0) {
|
|
|
|
|
goto finally;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2020-06-10 18:09:01 +02:00
|
|
|
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
|
|
|
|
|
"builtin type %.200s has no __module__ attribute",
|
|
|
|
|
spec->name))
|
2022-06-09 08:11:08 -07:00
|
|
|
goto finally;
|
2020-06-10 18:09:01 +02:00
|
|
|
}
|
2015-03-01 10:03:02 +02:00
|
|
|
}
|
2012-06-23 23:20:45 +02:00
|
|
|
|
2021-06-01 23:37:12 +02:00
|
|
|
assert(_PyType_CheckConsistency(type));
|
2011-01-04 12:59:15 +00:00
|
|
|
|
2022-06-09 08:11:08 -07:00
|
|
|
finally:
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
Py_CLEAR(res);
|
|
|
|
|
}
|
|
|
|
|
Py_XDECREF(bases);
|
2024-01-26 11:11:35 +01:00
|
|
|
PyMem_Free(tp_doc);
|
2022-06-14 11:13:29 +02:00
|
|
|
Py_XDECREF(ht_name);
|
|
|
|
|
PyMem_Free(_ht_tpname);
|
2022-06-09 08:11:08 -07:00
|
|
|
return (PyObject*)res;
|
2010-12-03 20:14:31 +00:00
|
|
|
}
|
|
|
|
|
|
2022-05-27 10:27:39 +02:00
|
|
|
PyObject *
|
|
|
|
|
PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
|
|
|
|
|
{
|
2024-09-13 13:18:49 +02:00
|
|
|
return PyType_FromMetaclass(NULL, module, spec, bases);
|
2022-05-27 10:27:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *
|
|
|
|
|
PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
|
|
|
|
|
{
|
2024-09-13 13:18:49 +02:00
|
|
|
return PyType_FromMetaclass(NULL, NULL, spec, bases);
|
2022-05-27 10:27:39 +02:00
|
|
|
}
|
|
|
|
|
|
2012-06-23 23:20:45 +02:00
|
|
|
PyObject *
|
|
|
|
|
PyType_FromSpec(PyType_Spec *spec)
|
|
|
|
|
{
|
2024-09-13 13:18:49 +02:00
|
|
|
return PyType_FromMetaclass(NULL, NULL, spec, NULL);
|
2012-06-23 23:20:45 +02:00
|
|
|
}
|
|
|
|
|
|
2021-07-29 15:57:02 +08:00
|
|
|
PyObject *
|
|
|
|
|
PyType_GetName(PyTypeObject *type)
|
|
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
return type_name((PyObject *)type, NULL);
|
2021-07-29 15:57:02 +08:00
|
|
|
}
|
|
|
|
|
|
2021-08-17 21:39:34 +08:00
|
|
|
PyObject *
|
|
|
|
|
PyType_GetQualName(PyTypeObject *type)
|
|
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
return type_qualname((PyObject *)type, NULL);
|
2021-08-17 21:39:34 +08:00
|
|
|
}
|
|
|
|
|
|
2023-11-22 15:03:33 -07:00
|
|
|
PyObject *
|
2024-03-14 19:17:43 +01:00
|
|
|
PyType_GetModuleName(PyTypeObject *type)
|
2023-11-22 15:03:33 -07:00
|
|
|
{
|
2024-03-14 19:17:43 +01:00
|
|
|
return type_module(type);
|
2023-11-22 15:03:33 -07:00
|
|
|
}
|
|
|
|
|
|
2014-02-04 09:33:05 +01:00
|
|
|
void *
|
|
|
|
|
PyType_GetSlot(PyTypeObject *type, int slot)
|
|
|
|
|
{
|
2020-11-11 04:53:46 +08:00
|
|
|
void *parent_slot;
|
|
|
|
|
int slots_len = Py_ARRAY_LENGTH(pyslot_offsets);
|
|
|
|
|
|
|
|
|
|
if (slot <= 0 || slot >= slots_len) {
|
2014-02-04 09:33:05 +01:00
|
|
|
PyErr_BadInternalCall();
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2024-09-18 16:18:19 +09:00
|
|
|
int slot_offset = pyslot_offsets[slot].slot_offset;
|
|
|
|
|
|
|
|
|
|
if (slot_offset >= (int)sizeof(PyTypeObject)) {
|
|
|
|
|
if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-11 04:53:46 +08:00
|
|
|
|
2024-09-18 16:18:19 +09:00
|
|
|
parent_slot = *(void**)((char*)type + slot_offset);
|
2020-11-11 04:53:46 +08:00
|
|
|
if (parent_slot == NULL) {
|
2014-02-04 09:33:05 +01:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2020-11-11 04:53:46 +08:00
|
|
|
/* Return slot directly if we have no sub slot. */
|
|
|
|
|
if (pyslot_offsets[slot].subslot_offset == -1) {
|
|
|
|
|
return parent_slot;
|
|
|
|
|
}
|
|
|
|
|
return *(void**)((char*)parent_slot + pyslot_offsets[slot].subslot_offset);
|
2014-02-04 09:33:05 +01:00
|
|
|
}
|
2010-12-03 20:14:31 +00:00
|
|
|
|
2020-05-07 15:39:59 +02:00
|
|
|
PyObject *
|
|
|
|
|
PyType_GetModule(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
assert(PyType_Check(type));
|
|
|
|
|
if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_TypeError,
|
|
|
|
|
"PyType_GetModule: Type '%s' is not a heap type",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyHeapTypeObject* et = (PyHeapTypeObject*)type;
|
|
|
|
|
if (!et->ht_module) {
|
|
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_TypeError,
|
|
|
|
|
"PyType_GetModule: Type '%s' has no associated module",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return et->ht_module;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *
|
|
|
|
|
PyType_GetModuleState(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
PyObject *m = PyType_GetModule(type);
|
|
|
|
|
if (m == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2021-04-22 00:52:52 +02:00
|
|
|
return _PyModule_GetState(m);
|
2020-05-07 15:39:59 +02:00
|
|
|
}
|
|
|
|
|
|
2020-11-03 22:27:12 +01:00
|
|
|
|
|
|
|
|
/* Get the module of the first superclass where the module has the
|
|
|
|
|
* given PyModuleDef.
|
|
|
|
|
*/
|
2024-09-27 01:21:11 +09:00
|
|
|
PyObject *
|
|
|
|
|
PyType_GetModuleByDef(PyTypeObject *type, PyModuleDef *def)
|
2020-11-03 22:27:12 +01:00
|
|
|
{
|
|
|
|
|
assert(PyType_Check(type));
|
2021-04-22 00:10:16 +02:00
|
|
|
|
2024-04-25 20:51:31 +09:00
|
|
|
if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
// type_ready_mro() ensures that no heap type is
|
|
|
|
|
// contained in a static type MRO.
|
2025-05-01 21:32:57 +09:00
|
|
|
goto error;
|
2024-04-25 20:51:31 +09:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
PyHeapTypeObject *ht = (PyHeapTypeObject*)type;
|
|
|
|
|
PyObject *module = ht->ht_module;
|
|
|
|
|
if (module && _PyModule_GetDef(module) == def) {
|
|
|
|
|
return module;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
PyObject *res = NULL;
|
2024-06-21 15:50:18 -04:00
|
|
|
BEGIN_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *mro = lookup_tp_mro(type);
|
2021-04-22 00:10:16 +02:00
|
|
|
// The type must be ready
|
2021-04-21 23:36:26 +02:00
|
|
|
assert(mro != NULL);
|
2021-04-22 00:10:16 +02:00
|
|
|
assert(PyTuple_Check(mro));
|
2024-04-25 20:51:31 +09:00
|
|
|
// mro_invoke() ensures that the type MRO cannot be empty.
|
2021-04-22 00:10:16 +02:00
|
|
|
assert(PyTuple_GET_SIZE(mro) >= 1);
|
2024-04-25 20:51:31 +09:00
|
|
|
// Also, the first item in the MRO is the type itself, which
|
|
|
|
|
// we already checked above. We skip it in the loop.
|
|
|
|
|
assert(PyTuple_GET_ITEM(mro, 0) == (PyObject *)type);
|
2021-04-22 00:10:16 +02:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(mro);
|
2024-04-25 20:51:31 +09:00
|
|
|
for (Py_ssize_t i = 1; i < n; i++) {
|
2021-04-21 23:36:26 +02:00
|
|
|
PyObject *super = PyTuple_GET_ITEM(mro, i);
|
2024-09-27 01:21:11 +09:00
|
|
|
if (!_PyType_HasFeature((PyTypeObject *)super, Py_TPFLAGS_HEAPTYPE)) {
|
2022-02-02 16:57:51 +01:00
|
|
|
// Static types in the MRO need to be skipped
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2021-04-21 23:36:26 +02:00
|
|
|
|
2020-11-03 22:27:12 +01:00
|
|
|
PyHeapTypeObject *ht = (PyHeapTypeObject*)super;
|
2021-04-21 23:36:26 +02:00
|
|
|
PyObject *module = ht->ht_module;
|
2021-04-22 00:52:52 +02:00
|
|
|
if (module && _PyModule_GetDef(module) == def) {
|
2024-02-15 10:54:57 -08:00
|
|
|
res = module;
|
|
|
|
|
break;
|
2020-11-03 22:27:12 +01:00
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2021-04-21 23:36:26 +02:00
|
|
|
|
2025-05-01 21:32:57 +09:00
|
|
|
if (res != NULL) {
|
|
|
|
|
return res;
|
2024-02-15 10:54:57 -08:00
|
|
|
}
|
2025-05-01 21:32:57 +09:00
|
|
|
error:
|
|
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_TypeError,
|
|
|
|
|
"PyType_GetModuleByDef: No superclass of '%s' has the given module",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return NULL;
|
2020-11-03 22:27:12 +01:00
|
|
|
}
|
|
|
|
|
|
2024-09-18 16:18:19 +09:00
|
|
|
|
|
|
|
|
static PyTypeObject *
|
2024-10-10 21:57:13 +09:00
|
|
|
get_base_by_token_recursive(PyObject *bases, void *token)
|
2024-09-18 16:18:19 +09:00
|
|
|
{
|
|
|
|
|
assert(bases != NULL);
|
2024-10-10 21:57:13 +09:00
|
|
|
PyTypeObject *res = NULL;
|
2024-09-18 16:18:19 +09:00
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(bases);
|
|
|
|
|
for (Py_ssize_t i = 0; i < n; i++) {
|
|
|
|
|
PyTypeObject *base = _PyType_CAST(PyTuple_GET_ITEM(bases, i));
|
|
|
|
|
if (!_PyType_HasFeature(base, Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (((PyHeapTypeObject*)base)->ht_token == token) {
|
2024-10-10 21:57:13 +09:00
|
|
|
res = base;
|
|
|
|
|
break;
|
2024-09-18 16:18:19 +09:00
|
|
|
}
|
2024-10-10 21:57:13 +09:00
|
|
|
base = get_base_by_token_recursive(lookup_tp_bases(base), token);
|
2024-09-18 16:18:19 +09:00
|
|
|
if (base != NULL) {
|
2024-10-10 21:57:13 +09:00
|
|
|
res = base;
|
|
|
|
|
break;
|
2024-09-18 16:18:19 +09:00
|
|
|
}
|
|
|
|
|
}
|
2024-10-10 21:57:13 +09:00
|
|
|
return res; // Prefer to return recursively from one place
|
2024-09-18 16:18:19 +09:00
|
|
|
}
|
|
|
|
|
|
2024-10-10 21:57:13 +09:00
|
|
|
int
|
|
|
|
|
PyType_GetBaseByToken(PyTypeObject *type, void *token, PyTypeObject **result)
|
2024-09-18 16:18:19 +09:00
|
|
|
{
|
2024-10-10 21:57:13 +09:00
|
|
|
if (result != NULL) {
|
|
|
|
|
*result = NULL;
|
2024-09-18 16:18:19 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (token == NULL) {
|
|
|
|
|
PyErr_Format(PyExc_SystemError,
|
|
|
|
|
"PyType_GetBaseByToken called with token=NULL");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2024-10-10 21:57:13 +09:00
|
|
|
if (!PyType_Check(type)) {
|
2024-09-18 16:18:19 +09:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"expected a type, got a '%T' object", type);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
// No static type has a heaptype superclass,
|
|
|
|
|
// which is ensured by type_ready_mro().
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2024-10-10 21:57:13 +09:00
|
|
|
if (((PyHeapTypeObject*)type)->ht_token == token) {
|
|
|
|
|
found:
|
|
|
|
|
if (result != NULL) {
|
|
|
|
|
*result = (PyTypeObject *)Py_NewRef(type);
|
|
|
|
|
}
|
2024-09-18 16:18:19 +09:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-10 21:57:13 +09:00
|
|
|
PyObject *mro = type->tp_mro; // No lookup, following PyType_IsSubtype()
|
|
|
|
|
if (mro == NULL) {
|
|
|
|
|
PyTypeObject *base;
|
|
|
|
|
base = get_base_by_token_recursive(lookup_tp_bases(type), token);
|
|
|
|
|
if (base != NULL) {
|
|
|
|
|
// Copying the given type can cause a slowdown,
|
|
|
|
|
// unlike the overwrite below.
|
|
|
|
|
type = base;
|
|
|
|
|
goto found;
|
|
|
|
|
}
|
2024-09-18 16:18:19 +09:00
|
|
|
return 0;
|
|
|
|
|
}
|
2024-10-10 21:57:13 +09:00
|
|
|
// mro_invoke() ensures that the type MRO cannot be empty.
|
|
|
|
|
assert(PyTuple_GET_SIZE(mro) >= 1);
|
|
|
|
|
// Also, the first item in the MRO is the type itself, which
|
|
|
|
|
// we already checked above. We skip it in the loop.
|
|
|
|
|
assert(PyTuple_GET_ITEM(mro, 0) == (PyObject *)type);
|
|
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(mro);
|
|
|
|
|
for (Py_ssize_t i = 1; i < n; i++) {
|
|
|
|
|
PyTypeObject *base = (PyTypeObject *)PyTuple_GET_ITEM(mro, i);
|
|
|
|
|
if (_PyType_HasFeature(base, Py_TPFLAGS_HEAPTYPE)
|
|
|
|
|
&& ((PyHeapTypeObject*)base)->ht_token == token) {
|
|
|
|
|
type = base;
|
|
|
|
|
goto found;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2024-09-18 16:18:19 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-05-04 09:56:53 +02:00
|
|
|
void *
|
|
|
|
|
PyObject_GetTypeData(PyObject *obj, PyTypeObject *cls)
|
|
|
|
|
{
|
|
|
|
|
assert(PyObject_TypeCheck(obj, cls));
|
|
|
|
|
return (char *)obj + _align_up(cls->tp_base->tp_basicsize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Py_ssize_t
|
|
|
|
|
PyType_GetTypeDataSize(PyTypeObject *cls)
|
|
|
|
|
{
|
|
|
|
|
ptrdiff_t result = cls->tp_basicsize - _align_up(cls->tp_base->tp_basicsize);
|
|
|
|
|
if (result < 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *
|
|
|
|
|
PyObject_GetItemData(PyObject *obj)
|
|
|
|
|
{
|
|
|
|
|
if (!PyType_HasFeature(Py_TYPE(obj), Py_TPFLAGS_ITEMS_AT_END)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"type '%s' does not have Py_TPFLAGS_ITEMS_AT_END",
|
|
|
|
|
Py_TYPE(obj)->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return (char *)obj + Py_TYPE(obj)->tp_basicsize;
|
|
|
|
|
}
|
2020-11-03 22:27:12 +01:00
|
|
|
|
2017-10-01 10:37:47 +02:00
|
|
|
/* Internal API to look for a name through the MRO, bypassing the method cache.
|
|
|
|
|
This returns a borrowed reference, and might set an exception.
|
|
|
|
|
'error' is set to: -1: error with exception; 1: error without exception; 0: ok */
|
|
|
|
|
static PyObject *
|
|
|
|
|
find_name_in_mro(PyTypeObject *type, PyObject *name, int *error)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
2024-07-02 03:11:39 +08:00
|
|
|
Py_hash_t hash = _PyObject_HashFast(name);
|
|
|
|
|
if (hash == -1) {
|
|
|
|
|
*error = -1;
|
|
|
|
|
return NULL;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Look in tp_dict of types in MRO */
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *mro = lookup_tp_mro(type);
|
2016-10-08 12:24:09 +03:00
|
|
|
if (mro == NULL) {
|
2023-05-02 21:30:03 -06:00
|
|
|
if (!is_readying(type)) {
|
2017-10-01 10:37:47 +02:00
|
|
|
if (PyType_Ready(type) < 0) {
|
|
|
|
|
*error = -1;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
mro = lookup_tp_mro(type);
|
2016-10-08 12:24:09 +03:00
|
|
|
}
|
|
|
|
|
if (mro == NULL) {
|
2017-10-01 10:37:47 +02:00
|
|
|
*error = 1;
|
2016-10-08 12:24:09 +03:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
PyObject *res = NULL;
|
2017-10-01 10:37:47 +02:00
|
|
|
/* Keep a strong reference to mro because type->tp_mro can be replaced
|
|
|
|
|
during dict lookup, e.g. when comparing to non-string keys. */
|
2012-03-09 00:39:08 +01:00
|
|
|
Py_INCREF(mro);
|
2022-01-22 18:56:11 +01:00
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(mro);
|
|
|
|
|
for (Py_ssize_t i = 0; i < n; i++) {
|
|
|
|
|
PyObject *base = PyTuple_GET_ITEM(mro, i);
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(_PyType_CAST(base));
|
2010-05-09 15:52:27 +00:00
|
|
|
assert(dict && PyDict_Check(dict));
|
2024-05-06 10:50:35 -07:00
|
|
|
if (_PyDict_GetItemRef_KnownHash((PyDictObject *)dict, name, hash, &res) < 0) {
|
2017-10-01 10:37:47 +02:00
|
|
|
*error = -1;
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
2024-05-06 10:50:35 -07:00
|
|
|
if (res != NULL) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2017-10-01 10:37:47 +02:00
|
|
|
*error = 0;
|
|
|
|
|
done:
|
2012-03-09 00:39:08 +01:00
|
|
|
Py_DECREF(mro);
|
2017-10-01 10:37:47 +02:00
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-15 09:45:03 +00:00
|
|
|
/* Check if the "readied" PyUnicode name
|
|
|
|
|
is a double-underscore special name. */
|
|
|
|
|
static int
|
|
|
|
|
is_dunder_name(PyObject *name)
|
|
|
|
|
{
|
|
|
|
|
Py_ssize_t length = PyUnicode_GET_LENGTH(name);
|
|
|
|
|
int kind = PyUnicode_KIND(name);
|
|
|
|
|
/* Special names contain at least "__x__" and are always ASCII. */
|
|
|
|
|
if (length > 4 && kind == PyUnicode_1BYTE_KIND) {
|
|
|
|
|
const Py_UCS1 *characters = PyUnicode_1BYTE_DATA(name);
|
|
|
|
|
return (
|
|
|
|
|
((characters[length-2] == '_') && (characters[length-1] == '_')) &&
|
|
|
|
|
((characters[0] == '_') && (characters[1] == '_'))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-29 15:26:04 -04:00
|
|
|
static PyObject *
|
2024-02-15 10:54:57 -08:00
|
|
|
update_cache(struct type_cache_entry *entry, PyObject *name, unsigned int version_tag, PyObject *value)
|
|
|
|
|
{
|
2024-04-17 09:42:56 -07:00
|
|
|
_Py_atomic_store_ptr_relaxed(&entry->value, value); /* borrowed */
|
2024-02-15 10:54:57 -08:00
|
|
|
assert(_PyASCIIObject_CAST(name)->hash != -1);
|
|
|
|
|
OBJECT_STAT_INC_COND(type_cache_collisions, entry->name != Py_None && entry->name != name);
|
|
|
|
|
// We're releasing this under the lock for simplicity sake because it's always a
|
|
|
|
|
// exact unicode object or Py_None so it's safe to do so.
|
2024-04-17 09:42:56 -07:00
|
|
|
PyObject *old_name = entry->name;
|
|
|
|
|
_Py_atomic_store_ptr_relaxed(&entry->name, Py_NewRef(name));
|
2025-04-28 11:52:08 -07:00
|
|
|
// We must write the version last to avoid _Py_TryXGetStackRef()
|
|
|
|
|
// operating on an invalid (already deallocated) value inside
|
|
|
|
|
// _PyType_LookupRefAndVersion(). If we write the version first then a
|
|
|
|
|
// reader could pass the "entry_version == type_version" check but could
|
|
|
|
|
// be using the old entry value.
|
|
|
|
|
_Py_atomic_store_uint32_release(&entry->version, version_tag);
|
2024-05-29 15:26:04 -04:00
|
|
|
return old_name;
|
2024-02-15 10:54:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if Py_GIL_DISABLED
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
update_cache_gil_disabled(struct type_cache_entry *entry, PyObject *name,
|
|
|
|
|
unsigned int version_tag, PyObject *value)
|
|
|
|
|
{
|
|
|
|
|
_PySeqLock_LockWrite(&entry->sequence);
|
|
|
|
|
|
|
|
|
|
// update the entry
|
|
|
|
|
if (entry->name == name &&
|
|
|
|
|
entry->value == value &&
|
|
|
|
|
entry->version == version_tag) {
|
|
|
|
|
// We raced with another update, bail and restore previous sequence.
|
|
|
|
|
_PySeqLock_AbandonWrite(&entry->sequence);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-29 15:26:04 -04:00
|
|
|
PyObject *old_value = update_cache(entry, name, version_tag, value);
|
2024-02-15 10:54:57 -08:00
|
|
|
|
|
|
|
|
// Then update sequence to the next valid value
|
|
|
|
|
_PySeqLock_UnlockWrite(&entry->sequence);
|
2024-05-29 15:26:04 -04:00
|
|
|
|
|
|
|
|
Py_DECREF(old_value);
|
2024-02-15 10:54:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void
|
2024-02-16 08:49:41 -08:00
|
|
|
_PyTypes_AfterFork(void)
|
2024-02-15 10:54:57 -08:00
|
|
|
{
|
|
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
struct type_cache *cache = get_type_cache();
|
|
|
|
|
for (Py_ssize_t i = 0; i < (1 << MCACHE_SIZE_EXP); i++) {
|
|
|
|
|
struct type_cache_entry *entry = &cache->hashtable[i];
|
|
|
|
|
if (_PySeqLock_AfterFork(&entry->sequence)) {
|
|
|
|
|
// Entry was in the process of updating while forking, clear it...
|
|
|
|
|
entry->value = NULL;
|
|
|
|
|
Py_SETREF(entry->name, Py_None);
|
|
|
|
|
entry->version = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-01 10:37:47 +02:00
|
|
|
/* Internal API to look for a name through the MRO.
|
2024-12-03 11:20:20 -08:00
|
|
|
This returns a strong reference, and doesn't set an exception!
|
|
|
|
|
If nonzero, version is set to the value of type->tp_version at the time of
|
|
|
|
|
the lookup.
|
|
|
|
|
*/
|
2017-10-01 10:37:47 +02:00
|
|
|
PyObject *
|
2024-12-03 11:20:20 -08:00
|
|
|
_PyType_LookupRefAndVersion(PyTypeObject *type, PyObject *name, unsigned int *version)
|
2017-10-01 10:37:47 +02:00
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
_PyStackRef out;
|
|
|
|
|
unsigned int ver = _PyType_LookupStackRefAndVersion(type, name, &out);
|
|
|
|
|
if (version) {
|
|
|
|
|
*version = ver;
|
|
|
|
|
}
|
|
|
|
|
if (PyStackRef_IsNull(out)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return PyStackRef_AsPyObjectSteal(out);
|
|
|
|
|
}
|
2017-10-01 10:37:47 +02:00
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
unsigned int
|
|
|
|
|
_PyType_LookupStackRefAndVersion(PyTypeObject *type, PyObject *name, _PyStackRef *out)
|
|
|
|
|
{
|
2021-03-20 12:12:05 -07:00
|
|
|
unsigned int h = MCACHE_HASH_METHOD(type, name);
|
|
|
|
|
struct type_cache *cache = get_type_cache();
|
|
|
|
|
struct type_cache_entry *entry = &cache->hashtable[h];
|
2024-02-15 10:54:57 -08:00
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
// synchronize-with other writing threads by doing an acquire load on the sequence
|
|
|
|
|
while (1) {
|
2024-07-08 14:52:07 -04:00
|
|
|
uint32_t sequence = _PySeqLock_BeginRead(&entry->sequence);
|
2025-04-28 11:52:08 -07:00
|
|
|
uint32_t entry_version = _Py_atomic_load_uint32_acquire(&entry->version);
|
2024-05-06 10:50:35 -07:00
|
|
|
uint32_t type_version = _Py_atomic_load_uint32_acquire(&type->tp_version_tag);
|
2024-04-30 12:37:38 -07:00
|
|
|
if (entry_version == type_version &&
|
2024-02-15 10:54:57 -08:00
|
|
|
_Py_atomic_load_ptr_relaxed(&entry->name) == name) {
|
|
|
|
|
OBJECT_STAT_INC_COND(type_cache_hits, !is_dunder_name(name));
|
|
|
|
|
OBJECT_STAT_INC_COND(type_cache_dunder_hits, is_dunder_name(name));
|
2025-03-26 14:38:47 -04:00
|
|
|
if (_Py_TryXGetStackRef(&entry->value, out)) {
|
|
|
|
|
// If the sequence is still valid then we're done
|
2024-05-06 10:50:35 -07:00
|
|
|
if (_PySeqLock_EndRead(&entry->sequence, sequence)) {
|
2025-03-26 14:38:47 -04:00
|
|
|
return entry_version;
|
2024-05-06 10:50:35 -07:00
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
PyStackRef_XCLOSE(*out);
|
2024-05-06 10:50:35 -07:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// If we can't incref the object we need to fallback to locking
|
|
|
|
|
break;
|
2024-02-15 10:54:57 -08:00
|
|
|
}
|
2024-05-06 10:50:35 -07:00
|
|
|
}
|
|
|
|
|
else {
|
2024-02-15 10:54:57 -08:00
|
|
|
// cache miss
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#else
|
2025-03-26 14:38:47 -04:00
|
|
|
if (entry->version == type->tp_version_tag && entry->name == name) {
|
2024-06-19 17:38:45 +01:00
|
|
|
assert(type->tp_version_tag);
|
2022-12-15 09:45:03 +00:00
|
|
|
OBJECT_STAT_INC_COND(type_cache_hits, !is_dunder_name(name));
|
|
|
|
|
OBJECT_STAT_INC_COND(type_cache_dunder_hits, is_dunder_name(name));
|
2025-03-26 14:38:47 -04:00
|
|
|
*out = entry->value ? PyStackRef_FromPyObjectNew(entry->value) : PyStackRef_NULL;
|
|
|
|
|
return entry->version;
|
2017-10-01 10:37:47 +02:00
|
|
|
}
|
2024-02-15 10:54:57 -08:00
|
|
|
#endif
|
2022-12-15 09:45:03 +00:00
|
|
|
OBJECT_STAT_INC_COND(type_cache_misses, !is_dunder_name(name));
|
|
|
|
|
OBJECT_STAT_INC_COND(type_cache_dunder_misses, is_dunder_name(name));
|
2017-10-01 10:37:47 +02:00
|
|
|
|
|
|
|
|
/* We may end up clearing live exceptions below, so make sure it's ours. */
|
|
|
|
|
assert(!PyErr_Occurred());
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
// We need to atomically do the lookup and capture the version before
|
|
|
|
|
// anyone else can modify our mro or mutate the type.
|
|
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
PyObject *res;
|
|
|
|
|
int error;
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2024-02-15 10:54:57 -08:00
|
|
|
int has_version = 0;
|
2024-12-03 11:20:20 -08:00
|
|
|
unsigned int assigned_version = 0;
|
2024-06-21 15:50:18 -04:00
|
|
|
BEGIN_TYPE_LOCK();
|
2025-04-28 11:52:08 -07:00
|
|
|
// We must assign the version before doing the lookup. If
|
|
|
|
|
// find_name_in_mro() blocks and releases the critical section
|
|
|
|
|
// then the type version can change.
|
2024-02-15 10:54:57 -08:00
|
|
|
if (MCACHE_CACHEABLE_NAME(name)) {
|
|
|
|
|
has_version = assign_version_tag(interp, type);
|
2024-12-03 11:20:20 -08:00
|
|
|
assigned_version = type->tp_version_tag;
|
2024-02-15 10:54:57 -08:00
|
|
|
}
|
2025-04-28 11:52:08 -07:00
|
|
|
res = find_name_in_mro(type, name, &error);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
|
2017-10-01 10:37:47 +02:00
|
|
|
/* Only put NULL results into cache if there was no error. */
|
|
|
|
|
if (error) {
|
|
|
|
|
/* It's not ideal to clear the error condition,
|
|
|
|
|
but this function is documented as not setting
|
|
|
|
|
an exception, and I don't want to change that.
|
|
|
|
|
E.g., when PyType_Ready() can't proceed, it won't
|
|
|
|
|
set the "ready" flag, so future attempts to ready
|
|
|
|
|
the same type will call it again -- hopefully
|
|
|
|
|
in a context that propagates the exception out.
|
|
|
|
|
*/
|
|
|
|
|
if (error == -1) {
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
*out = PyStackRef_NULL;
|
|
|
|
|
return 0;
|
2017-10-01 10:37:47 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
if (has_version) {
|
|
|
|
|
#if Py_GIL_DISABLED
|
2024-12-03 11:20:20 -08:00
|
|
|
update_cache_gil_disabled(entry, name, assigned_version, res);
|
2024-02-15 10:54:57 -08:00
|
|
|
#else
|
2024-12-03 11:20:20 -08:00
|
|
|
PyObject *old_value = update_cache(entry, name, assigned_version, res);
|
2024-05-29 15:26:04 -04:00
|
|
|
Py_DECREF(old_value);
|
2024-02-15 10:54:57 -08:00
|
|
|
#endif
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
*out = res ? PyStackRef_FromPyObjectSteal(res) : PyStackRef_NULL;
|
|
|
|
|
return has_version ? assigned_version : 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-03 11:20:20 -08:00
|
|
|
/* Internal API to look for a name through the MRO.
|
|
|
|
|
This returns a strong reference, and doesn't set an exception!
|
|
|
|
|
*/
|
|
|
|
|
PyObject *
|
|
|
|
|
_PyType_LookupRef(PyTypeObject *type, PyObject *name)
|
|
|
|
|
{
|
|
|
|
|
return _PyType_LookupRefAndVersion(type, name, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Internal API to look for a name through the MRO.
|
|
|
|
|
This returns a borrowed reference, and doesn't set an exception! */
|
2024-05-06 10:50:35 -07:00
|
|
|
PyObject *
|
|
|
|
|
_PyType_Lookup(PyTypeObject *type, PyObject *name)
|
|
|
|
|
{
|
2024-12-03 11:20:20 -08:00
|
|
|
PyObject *res = _PyType_LookupRefAndVersion(type, name, NULL);
|
2024-05-06 10:50:35 -07:00
|
|
|
Py_XDECREF(res);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-03 11:20:20 -08:00
|
|
|
int
|
|
|
|
|
_PyType_CacheInitForSpecialization(PyHeapTypeObject *type, PyObject *init,
|
|
|
|
|
unsigned int tp_version)
|
|
|
|
|
{
|
|
|
|
|
if (!init || !tp_version) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
int can_cache;
|
|
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
can_cache = ((PyTypeObject*)type)->tp_version_tag == tp_version;
|
|
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
can_cache = can_cache && _PyObject_HasDeferredRefcount(init);
|
|
|
|
|
#endif
|
|
|
|
|
if (can_cache) {
|
|
|
|
|
FT_ATOMIC_STORE_PTR_RELEASE(type->_spec_cache.init, init);
|
|
|
|
|
}
|
|
|
|
|
END_TYPE_LOCK();
|
|
|
|
|
return can_cache;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-19 11:08:17 +09:00
|
|
|
int
|
|
|
|
|
_PyType_CacheGetItemForSpecialization(PyHeapTypeObject *ht, PyObject *descriptor, uint32_t tp_version)
|
|
|
|
|
{
|
|
|
|
|
if (!descriptor || !tp_version) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
int can_cache;
|
|
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
can_cache = ((PyTypeObject*)ht)->tp_version_tag == tp_version;
|
|
|
|
|
// This pointer is invalidated by PyType_Modified (see the comment on
|
|
|
|
|
// struct _specialization_cache):
|
|
|
|
|
PyFunctionObject *func = (PyFunctionObject *)descriptor;
|
|
|
|
|
uint32_t version = _PyFunction_GetVersionForCurrentState(func);
|
|
|
|
|
can_cache = can_cache && _PyFunction_IsVersionValid(version);
|
|
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
can_cache = can_cache && _PyObject_HasDeferredRefcount(descriptor);
|
|
|
|
|
#endif
|
|
|
|
|
if (can_cache) {
|
|
|
|
|
FT_ATOMIC_STORE_PTR_RELEASE(ht->_spec_cache.getitem, descriptor);
|
|
|
|
|
FT_ATOMIC_STORE_UINT32_RELAXED(ht->_spec_cache.getitem_version, version);
|
|
|
|
|
}
|
|
|
|
|
END_TYPE_LOCK();
|
|
|
|
|
return can_cache;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-11 15:13:25 -07:00
|
|
|
void
|
|
|
|
|
_PyType_SetFlags(PyTypeObject *self, unsigned long mask, unsigned long flags)
|
|
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
type_set_flags_with_mask(self, mask, flags);
|
|
|
|
|
END_TYPE_LOCK();
|
2024-04-11 15:13:25 -07:00
|
|
|
}
|
|
|
|
|
|
2024-11-22 07:52:16 +09:00
|
|
|
int
|
|
|
|
|
_PyType_Validate(PyTypeObject *ty, _py_validate_type validate, unsigned int *tp_version)
|
|
|
|
|
{
|
|
|
|
|
int err;
|
|
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
err = validate(ty);
|
|
|
|
|
if (!err) {
|
|
|
|
|
if(assign_version_tag(_PyInterpreterState_GET(), ty)) {
|
|
|
|
|
*tp_version = ty->tp_version_tag;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
err = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_TYPE_LOCK();
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-11 15:13:25 -07:00
|
|
|
static void
|
|
|
|
|
set_flags_recursive(PyTypeObject *self, unsigned long mask, unsigned long flags)
|
|
|
|
|
{
|
|
|
|
|
if (PyType_HasFeature(self, Py_TPFLAGS_IMMUTABLETYPE) ||
|
|
|
|
|
(self->tp_flags & mask) == flags)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-25 21:24:20 -08:00
|
|
|
type_set_flags_with_mask(self, mask, flags);
|
2024-04-11 15:13:25 -07:00
|
|
|
|
|
|
|
|
PyObject *children = _PyType_GetSubclasses(self);
|
|
|
|
|
if (children == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Py_ssize_t i = 0; i < PyList_GET_SIZE(children); i++) {
|
|
|
|
|
PyObject *child = PyList_GET_ITEM(children, i);
|
|
|
|
|
set_flags_recursive((PyTypeObject *)child, mask, flags);
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(children);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_PyType_SetFlagsRecursive(PyTypeObject *self, unsigned long mask, unsigned long flags)
|
|
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
BEGIN_TYPE_LOCK();
|
2024-04-11 15:13:25 -07:00
|
|
|
set_flags_recursive(self, mask, flags);
|
2025-04-28 23:38:29 -07:00
|
|
|
END_TYPE_LOCK();
|
2024-04-11 15:13:25 -07:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
/* This is similar to PyObject_GenericGetAttr(),
|
2024-05-06 10:50:35 -07:00
|
|
|
but uses _PyType_LookupRef() instead of just looking in type->tp_dict.
|
2022-12-23 16:23:36 +01:00
|
|
|
|
|
|
|
|
The argument suppress_missing_attribute is used to provide a
|
|
|
|
|
fast path for hasattr. The possible values are:
|
|
|
|
|
|
|
|
|
|
* NULL: do not suppress the exception
|
|
|
|
|
* Non-zero pointer: suppress the PyExc_AttributeError and
|
|
|
|
|
set *suppress_missing_attribute to 1 to signal we are returning NULL while
|
|
|
|
|
having suppressed the exception (other exceptions are not suppressed)
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
PyObject *
|
|
|
|
|
_Py_type_getattro_impl(PyTypeObject *type, PyObject *name, int * suppress_missing_attribute)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *metatype = Py_TYPE(type);
|
|
|
|
|
PyObject *meta_attribute, *attribute;
|
|
|
|
|
descrgetfunc meta_get;
|
2018-09-07 09:37:00 +02:00
|
|
|
PyObject* res;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2012-03-16 09:32:59 -05:00
|
|
|
if (!PyUnicode_Check(name)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"attribute name must be string, not '%.200s'",
|
2020-02-07 03:04:21 +01:00
|
|
|
Py_TYPE(name)->tp_name);
|
2012-03-16 09:32:59 -05:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Initialize this type (we'll assume the metatype is initialized) */
|
2021-04-11 23:57:09 +02:00
|
|
|
if (!_PyType_IsReady(type)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
if (PyType_Ready(type) < 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* No readable descriptor found yet */
|
|
|
|
|
meta_get = NULL;
|
|
|
|
|
|
|
|
|
|
/* Look for the attribute in the metatype */
|
2024-05-06 10:50:35 -07:00
|
|
|
meta_attribute = _PyType_LookupRef(metatype, name);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
if (meta_attribute != NULL) {
|
|
|
|
|
meta_get = Py_TYPE(meta_attribute)->tp_descr_get;
|
|
|
|
|
|
|
|
|
|
if (meta_get != NULL && PyDescr_IsData(meta_attribute)) {
|
|
|
|
|
/* Data descriptors implement tp_descr_set to intercept
|
|
|
|
|
* writes. Assume the attribute is not overridden in
|
|
|
|
|
* type's tp_dict (and bases): call the descriptor now.
|
|
|
|
|
*/
|
2018-09-07 09:37:00 +02:00
|
|
|
res = meta_get(meta_attribute, (PyObject *)type,
|
|
|
|
|
(PyObject *)metatype);
|
|
|
|
|
Py_DECREF(meta_attribute);
|
|
|
|
|
return res;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* No data descriptor found on metatype. Look in tp_dict of this
|
|
|
|
|
* type and its bases */
|
2024-05-06 10:50:35 -07:00
|
|
|
attribute = _PyType_LookupRef(type, name);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (attribute != NULL) {
|
|
|
|
|
/* Implement descriptor functionality, if any */
|
|
|
|
|
descrgetfunc local_get = Py_TYPE(attribute)->tp_descr_get;
|
|
|
|
|
|
|
|
|
|
Py_XDECREF(meta_attribute);
|
|
|
|
|
|
|
|
|
|
if (local_get != NULL) {
|
|
|
|
|
/* NULL 2nd argument indicates the descriptor was
|
|
|
|
|
* found on the target object itself (or a base) */
|
2018-09-07 09:37:00 +02:00
|
|
|
res = local_get(attribute, (PyObject *)NULL,
|
|
|
|
|
(PyObject *)type);
|
|
|
|
|
Py_DECREF(attribute);
|
|
|
|
|
return res;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return attribute;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* No attribute found in local __dict__ (or bases): use the
|
|
|
|
|
* descriptor from the metatype, if any */
|
|
|
|
|
if (meta_get != NULL) {
|
|
|
|
|
PyObject *res;
|
|
|
|
|
res = meta_get(meta_attribute, (PyObject *)type,
|
|
|
|
|
(PyObject *)metatype);
|
|
|
|
|
Py_DECREF(meta_attribute);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If an ordinary attribute was found on the metatype, return it now */
|
|
|
|
|
if (meta_attribute != NULL) {
|
|
|
|
|
return meta_attribute;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Give up */
|
2022-12-23 16:23:36 +01:00
|
|
|
if (suppress_missing_attribute == NULL) {
|
|
|
|
|
PyErr_Format(PyExc_AttributeError,
|
2023-04-24 08:23:08 -06:00
|
|
|
"type object '%.100s' has no attribute '%U'",
|
2022-12-23 16:23:36 +01:00
|
|
|
type->tp_name, name);
|
|
|
|
|
} else {
|
|
|
|
|
// signal the caller we have not set an PyExc_AttributeError and gave up
|
|
|
|
|
*suppress_missing_attribute = 1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2022-12-23 16:23:36 +01:00
|
|
|
/* This is similar to PyObject_GenericGetAttr(),
|
2024-05-06 10:50:35 -07:00
|
|
|
but uses _PyType_LookupRef() instead of just looking in type->tp_dict. */
|
2022-12-23 16:23:36 +01:00
|
|
|
PyObject *
|
2025-02-25 11:44:59 +01:00
|
|
|
_Py_type_getattro(PyObject *tp, PyObject *name)
|
2022-12-23 16:23:36 +01:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
|
|
|
|
return _Py_type_getattro_impl(type, name, NULL);
|
2022-12-23 16:23:36 +01:00
|
|
|
}
|
|
|
|
|
|
2024-06-24 14:08:23 -04:00
|
|
|
static int
|
|
|
|
|
type_update_dict(PyTypeObject *type, PyDictObject *dict, PyObject *name,
|
|
|
|
|
PyObject *value, PyObject **old_value)
|
|
|
|
|
{
|
|
|
|
|
// We don't want any re-entrancy between when we update the dict
|
|
|
|
|
// and call type_modified_unlocked, including running the destructor
|
|
|
|
|
// of the current value as it can observe the cache in an inconsistent
|
|
|
|
|
// state. Because we have an exact unicode and our dict has exact
|
|
|
|
|
// unicodes we know that this will all complete without releasing
|
|
|
|
|
// the locks.
|
|
|
|
|
if (_PyDict_GetItemRef_Unicode_LockHeld(dict, name, old_value) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clear the VALID_VERSION flag of 'type' and all its
|
|
|
|
|
subclasses. This could possibly be unified with the
|
|
|
|
|
update_subclasses() recursion in update_slot(), but carefully:
|
|
|
|
|
they each have their own conditions on which to stop
|
|
|
|
|
recursing into subclasses. */
|
|
|
|
|
type_modified_unlocked(type);
|
|
|
|
|
|
|
|
|
|
if (_PyDict_SetItem_LockHeld(dict, name, value) < 0) {
|
|
|
|
|
PyErr_Format(PyExc_AttributeError,
|
|
|
|
|
"type object '%.50s' has no attribute '%U'",
|
|
|
|
|
((PyTypeObject*)type)->tp_name, name);
|
|
|
|
|
_PyObject_SetAttributeErrorContext((PyObject *)type, name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-28 23:38:29 -07:00
|
|
|
if (is_dunder_name(name)) {
|
|
|
|
|
return update_slot(type, name);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-24 14:08:23 -04:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static int
|
2023-12-20 08:13:44 -06:00
|
|
|
type_setattro(PyObject *self, PyObject *name, PyObject *value)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(self);
|
2017-01-25 23:33:27 +01:00
|
|
|
int res;
|
2021-04-28 19:02:42 +02:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_TypeError,
|
2021-04-30 15:25:43 +02:00
|
|
|
"cannot set %R attribute of immutable type '%s'",
|
|
|
|
|
name, type->tp_name);
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
2024-05-06 10:50:35 -07:00
|
|
|
if (!PyUnicode_Check(name)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"attribute name must be string, not '%.200s'",
|
|
|
|
|
Py_TYPE(name)->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PyUnicode_CheckExact(name)) {
|
|
|
|
|
Py_INCREF(name);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
name = _PyUnicode_Copy(name);
|
|
|
|
|
if (name == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!PyUnicode_CHECK_INTERNED(name)) {
|
2024-06-21 17:19:31 +02:00
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
_PyUnicode_InternMortal(interp, &name);
|
2024-05-06 10:50:35 -07:00
|
|
|
if (!PyUnicode_CHECK_INTERNED(name)) {
|
|
|
|
|
PyErr_SetString(PyExc_MemoryError,
|
|
|
|
|
"Out of memory interning an attribute name");
|
|
|
|
|
Py_DECREF(name);
|
|
|
|
|
return -1;
|
2017-05-20 08:48:06 +03:00
|
|
|
}
|
2024-05-06 10:50:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyTypeObject *metatype = Py_TYPE(type);
|
|
|
|
|
assert(!_PyType_HasFeature(metatype, Py_TPFLAGS_INLINE_VALUES));
|
|
|
|
|
assert(!_PyType_HasFeature(metatype, Py_TPFLAGS_MANAGED_DICT));
|
|
|
|
|
|
2024-06-24 14:08:23 -04:00
|
|
|
PyObject *old_value = NULL;
|
2024-05-06 10:50:35 -07:00
|
|
|
PyObject *descr = _PyType_LookupRef(metatype, name);
|
|
|
|
|
if (descr != NULL) {
|
|
|
|
|
descrsetfunc f = Py_TYPE(descr)->tp_descr_set;
|
|
|
|
|
if (f != NULL) {
|
|
|
|
|
res = f(descr, (PyObject *)type, value);
|
|
|
|
|
goto done;
|
2017-05-20 08:48:06 +03:00
|
|
|
}
|
2024-05-06 10:50:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *dict = type->tp_dict;
|
|
|
|
|
if (dict == NULL) {
|
2025-04-28 23:38:29 -07:00
|
|
|
// We don't just do PyType_Ready because we could already be readying
|
2024-05-06 10:50:35 -07:00
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
dict = type->tp_dict;
|
|
|
|
|
if (dict == NULL) {
|
|
|
|
|
dict = type->tp_dict = PyDict_New();
|
|
|
|
|
}
|
|
|
|
|
END_TYPE_LOCK();
|
|
|
|
|
if (dict == NULL) {
|
2024-06-24 14:08:23 -04:00
|
|
|
res = -1;
|
|
|
|
|
goto done;
|
2017-05-20 08:48:06 +03:00
|
|
|
}
|
|
|
|
|
}
|
2024-05-06 10:50:35 -07:00
|
|
|
|
|
|
|
|
BEGIN_TYPE_DICT_LOCK(dict);
|
2024-06-24 14:08:23 -04:00
|
|
|
res = type_update_dict(type, (PyDictObject *)dict, name, value, &old_value);
|
2024-05-06 10:50:35 -07:00
|
|
|
assert(_PyType_CheckConsistency(type));
|
|
|
|
|
END_TYPE_DICT_LOCK();
|
2024-06-24 14:08:23 -04:00
|
|
|
|
2024-05-06 10:50:35 -07:00
|
|
|
done:
|
2017-05-20 08:48:06 +03:00
|
|
|
Py_DECREF(name);
|
2024-05-06 10:50:35 -07:00
|
|
|
Py_XDECREF(descr);
|
|
|
|
|
Py_XDECREF(old_value);
|
2017-01-25 23:33:27 +01:00
|
|
|
return res;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-21 01:42:25 +01:00
|
|
|
|
2022-01-21 13:06:34 +01:00
|
|
|
static void
|
|
|
|
|
type_dealloc_common(PyTypeObject *type)
|
|
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *bases = lookup_tp_bases(type);
|
|
|
|
|
if (bases != NULL) {
|
2023-03-08 17:03:18 +00:00
|
|
|
PyObject *exc = PyErr_GetRaisedException();
|
2023-05-01 20:34:43 -06:00
|
|
|
remove_all_subclasses(type, bases);
|
2023-03-08 17:03:18 +00:00
|
|
|
PyErr_SetRaisedException(exc);
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
2022-01-21 13:06:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
static void
|
2024-06-03 19:09:18 -04:00
|
|
|
clear_static_tp_subclasses(PyTypeObject *type, int isbuiltin)
|
2022-01-21 01:42:25 +01:00
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *subclasses = lookup_tp_subclasses(type);
|
2022-08-04 19:26:59 -06:00
|
|
|
if (subclasses == NULL) {
|
2022-01-22 22:55:39 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2022-01-21 01:42:25 +01:00
|
|
|
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
/* Normally it would be a problem to finalize the type if its
|
|
|
|
|
tp_subclasses wasn't cleared first. However, this is only
|
|
|
|
|
ever called at the end of runtime finalization, so we can be
|
|
|
|
|
more liberal in cleaning up. If the given type still has
|
|
|
|
|
subtypes at this point then some extension module did not
|
|
|
|
|
correctly finalize its objects.
|
|
|
|
|
|
|
|
|
|
We can safely obliterate such subtypes since the extension
|
|
|
|
|
module and its objects won't be used again, except maybe if
|
|
|
|
|
the runtime were re-initialized. In that case the sticky
|
|
|
|
|
situation would only happen if the module were re-imported
|
|
|
|
|
then and only if the subtype were stored in a global and only
|
|
|
|
|
if that global were not overwritten during import. We'd be
|
|
|
|
|
fine since the extension is otherwise unsafe and unsupported
|
|
|
|
|
in that situation, and likely problematic already.
|
|
|
|
|
|
|
|
|
|
In any case, this situation means at least some memory is
|
|
|
|
|
going to leak. This mostly only affects embedding scenarios.
|
|
|
|
|
*/
|
|
|
|
|
|
2023-06-30 12:39:55 +02:00
|
|
|
#ifndef NDEBUG
|
2022-08-04 19:26:59 -06:00
|
|
|
// For now we just do a sanity check and then clear tp_subclasses.
|
|
|
|
|
Py_ssize_t i = 0;
|
|
|
|
|
PyObject *key, *ref; // borrowed ref
|
|
|
|
|
while (PyDict_Next(subclasses, &i, &key, &ref)) {
|
2023-06-21 16:35:58 +02:00
|
|
|
PyTypeObject *subclass = type_from_ref(ref);
|
2022-08-04 19:26:59 -06:00
|
|
|
if (subclass == NULL) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// All static builtin subtypes should have been finalized already.
|
2024-06-03 19:09:18 -04:00
|
|
|
assert(!isbuiltin || !(subclass->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN));
|
2023-06-21 16:35:58 +02:00
|
|
|
Py_DECREF(subclass);
|
2022-08-04 19:26:59 -06:00
|
|
|
}
|
2024-06-03 19:09:18 -04:00
|
|
|
#else
|
|
|
|
|
(void)isbuiltin;
|
2023-06-30 12:39:55 +02:00
|
|
|
#endif
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
clear_tp_subclasses(type);
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
}
|
|
|
|
|
|
2023-05-01 19:36:00 -06:00
|
|
|
static void
|
2024-06-03 19:09:18 -04:00
|
|
|
clear_static_type_objects(PyInterpreterState *interp, PyTypeObject *type,
|
|
|
|
|
int isbuiltin, int final)
|
2023-05-01 19:36:00 -06:00
|
|
|
{
|
2024-06-03 19:09:18 -04:00
|
|
|
if (final) {
|
2023-05-01 19:36:00 -06:00
|
|
|
Py_CLEAR(type->tp_cache);
|
|
|
|
|
}
|
2023-05-02 21:30:03 -06:00
|
|
|
clear_tp_dict(type);
|
2024-06-03 19:09:18 -04:00
|
|
|
clear_tp_bases(type, final);
|
|
|
|
|
clear_tp_mro(type, final);
|
|
|
|
|
clear_static_tp_subclasses(type, isbuiltin);
|
2023-05-01 19:36:00 -06:00
|
|
|
}
|
|
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
fini_static_type(PyInterpreterState *interp, PyTypeObject *type,
|
|
|
|
|
int isbuiltin, int final)
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
{
|
2023-05-01 19:36:00 -06:00
|
|
|
assert(type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
|
2024-10-10 18:19:08 +01:00
|
|
|
assert(_Py_IsImmortal((PyObject *)type));
|
2022-07-26 17:26:43 -06:00
|
|
|
|
2022-01-21 13:06:34 +01:00
|
|
|
type_dealloc_common(type);
|
|
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
clear_static_type_objects(interp, type, isbuiltin, final);
|
2022-01-21 13:06:34 +01:00
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
if (final) {
|
2025-02-25 21:24:20 -08:00
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
type_clear_flags(type, Py_TPFLAGS_READY);
|
|
|
|
|
set_version_unlocked(type, 0);
|
|
|
|
|
END_TYPE_LOCK();
|
2022-01-23 00:32:05 +01:00
|
|
|
}
|
|
|
|
|
|
2023-05-01 19:36:00 -06:00
|
|
|
_PyStaticType_ClearWeakRefs(interp, type);
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state_clear(interp, type, isbuiltin, final);
|
2024-09-09 08:04:58 -06:00
|
|
|
/* We leave _Py_TPFLAGS_STATIC_BUILTIN set on tp_flags. */
|
2022-01-21 01:42:25 +01:00
|
|
|
}
|
|
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
void
|
2024-06-14 15:29:09 -04:00
|
|
|
_PyTypes_FiniExtTypes(PyInterpreterState *interp)
|
2024-06-03 19:09:18 -04:00
|
|
|
{
|
2024-06-14 15:29:09 -04:00
|
|
|
for (size_t i = _Py_MAX_MANAGED_STATIC_EXT_TYPES; i > 0; i--) {
|
|
|
|
|
if (interp->types.for_extensions.num_initialized == 0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
int64_t count = 0;
|
|
|
|
|
PyTypeObject *type = static_ext_type_lookup(interp, i-1, &count);
|
|
|
|
|
if (type == NULL) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
int final = (count == 1);
|
|
|
|
|
fini_static_type(interp, type, 0, final);
|
|
|
|
|
}
|
2024-06-03 19:09:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_PyStaticType_FiniBuiltin(PyInterpreterState *interp, PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
fini_static_type(interp, type, 1, _Py_IsMainInterpreter(interp));
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-21 01:42:25 +01:00
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static void
|
2023-12-20 08:13:44 -06:00
|
|
|
type_dealloc(PyObject *self)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(self);
|
2023-12-20 08:13:44 -06:00
|
|
|
|
2022-01-23 00:32:05 +01:00
|
|
|
// Assert this is a heap-allocated type object
|
2018-10-26 18:39:11 +02:00
|
|
|
_PyObject_ASSERT((PyObject *)type, type->tp_flags & Py_TPFLAGS_HEAPTYPE);
|
2022-01-23 00:32:05 +01:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
_PyObject_GC_UNTRACK(type);
|
2022-01-21 13:06:34 +01:00
|
|
|
type_dealloc_common(type);
|
|
|
|
|
|
2022-01-23 00:32:05 +01:00
|
|
|
// PyObject_ClearWeakRefs() raises an exception if Py_REFCNT() != 0
|
|
|
|
|
assert(Py_REFCNT(type) == 0);
|
|
|
|
|
PyObject_ClearWeakRefs((PyObject *)type);
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_XDECREF(type->tp_base);
|
|
|
|
|
Py_XDECREF(type->tp_dict);
|
|
|
|
|
Py_XDECREF(type->tp_bases);
|
|
|
|
|
Py_XDECREF(type->tp_mro);
|
|
|
|
|
Py_XDECREF(type->tp_cache);
|
2023-05-01 20:34:43 -06:00
|
|
|
clear_tp_subclasses(type);
|
2022-01-21 13:06:34 +01:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* A type's tp_doc is heap allocated, unlike the tp_doc slots
|
|
|
|
|
* of most other objects. It's okay to cast it to char *.
|
|
|
|
|
*/
|
2024-01-26 11:11:35 +01:00
|
|
|
PyMem_Free((char *)type->tp_doc);
|
2022-01-21 01:42:25 +01:00
|
|
|
|
|
|
|
|
PyHeapTypeObject *et = (PyHeapTypeObject *)type;
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_XDECREF(et->ht_name);
|
2011-11-25 18:56:07 +01:00
|
|
|
Py_XDECREF(et->ht_qualname);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_XDECREF(et->ht_slots);
|
2020-05-07 15:39:59 +02:00
|
|
|
if (et->ht_cached_keys) {
|
2012-04-27 15:07:36 -04:00
|
|
|
_PyDictKeys_DecRef(et->ht_cached_keys);
|
2020-05-07 15:39:59 +02:00
|
|
|
}
|
|
|
|
|
Py_XDECREF(et->ht_module);
|
2021-10-21 11:46:20 +02:00
|
|
|
PyMem_Free(et->_ht_tpname);
|
2024-08-06 14:36:57 -04:00
|
|
|
#ifdef Py_GIL_DISABLED
|
2025-01-17 10:42:27 -05:00
|
|
|
assert(et->unique_id == _Py_INVALID_UNIQUE_ID);
|
2024-08-06 14:36:57 -04:00
|
|
|
#endif
|
2024-09-18 16:18:19 +09:00
|
|
|
et->ht_token = NULL;
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_TYPE(type)->tp_free((PyObject *)type);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-21 23:29:10 +01:00
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
type.__subclasses__
|
|
|
|
|
|
|
|
|
|
Return a list of immediate subclasses.
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
2001-10-08 15:18:27 +00:00
|
|
|
static PyObject *
|
2017-03-19 08:46:44 +02:00
|
|
|
type___subclasses___impl(PyTypeObject *self)
|
|
|
|
|
/*[clinic end generated code: output=eb5eb54485942819 input=5af66132436f9a7b]*/
|
2001-10-08 15:18:27 +00:00
|
|
|
{
|
2022-01-21 23:29:10 +01:00
|
|
|
return _PyType_GetSubclasses(self);
|
2001-10-08 15:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
2007-08-02 16:48:17 +00:00
|
|
|
static PyObject *
|
2017-12-15 13:11:11 +02:00
|
|
|
type_prepare(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
|
2017-01-16 23:52:00 +01:00
|
|
|
PyObject *kwnames)
|
2007-08-02 16:48:17 +00:00
|
|
|
{
|
2016-09-08 15:11:11 -07:00
|
|
|
return PyDict_New();
|
2007-08-02 16:48:17 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-21 23:29:10 +01:00
|
|
|
|
2011-09-29 00:42:28 +02:00
|
|
|
/*
|
2011-05-24 11:09:06 -05:00
|
|
|
Merge the __dict__ of aclass into dict, and recursively also all
|
|
|
|
|
the __dict__s of aclass's base classes. The order of merging isn't
|
|
|
|
|
defined, as it's expected that only the final set of dict keys is
|
|
|
|
|
interesting.
|
|
|
|
|
Return 0 on success, -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
merge_class_dict(PyObject *dict, PyObject *aclass)
|
|
|
|
|
{
|
|
|
|
|
PyObject *classdict;
|
|
|
|
|
PyObject *bases;
|
|
|
|
|
|
|
|
|
|
assert(PyDict_Check(dict));
|
|
|
|
|
assert(aclass);
|
|
|
|
|
|
|
|
|
|
/* Merge in the type's dict (if any). */
|
2023-07-12 08:57:10 +03:00
|
|
|
if (PyObject_GetOptionalAttr(aclass, &_Py_ID(__dict__), &classdict) < 0) {
|
2019-09-01 12:03:39 +03:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (classdict != NULL) {
|
2011-05-24 11:09:06 -05:00
|
|
|
int status = PyDict_Update(dict, classdict);
|
|
|
|
|
Py_DECREF(classdict);
|
|
|
|
|
if (status < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Recursively merge in the base types' (if any) dicts. */
|
2023-07-12 08:57:10 +03:00
|
|
|
if (PyObject_GetOptionalAttr(aclass, &_Py_ID(__bases__), &bases) < 0) {
|
2019-09-01 12:03:39 +03:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (bases != NULL) {
|
2011-05-24 11:09:06 -05:00
|
|
|
/* We have no guarantee that bases is a real tuple */
|
|
|
|
|
Py_ssize_t i, n;
|
|
|
|
|
n = PySequence_Size(bases); /* This better be right */
|
2019-09-01 12:03:39 +03:00
|
|
|
if (n < 0) {
|
|
|
|
|
Py_DECREF(bases);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2011-05-24 11:09:06 -05:00
|
|
|
else {
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
|
int status;
|
|
|
|
|
PyObject *base = PySequence_GetItem(bases, i);
|
|
|
|
|
if (base == NULL) {
|
|
|
|
|
Py_DECREF(bases);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
status = merge_class_dict(dict, base);
|
|
|
|
|
Py_DECREF(base);
|
|
|
|
|
if (status < 0) {
|
|
|
|
|
Py_DECREF(bases);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(bases);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* __dir__ for type objects: returns __dict__ and __bases__.
|
|
|
|
|
We deliberately don't suck up its __class__, as methods belonging to the
|
|
|
|
|
metaclass would probably be more confusing than helpful.
|
|
|
|
|
*/
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
type.__dir__
|
|
|
|
|
|
|
|
|
|
Specialized __dir__ implementation for types.
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
2011-05-24 11:09:06 -05:00
|
|
|
static PyObject *
|
2017-03-19 08:46:44 +02:00
|
|
|
type___dir___impl(PyTypeObject *self)
|
|
|
|
|
/*[clinic end generated code: output=69d02fe92c0f15fa input=7733befbec645968]*/
|
2011-05-24 11:09:06 -05:00
|
|
|
{
|
|
|
|
|
PyObject *result = NULL;
|
|
|
|
|
PyObject *dict = PyDict_New();
|
|
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
if (dict != NULL && merge_class_dict(dict, (PyObject *)self) == 0)
|
2011-05-24 11:09:06 -05:00
|
|
|
result = PyDict_Keys(dict);
|
|
|
|
|
|
|
|
|
|
Py_XDECREF(dict);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
type.__sizeof__
|
|
|
|
|
|
|
|
|
|
Return memory consumption of the type object.
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
type___sizeof___impl(PyTypeObject *self)
|
|
|
|
|
/*[clinic end generated code: output=766f4f16cd3b1854 input=99398f24b9cf45d6]*/
|
2012-04-24 19:13:57 +02:00
|
|
|
{
|
2022-11-29 12:12:17 +01:00
|
|
|
size_t size;
|
2017-03-19 08:46:44 +02:00
|
|
|
if (self->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
|
|
|
|
PyHeapTypeObject* et = (PyHeapTypeObject*)self;
|
2012-04-24 19:13:57 +02:00
|
|
|
size = sizeof(PyHeapTypeObject);
|
|
|
|
|
if (et->ht_cached_keys)
|
|
|
|
|
size += _PyDict_KeysSize(et->ht_cached_keys);
|
|
|
|
|
}
|
2022-11-29 12:12:17 +01:00
|
|
|
else {
|
2012-04-24 19:13:57 +02:00
|
|
|
size = sizeof(PyTypeObject);
|
2022-11-29 12:12:17 +01:00
|
|
|
}
|
|
|
|
|
return PyLong_FromSize_t(size);
|
2012-04-24 19:13:57 +02:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyMethodDef type_methods[] = {
|
2017-03-19 08:46:44 +02:00
|
|
|
TYPE_MRO_METHODDEF
|
|
|
|
|
TYPE___SUBCLASSES___METHODDEF
|
2022-05-03 21:42:14 +02:00
|
|
|
{"__prepare__", _PyCFunction_CAST(type_prepare),
|
2017-07-03 21:20:15 +03:00
|
|
|
METH_FASTCALL | METH_KEYWORDS | METH_CLASS,
|
2023-11-13 09:13:49 +02:00
|
|
|
PyDoc_STR("__prepare__($cls, name, bases, /, **kwds)\n"
|
|
|
|
|
"--\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"Create the namespace for the class statement")},
|
2017-03-19 08:46:44 +02:00
|
|
|
TYPE___INSTANCECHECK___METHODDEF
|
|
|
|
|
TYPE___SUBCLASSCHECK___METHODDEF
|
|
|
|
|
TYPE___DIR___METHODDEF
|
|
|
|
|
TYPE___SIZEOF___METHODDEF
|
2010-05-09 15:52:27 +00:00
|
|
|
{0}
|
2001-08-02 04:15:00 +00:00
|
|
|
};
|
|
|
|
|
|
2002-06-13 20:33:02 +00:00
|
|
|
PyDoc_STRVAR(type_doc,
|
2001-08-02 04:15:00 +00:00
|
|
|
"type(object) -> the object's type\n"
|
2021-11-06 19:08:44 +00:00
|
|
|
"type(name, bases, dict, **kwds) -> a new type");
|
2001-08-02 04:15:00 +00:00
|
|
|
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
static int
|
2023-12-20 08:13:44 -06:00
|
|
|
type_traverse(PyObject *self, visitproc visit, void *arg)
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(self);
|
2023-12-20 08:13:44 -06:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Because of type_is_gc(), the collector only calls this
|
|
|
|
|
for heaptypes. */
|
2012-06-24 00:30:12 +02:00
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
char msg[200];
|
2020-01-30 09:01:07 +01:00
|
|
|
sprintf(msg, "type_traverse() called on non-heap type '%.100s'",
|
2012-06-24 00:30:12 +02:00
|
|
|
type->tp_name);
|
2020-01-30 09:01:07 +01:00
|
|
|
_PyObject_ASSERT_FAILED_MSG((PyObject *)type, msg);
|
2012-06-24 00:30:12 +02:00
|
|
|
}
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_VISIT(type->tp_dict);
|
|
|
|
|
Py_VISIT(type->tp_cache);
|
|
|
|
|
Py_VISIT(type->tp_mro);
|
|
|
|
|
Py_VISIT(type->tp_bases);
|
|
|
|
|
Py_VISIT(type->tp_base);
|
2020-05-07 15:39:59 +02:00
|
|
|
Py_VISIT(((PyHeapTypeObject *)type)->ht_module);
|
2002-06-10 15:24:42 +00:00
|
|
|
|
2021-10-21 11:46:20 +02:00
|
|
|
/* There's no need to visit others because they can't be involved
|
|
|
|
|
in cycles:
|
|
|
|
|
type->tp_subclasses is a list of weak references,
|
|
|
|
|
((PyHeapTypeObject *)type)->ht_slots is a tuple of strings,
|
|
|
|
|
((PyHeapTypeObject *)type)->ht_*name are strings.
|
|
|
|
|
*/
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2023-12-20 08:13:44 -06:00
|
|
|
type_clear(PyObject *self)
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(self);
|
2023-12-20 08:13:44 -06:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Because of type_is_gc(), the collector only calls this
|
|
|
|
|
for heaptypes. */
|
2018-10-26 18:39:11 +02:00
|
|
|
_PyObject_ASSERT((PyObject *)type, type->tp_flags & Py_TPFLAGS_HEAPTYPE);
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
|
2011-12-15 14:15:31 +01:00
|
|
|
/* We need to invalidate the method cache carefully before clearing
|
|
|
|
|
the dict, so that other objects caught in a reference cycle
|
|
|
|
|
don't start calling destroyed methods.
|
|
|
|
|
|
2024-04-21 05:25:39 +03:00
|
|
|
Otherwise, we need to clear tp_mro, which is
|
2011-12-15 14:15:31 +01:00
|
|
|
part of a hard cycle (its first element is the class itself) that
|
|
|
|
|
won't be broken otherwise (it's a tuple and tuples don't have a
|
2020-05-07 15:39:59 +02:00
|
|
|
tp_clear handler).
|
|
|
|
|
We also need to clear ht_module, if present: the module usually holds a
|
|
|
|
|
reference to its class. None of the other fields need to be
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
cleared, and here's why:
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
tp_cache:
|
|
|
|
|
Not used; if it were, it would be a dict.
|
2002-06-10 15:24:42 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
tp_bases, tp_base:
|
|
|
|
|
If these are involved in a cycle, there must be at least
|
|
|
|
|
one other, mutable object in the cycle, e.g. a base
|
|
|
|
|
class's dict; the cycle will be broken that way.
|
2002-06-10 15:24:42 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
tp_subclasses:
|
2013-10-29 21:31:25 +01:00
|
|
|
A dict of weak references can't be part of a cycle; and
|
|
|
|
|
dicts have their own tp_clear.
|
2002-06-10 15:24:42 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
slots (in PyHeapTypeObject):
|
|
|
|
|
A tuple of strings can't be part of a cycle.
|
|
|
|
|
*/
|
2002-06-10 15:24:42 +00:00
|
|
|
|
2011-12-15 14:15:31 +01:00
|
|
|
PyType_Modified(type);
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
|
|
|
|
if (dict) {
|
|
|
|
|
PyDict_Clear(dict);
|
2020-05-07 15:39:59 +02:00
|
|
|
}
|
|
|
|
|
Py_CLEAR(((PyHeapTypeObject *)type)->ht_module);
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_CLEAR(type->tp_mro);
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2025-02-25 11:44:59 +01:00
|
|
|
type_is_gc(PyObject *tp)
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
PyTypeObject *type = PyTypeObject_CAST(tp);
|
|
|
|
|
return type->tp_flags & Py_TPFLAGS_HEAPTYPE;
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
}
|
|
|
|
|
|
2020-09-09 13:23:24 -07:00
|
|
|
|
|
|
|
|
static PyNumberMethods type_as_number = {
|
2020-11-09 12:00:13 +08:00
|
|
|
.nb_or = _Py_union_type_or, // Add __or__ function
|
2020-09-09 13:23:24 -07:00
|
|
|
};
|
|
|
|
|
|
1997-05-02 03:12:38 +00:00
|
|
|
PyTypeObject PyType_Type = {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
|
|
|
|
"type", /* tp_name */
|
|
|
|
|
sizeof(PyHeapTypeObject), /* tp_basicsize */
|
|
|
|
|
sizeof(PyMemberDef), /* tp_itemsize */
|
2023-12-20 08:13:44 -06:00
|
|
|
type_dealloc, /* tp_dealloc */
|
2019-08-15 17:49:46 +02:00
|
|
|
offsetof(PyTypeObject, tp_vectorcall), /* tp_vectorcall_offset */
|
2010-05-09 15:52:27 +00:00
|
|
|
0, /* tp_getattr */
|
|
|
|
|
0, /* tp_setattr */
|
2019-05-31 04:13:39 +02:00
|
|
|
0, /* tp_as_async */
|
2023-12-20 08:13:44 -06:00
|
|
|
type_repr, /* tp_repr */
|
2020-09-09 13:23:24 -07:00
|
|
|
&type_as_number, /* tp_as_number */
|
2010-05-09 15:52:27 +00:00
|
|
|
0, /* tp_as_sequence */
|
|
|
|
|
0, /* tp_as_mapping */
|
|
|
|
|
0, /* tp_hash */
|
2023-12-20 08:13:44 -06:00
|
|
|
type_call, /* tp_call */
|
2010-05-09 15:52:27 +00:00
|
|
|
0, /* tp_str */
|
2023-12-20 08:13:44 -06:00
|
|
|
_Py_type_getattro, /* tp_getattro */
|
|
|
|
|
type_setattro, /* tp_setattro */
|
2010-05-09 15:52:27 +00:00
|
|
|
0, /* tp_as_buffer */
|
|
|
|
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
|
2019-08-15 17:49:46 +02:00
|
|
|
Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TYPE_SUBCLASS |
|
2023-05-04 09:56:53 +02:00
|
|
|
Py_TPFLAGS_HAVE_VECTORCALL |
|
|
|
|
|
Py_TPFLAGS_ITEMS_AT_END, /* tp_flags */
|
2010-05-09 15:52:27 +00:00
|
|
|
type_doc, /* tp_doc */
|
2023-12-20 08:13:44 -06:00
|
|
|
type_traverse, /* tp_traverse */
|
|
|
|
|
type_clear, /* tp_clear */
|
2010-05-09 15:52:27 +00:00
|
|
|
0, /* tp_richcompare */
|
|
|
|
|
offsetof(PyTypeObject, tp_weaklist), /* tp_weaklistoffset */
|
|
|
|
|
0, /* tp_iter */
|
|
|
|
|
0, /* tp_iternext */
|
|
|
|
|
type_methods, /* tp_methods */
|
|
|
|
|
type_members, /* tp_members */
|
|
|
|
|
type_getsets, /* tp_getset */
|
|
|
|
|
0, /* tp_base */
|
|
|
|
|
0, /* tp_dict */
|
|
|
|
|
0, /* tp_descr_get */
|
|
|
|
|
0, /* tp_descr_set */
|
|
|
|
|
offsetof(PyTypeObject, tp_dict), /* tp_dictoffset */
|
|
|
|
|
type_init, /* tp_init */
|
|
|
|
|
0, /* tp_alloc */
|
|
|
|
|
type_new, /* tp_new */
|
|
|
|
|
PyObject_GC_Del, /* tp_free */
|
2023-12-20 08:13:44 -06:00
|
|
|
type_is_gc, /* tp_is_gc */
|
2021-02-21 21:59:16 -05:00
|
|
|
.tp_vectorcall = type_vectorcall,
|
2001-08-02 04:15:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* The base type of all types (eventually)... except itself. */
|
|
|
|
|
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
/* You may wonder why object.__new__() only complains about arguments
|
|
|
|
|
when object.__init__() is not overridden, and vice versa.
|
|
|
|
|
|
|
|
|
|
Consider the use cases:
|
|
|
|
|
|
|
|
|
|
1. When neither is overridden, we want to hear complaints about
|
|
|
|
|
excess (i.e., any) arguments, since their presence could
|
|
|
|
|
indicate there's a bug.
|
|
|
|
|
|
|
|
|
|
2. When defining an Immutable type, we are likely to override only
|
|
|
|
|
__new__(), since __init__() is called too late to initialize an
|
|
|
|
|
Immutable object. Since __new__() defines the signature for the
|
|
|
|
|
type, it would be a pain to have to override __init__() just to
|
|
|
|
|
stop it from complaining about excess arguments.
|
|
|
|
|
|
|
|
|
|
3. When defining a Mutable type, we are likely to override only
|
|
|
|
|
__init__(). So here the converse reasoning applies: we don't
|
|
|
|
|
want to have to override __new__() just to stop it from
|
|
|
|
|
complaining.
|
|
|
|
|
|
|
|
|
|
4. When __init__() is overridden, and the subclass __init__() calls
|
|
|
|
|
object.__init__(), the latter should complain about excess
|
|
|
|
|
arguments; ditto for __new__().
|
|
|
|
|
|
|
|
|
|
Use cases 2 and 3 make it unattractive to unconditionally check for
|
|
|
|
|
excess arguments. The best solution that addresses all four use
|
|
|
|
|
cases is as follows: __init__() complains about excess arguments
|
|
|
|
|
unless __new__() is overridden and __init__() is not overridden
|
|
|
|
|
(IOW, if __init__() is overridden or __new__() is not overridden);
|
|
|
|
|
symmetrically, __new__() complains about excess arguments unless
|
|
|
|
|
__init__() is overridden and __new__() is not overridden
|
|
|
|
|
(IOW, if __new__() is overridden or __init__() is not overridden).
|
|
|
|
|
|
|
|
|
|
However, for backwards compatibility, this breaks too much code.
|
|
|
|
|
Therefore, in 2.6, we'll *warn* about excess arguments when both
|
|
|
|
|
methods are overridden; for all other cases we'll use the above
|
|
|
|
|
rules.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Forward */
|
|
|
|
|
static PyObject *
|
|
|
|
|
object_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
excess_args(PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
return PyTuple_GET_SIZE(args) ||
|
2016-12-16 16:18:57 +02:00
|
|
|
(kwds && PyDict_Check(kwds) && PyDict_GET_SIZE(kwds));
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static int
|
|
|
|
|
object_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
2012-03-17 00:05:44 -05:00
|
|
|
PyTypeObject *type = Py_TYPE(self);
|
2017-09-20 06:44:32 +03:00
|
|
|
if (excess_args(args, kwds)) {
|
|
|
|
|
if (type->tp_init != object_init) {
|
2019-02-19 18:53:48 +05:30
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"object.__init__() takes exactly one argument (the instance to initialize)");
|
2017-09-20 06:44:32 +03:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (type->tp_new == object_new) {
|
2019-02-19 18:53:48 +05:30
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"%.200s.__init__() takes exactly one argument (the instance to initialize)",
|
2017-09-20 06:44:32 +03:00
|
|
|
type->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2017-09-20 06:44:32 +03:00
|
|
|
return 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2003-02-13 16:30:16 +00:00
|
|
|
static PyObject *
|
|
|
|
|
object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
2017-09-20 06:44:32 +03:00
|
|
|
if (excess_args(args, kwds)) {
|
|
|
|
|
if (type->tp_new != object_new) {
|
2019-02-19 18:53:48 +05:30
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"object.__new__() takes exactly one argument (the type to instantiate)");
|
2017-09-20 06:44:32 +03:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (type->tp_init == object_init) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2012-03-17 00:05:44 -05:00
|
|
|
}
|
2012-03-26 22:10:51 +02:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_IS_ABSTRACT) {
|
2019-02-25 17:59:46 +02:00
|
|
|
PyObject *abstract_methods;
|
|
|
|
|
PyObject *sorted_methods;
|
|
|
|
|
PyObject *joined;
|
2022-11-05 11:31:57 -05:00
|
|
|
PyObject* comma_w_quotes_sep;
|
2019-09-11 08:29:44 -07:00
|
|
|
Py_ssize_t method_count;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-11-05 11:31:57 -05:00
|
|
|
/* Compute "', '".join(sorted(type.__abstractmethods__))
|
2010-05-09 15:52:27 +00:00
|
|
|
into joined. */
|
2025-02-25 11:44:59 +01:00
|
|
|
abstract_methods = type_abstractmethods((PyObject *)type, NULL);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (abstract_methods == NULL)
|
2019-02-25 17:59:46 +02:00
|
|
|
return NULL;
|
|
|
|
|
sorted_methods = PySequence_List(abstract_methods);
|
|
|
|
|
Py_DECREF(abstract_methods);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (sorted_methods == NULL)
|
2019-02-25 17:59:46 +02:00
|
|
|
return NULL;
|
|
|
|
|
if (PyList_Sort(sorted_methods)) {
|
|
|
|
|
Py_DECREF(sorted_methods);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-11-05 11:31:57 -05:00
|
|
|
comma_w_quotes_sep = PyUnicode_FromString("', '");
|
2024-05-10 10:31:55 +01:00
|
|
|
if (!comma_w_quotes_sep) {
|
|
|
|
|
Py_DECREF(sorted_methods);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-11-05 11:31:57 -05:00
|
|
|
joined = PyUnicode_Join(comma_w_quotes_sep, sorted_methods);
|
2024-05-10 10:31:55 +01:00
|
|
|
Py_DECREF(comma_w_quotes_sep);
|
2022-11-05 11:31:57 -05:00
|
|
|
if (joined == NULL) {
|
2024-05-10 10:31:55 +01:00
|
|
|
Py_DECREF(sorted_methods);
|
2019-02-25 17:59:46 +02:00
|
|
|
return NULL;
|
2022-11-05 11:31:57 -05:00
|
|
|
}
|
2024-05-10 10:31:55 +01:00
|
|
|
method_count = PyObject_Length(sorted_methods);
|
|
|
|
|
Py_DECREF(sorted_methods);
|
2022-11-05 11:31:57 -05:00
|
|
|
if (method_count == -1) {
|
|
|
|
|
Py_DECREF(joined);
|
2019-09-11 08:29:44 -07:00
|
|
|
return NULL;
|
2022-11-05 11:31:57 -05:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"Can't instantiate abstract class %s "
|
2022-11-05 11:31:57 -05:00
|
|
|
"without an implementation for abstract method%s '%U'",
|
2010-05-09 15:52:27 +00:00
|
|
|
type->tp_name,
|
2019-09-11 08:29:44 -07:00
|
|
|
method_count > 1 ? "s" : "",
|
2010-05-09 15:52:27 +00:00
|
|
|
joined);
|
2019-02-25 17:59:46 +02:00
|
|
|
Py_DECREF(joined);
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2021-08-04 16:41:14 +01:00
|
|
|
PyObject *obj = type->tp_alloc(type, 0);
|
|
|
|
|
if (obj == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return obj;
|
2003-02-13 16:30:16 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static void
|
|
|
|
|
object_dealloc(PyObject *self)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_TYPE(self)->tp_free(self);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-12 05:17:56 +00:00
|
|
|
static PyObject *
|
|
|
|
|
object_repr(PyObject *self)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *type;
|
|
|
|
|
PyObject *mod, *name, *rtn;
|
|
|
|
|
|
|
|
|
|
type = Py_TYPE(self);
|
2024-03-14 19:17:43 +01:00
|
|
|
mod = type_module(type);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (mod == NULL)
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
else if (!PyUnicode_Check(mod)) {
|
2022-11-23 14:57:50 +01:00
|
|
|
Py_SETREF(mod, NULL);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2025-02-25 11:44:59 +01:00
|
|
|
name = type_qualname((PyObject *)type, NULL);
|
2012-09-10 16:57:36 +02:00
|
|
|
if (name == NULL) {
|
|
|
|
|
Py_XDECREF(mod);
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
2012-09-10 16:57:36 +02:00
|
|
|
}
|
2022-02-08 13:39:07 -07:00
|
|
|
if (mod != NULL && !_PyUnicode_Equal(mod, &_Py_ID(builtins)))
|
2010-05-09 15:52:27 +00:00
|
|
|
rtn = PyUnicode_FromFormat("<%U.%U object at %p>", mod, name, self);
|
|
|
|
|
else
|
|
|
|
|
rtn = PyUnicode_FromFormat("<%s object at %p>",
|
|
|
|
|
type->tp_name, self);
|
|
|
|
|
Py_XDECREF(mod);
|
|
|
|
|
Py_DECREF(name);
|
|
|
|
|
return rtn;
|
2001-08-12 05:17:56 +00:00
|
|
|
}
|
|
|
|
|
|
- Another big step in the right direction. All the overridable
operators for which a default implementation exist now work, both in
dynamic classes and in static classes, overridden or not. This
affects __repr__, __str__, __hash__, __contains__, __nonzero__,
__cmp__, and the rich comparisons (__lt__ etc.). For dynamic
classes, this meant copying a lot of code from classobject! (XXX
There are still some holes, because the comparison code in object.c
uses PyInstance_Check(), meaning new-style classes don't get the
same dispensation. This needs more thinking.)
- Add object.__hash__, object.__repr__, object.__str__. The __str__
dispatcher now calls the __repr__ dispatcher, as it should.
- For static classes, the tp_compare, tp_richcompare and tp_hash slots
are now inherited together, or not at all. (XXX I fear there are
still some situations where you can inherit __hash__ when you
shouldn't, but mostly it's OK now, and I think there's no way we can
get that 100% right.)
2001-08-15 23:57:02 +00:00
|
|
|
static PyObject *
|
|
|
|
|
object_str(PyObject *self)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
unaryfunc f;
|
- Another big step in the right direction. All the overridable
operators for which a default implementation exist now work, both in
dynamic classes and in static classes, overridden or not. This
affects __repr__, __str__, __hash__, __contains__, __nonzero__,
__cmp__, and the rich comparisons (__lt__ etc.). For dynamic
classes, this meant copying a lot of code from classobject! (XXX
There are still some holes, because the comparison code in object.c
uses PyInstance_Check(), meaning new-style classes don't get the
same dispensation. This needs more thinking.)
- Add object.__hash__, object.__repr__, object.__str__. The __str__
dispatcher now calls the __repr__ dispatcher, as it should.
- For static classes, the tp_compare, tp_richcompare and tp_hash slots
are now inherited together, or not at all. (XXX I fear there are
still some situations where you can inherit __hash__ when you
shouldn't, but mostly it's OK now, and I think there's no way we can
get that 100% right.)
2001-08-15 23:57:02 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
f = Py_TYPE(self)->tp_repr;
|
2012-04-24 11:06:25 -04:00
|
|
|
if (f == NULL)
|
2010-05-09 15:52:27 +00:00
|
|
|
f = object_repr;
|
|
|
|
|
return f(self);
|
- Another big step in the right direction. All the overridable
operators for which a default implementation exist now work, both in
dynamic classes and in static classes, overridden or not. This
affects __repr__, __str__, __hash__, __contains__, __nonzero__,
__cmp__, and the rich comparisons (__lt__ etc.). For dynamic
classes, this meant copying a lot of code from classobject! (XXX
There are still some holes, because the comparison code in object.c
uses PyInstance_Check(), meaning new-style classes don't get the
same dispensation. This needs more thinking.)
- Add object.__hash__, object.__repr__, object.__str__. The __str__
dispatcher now calls the __repr__ dispatcher, as it should.
- For static classes, the tp_compare, tp_richcompare and tp_hash slots
are now inherited together, or not at all. (XXX I fear there are
still some situations where you can inherit __hash__ when you
shouldn't, but mostly it's OK now, and I think there's no way we can
get that 100% right.)
2001-08-15 23:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
2006-08-24 00:41:19 +00:00
|
|
|
static PyObject *
|
|
|
|
|
object_richcompare(PyObject *self, PyObject *other, int op)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *res;
|
|
|
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
|
|
|
|
|
|
case Py_EQ:
|
|
|
|
|
/* Return NotImplemented instead of False, so if two
|
|
|
|
|
objects are compared, both get a chance at the
|
|
|
|
|
comparison. See issue #1393. */
|
2022-11-10 23:40:31 +01:00
|
|
|
res = Py_NewRef((self == other) ? Py_True : Py_NotImplemented);
|
2010-05-09 15:52:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Py_NE:
|
2015-01-26 09:57:07 +02:00
|
|
|
/* By default, __ne__() delegates to __eq__() and inverts the result,
|
2010-05-09 15:52:27 +00:00
|
|
|
unless the latter returns NotImplemented. */
|
2020-02-07 03:04:21 +01:00
|
|
|
if (Py_TYPE(self)->tp_richcompare == NULL) {
|
2022-11-10 23:40:31 +01:00
|
|
|
res = Py_NewRef(Py_NotImplemented);
|
2015-01-26 09:57:07 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2020-02-07 03:04:21 +01:00
|
|
|
res = (*Py_TYPE(self)->tp_richcompare)(self, other, Py_EQ);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (res != NULL && res != Py_NotImplemented) {
|
|
|
|
|
int ok = PyObject_IsTrue(res);
|
|
|
|
|
Py_DECREF(res);
|
|
|
|
|
if (ok < 0)
|
|
|
|
|
res = NULL;
|
|
|
|
|
else {
|
|
|
|
|
if (ok)
|
2022-11-10 23:40:31 +01:00
|
|
|
res = Py_NewRef(Py_False);
|
2010-05-09 15:52:27 +00:00
|
|
|
else
|
2022-11-10 23:40:31 +01:00
|
|
|
res = Py_NewRef(Py_True);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2022-11-10 23:40:31 +01:00
|
|
|
res = Py_NewRef(Py_NotImplemented);
|
2010-05-09 15:52:27 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
2006-08-24 00:41:19 +00:00
|
|
|
}
|
|
|
|
|
|
2023-12-07 04:56:01 -08:00
|
|
|
PyObject*
|
|
|
|
|
_Py_BaseObject_RichCompare(PyObject* self, PyObject* other, int op)
|
|
|
|
|
{
|
|
|
|
|
return object_richcompare(self, other, op);
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-25 03:43:42 +00:00
|
|
|
static PyObject *
|
|
|
|
|
object_get_class(PyObject *self, void *closure)
|
|
|
|
|
{
|
2022-11-10 23:40:31 +01:00
|
|
|
return Py_NewRef(Py_TYPE(self));
|
2001-09-25 03:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2015-01-30 13:33:42 -05:00
|
|
|
compatible_with_tp_base(PyTypeObject *child)
|
2001-09-25 03:43:42 +00:00
|
|
|
{
|
2015-01-30 13:33:42 -05:00
|
|
|
PyTypeObject *parent = child->tp_base;
|
|
|
|
|
return (parent != NULL &&
|
|
|
|
|
child->tp_basicsize == parent->tp_basicsize &&
|
|
|
|
|
child->tp_itemsize == parent->tp_itemsize &&
|
|
|
|
|
child->tp_dictoffset == parent->tp_dictoffset &&
|
|
|
|
|
child->tp_weaklistoffset == parent->tp_weaklistoffset &&
|
|
|
|
|
((child->tp_flags & Py_TPFLAGS_HAVE_GC) ==
|
|
|
|
|
(parent->tp_flags & Py_TPFLAGS_HAVE_GC)) &&
|
|
|
|
|
(child->tp_dealloc == subtype_dealloc ||
|
|
|
|
|
child->tp_dealloc == parent->tp_dealloc));
|
2001-09-25 03:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
same_slots_added(PyTypeObject *a, PyTypeObject *b)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *base = a->tp_base;
|
|
|
|
|
Py_ssize_t size;
|
|
|
|
|
PyObject *slots_a, *slots_b;
|
|
|
|
|
|
2011-01-17 19:24:34 +00:00
|
|
|
assert(base == b->tp_base);
|
2010-05-09 15:52:27 +00:00
|
|
|
size = base->tp_basicsize;
|
|
|
|
|
if (a->tp_dictoffset == size && b->tp_dictoffset == size)
|
|
|
|
|
size += sizeof(PyObject *);
|
|
|
|
|
if (a->tp_weaklistoffset == size && b->tp_weaklistoffset == size)
|
|
|
|
|
size += sizeof(PyObject *);
|
|
|
|
|
|
|
|
|
|
/* Check slots compliance */
|
2015-01-30 13:33:42 -05:00
|
|
|
if (!(a->tp_flags & Py_TPFLAGS_HEAPTYPE) ||
|
|
|
|
|
!(b->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
slots_a = ((PyHeapTypeObject *)a)->ht_slots;
|
|
|
|
|
slots_b = ((PyHeapTypeObject *)b)->ht_slots;
|
|
|
|
|
if (slots_a && slots_b) {
|
|
|
|
|
if (PyObject_RichCompareBool(slots_a, slots_b, Py_EQ) != 1)
|
|
|
|
|
return 0;
|
|
|
|
|
size += sizeof(PyObject *) * PyTuple_GET_SIZE(slots_a);
|
|
|
|
|
}
|
|
|
|
|
return size == a->tp_basicsize && size == b->tp_basicsize;
|
2001-09-25 03:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
2002-11-26 14:47:27 +00:00
|
|
|
static int
|
2015-12-25 20:01:53 +02:00
|
|
|
compatible_for_assignment(PyTypeObject* oldto, PyTypeObject* newto, const char* attr)
|
2002-11-26 14:47:27 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *newbase, *oldbase;
|
|
|
|
|
|
2015-01-30 13:33:42 -05:00
|
|
|
if (newto->tp_free != oldto->tp_free) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"%s assignment: "
|
|
|
|
|
"'%s' deallocator differs from '%s'",
|
|
|
|
|
attr,
|
|
|
|
|
newto->tp_name,
|
|
|
|
|
oldto->tp_name);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2015-01-30 13:33:42 -05:00
|
|
|
/*
|
|
|
|
|
It's tricky to tell if two arbitrary types are sufficiently compatible as
|
|
|
|
|
to be interchangeable; e.g., even if they have the same tp_basicsize, they
|
|
|
|
|
might have totally different struct fields. It's much easier to tell if a
|
|
|
|
|
type and its supertype are compatible; e.g., if they have the same
|
|
|
|
|
tp_basicsize, then that means they have identical fields. So to check
|
|
|
|
|
whether two arbitrary types are compatible, we first find the highest
|
|
|
|
|
supertype that each is compatible with, and then if those supertypes are
|
|
|
|
|
compatible then the original types must also be compatible.
|
|
|
|
|
*/
|
2010-05-09 15:52:27 +00:00
|
|
|
newbase = newto;
|
|
|
|
|
oldbase = oldto;
|
2015-01-30 13:33:42 -05:00
|
|
|
while (compatible_with_tp_base(newbase))
|
2010-05-09 15:52:27 +00:00
|
|
|
newbase = newbase->tp_base;
|
2015-01-30 13:33:42 -05:00
|
|
|
while (compatible_with_tp_base(oldbase))
|
2010-05-09 15:52:27 +00:00
|
|
|
oldbase = oldbase->tp_base;
|
|
|
|
|
if (newbase != oldbase &&
|
|
|
|
|
(newbase->tp_base != oldbase->tp_base ||
|
|
|
|
|
!same_slots_added(newbase, oldbase))) {
|
2021-12-07 16:02:53 +00:00
|
|
|
goto differs;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2024-04-02 11:59:21 +01:00
|
|
|
if ((oldto->tp_flags & Py_TPFLAGS_INLINE_VALUES) !=
|
|
|
|
|
((newto->tp_flags & Py_TPFLAGS_INLINE_VALUES)))
|
|
|
|
|
{
|
|
|
|
|
goto differs;
|
|
|
|
|
}
|
2022-08-16 13:57:18 +01:00
|
|
|
/* The above does not check for the preheader */
|
|
|
|
|
if ((oldto->tp_flags & Py_TPFLAGS_PREHEADER) ==
|
|
|
|
|
((newto->tp_flags & Py_TPFLAGS_PREHEADER)))
|
2021-12-07 16:02:53 +00:00
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
differs:
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"%s assignment: "
|
|
|
|
|
"'%s' object layout differs from '%s'",
|
|
|
|
|
attr,
|
|
|
|
|
newto->tp_name,
|
|
|
|
|
oldto->tp_name);
|
|
|
|
|
return 0;
|
2002-11-26 14:47:27 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-21 21:39:01 +01:00
|
|
|
|
2019-05-23 08:45:22 -07:00
|
|
|
|
2024-07-11 02:02:08 +08:00
|
|
|
static int
|
|
|
|
|
object_set_class_world_stopped(PyObject *self, PyTypeObject *newto)
|
|
|
|
|
{
|
2024-06-12 03:10:23 +08:00
|
|
|
PyTypeObject *oldto = Py_TYPE(self);
|
|
|
|
|
|
2015-09-04 20:54:07 -07:00
|
|
|
/* In versions of CPython prior to 3.5, the code in
|
|
|
|
|
compatible_for_assignment was not set up to correctly check for memory
|
|
|
|
|
layout / slot / etc. compatibility for non-HEAPTYPE classes, so we just
|
|
|
|
|
disallowed __class__ assignment in any case that wasn't HEAPTYPE ->
|
|
|
|
|
HEAPTYPE.
|
|
|
|
|
|
|
|
|
|
During the 3.5 development cycle, we fixed the code in
|
|
|
|
|
compatible_for_assignment to correctly check compatibility between
|
|
|
|
|
arbitrary types, and started allowing __class__ assignment in all cases
|
|
|
|
|
where the old and new types did in fact have compatible slots and
|
|
|
|
|
memory layout (regardless of whether they were implemented as HEAPTYPEs
|
|
|
|
|
or not).
|
|
|
|
|
|
|
|
|
|
Just before 3.5 was released, though, we discovered that this led to
|
|
|
|
|
problems with immutable types like int, where the interpreter assumes
|
|
|
|
|
they are immutable and interns some values. Formerly this wasn't a
|
|
|
|
|
problem, because they really were immutable -- in particular, all the
|
|
|
|
|
types where the interpreter applied this interning trick happened to
|
|
|
|
|
also be statically allocated, so the old HEAPTYPE rules were
|
|
|
|
|
"accidentally" stopping them from allowing __class__ assignment. But
|
|
|
|
|
with the changes to __class__ assignment, we started allowing code like
|
|
|
|
|
|
|
|
|
|
class MyInt(int):
|
|
|
|
|
...
|
|
|
|
|
# Modifies the type of *all* instances of 1 in the whole program,
|
|
|
|
|
# including future instances (!), because the 1 object is interned.
|
|
|
|
|
(1).__class__ = MyInt
|
|
|
|
|
|
|
|
|
|
(see https://bugs.python.org/issue24912).
|
|
|
|
|
|
|
|
|
|
In theory the proper fix would be to identify which classes rely on
|
|
|
|
|
this invariant and somehow disallow __class__ assignment only for them,
|
|
|
|
|
perhaps via some mechanism like a new Py_TPFLAGS_IMMUTABLE flag (a
|
2020-08-11 15:26:59 +02:00
|
|
|
"denylisting" approach). But in practice, since this problem wasn't
|
2015-09-04 20:54:07 -07:00
|
|
|
noticed late in the 3.5 RC cycle, we're taking the conservative
|
|
|
|
|
approach and reinstating the same HEAPTYPE->HEAPTYPE check that we used
|
2020-08-11 15:26:59 +02:00
|
|
|
to have, plus an "allowlist". For now, the allowlist consists only of
|
2015-09-04 20:54:07 -07:00
|
|
|
ModuleType subtypes, since those are the cases that motivated the patch
|
|
|
|
|
in the first place -- see https://bugs.python.org/issue22986 -- and
|
|
|
|
|
since module objects are mutable we can be sure that they are
|
|
|
|
|
definitely not being interned. So now we allow HEAPTYPE->HEAPTYPE *or*
|
|
|
|
|
ModuleType subtype -> ModuleType subtype.
|
|
|
|
|
|
|
|
|
|
So far as we know, all the code beyond the following 'if' statement
|
|
|
|
|
will correctly handle non-HEAPTYPE classes, and the HEAPTYPE check is
|
|
|
|
|
needed only to protect that subset of non-HEAPTYPE classes for which
|
|
|
|
|
the interpreter has baked in the assumption that all instances are
|
|
|
|
|
truly immutable.
|
|
|
|
|
*/
|
|
|
|
|
if (!(PyType_IsSubtype(newto, &PyModule_Type) &&
|
|
|
|
|
PyType_IsSubtype(oldto, &PyModule_Type)) &&
|
2021-04-30 12:07:02 +02:00
|
|
|
(_PyType_HasFeature(newto, Py_TPFLAGS_IMMUTABLETYPE) ||
|
|
|
|
|
_PyType_HasFeature(oldto, Py_TPFLAGS_IMMUTABLETYPE))) {
|
2015-09-04 20:54:07 -07:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
2021-04-30 12:07:02 +02:00
|
|
|
"__class__ assignment only supported for mutable types "
|
2015-09-04 20:54:07 -07:00
|
|
|
"or ModuleType subclasses");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-20 14:19:46 +02:00
|
|
|
if (compatible_for_assignment(oldto, newto, "__class__")) {
|
2021-10-13 14:19:34 +01:00
|
|
|
/* Changing the class will change the implicit dict keys,
|
|
|
|
|
* so we must materialize the dictionary first. */
|
2024-04-02 11:59:21 +01:00
|
|
|
if (oldto->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
|
2024-07-11 02:02:08 +08:00
|
|
|
PyDictObject *dict = _PyObject_GetManagedDict(self);
|
2024-04-02 11:59:21 +01:00
|
|
|
if (dict == NULL) {
|
2024-07-11 02:02:08 +08:00
|
|
|
dict = _PyObject_MaterializeManagedDict_LockHeld(self);
|
|
|
|
|
if (dict == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2024-04-21 22:57:05 -07:00
|
|
|
}
|
|
|
|
|
|
2024-07-11 02:02:08 +08:00
|
|
|
assert(_PyObject_GetManagedDict(self) == dict);
|
2024-04-21 22:57:05 -07:00
|
|
|
|
|
|
|
|
if (_PyDict_DetachFromObject(dict, self) < 0) {
|
2024-04-02 11:59:21 +01:00
|
|
|
return -1;
|
|
|
|
|
}
|
2024-07-11 02:02:08 +08:00
|
|
|
|
2021-10-13 14:19:34 +01:00
|
|
|
}
|
2020-02-07 09:17:07 +01:00
|
|
|
if (newto->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
2015-01-30 13:33:42 -05:00
|
|
|
Py_INCREF(newto);
|
2020-02-07 09:17:07 +01:00
|
|
|
}
|
2024-07-11 02:02:08 +08:00
|
|
|
|
2020-02-07 09:17:07 +01:00
|
|
|
Py_SET_TYPE(self, newto);
|
2024-07-11 02:02:08 +08:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
object_set_class(PyObject *self, PyObject *value, void *closure)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (value == NULL) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"can't delete __class__ attribute");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!PyType_Check(value)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"__class__ must be set to a class, not '%s' object",
|
|
|
|
|
Py_TYPE(value)->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
PyTypeObject *newto = (PyTypeObject *)value;
|
|
|
|
|
|
|
|
|
|
if (PySys_Audit("object.__setattr__", "OsO",
|
|
|
|
|
self, "__class__", value) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-28 23:38:29 -07:00
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
_PyEval_StopTheWorld(interp);
|
|
|
|
|
#endif
|
2024-07-11 02:02:08 +08:00
|
|
|
PyTypeObject *oldto = Py_TYPE(self);
|
|
|
|
|
int res = object_set_class_world_stopped(self, newto);
|
2025-04-28 23:38:29 -07:00
|
|
|
#ifdef Py_GIL_DISABLED
|
|
|
|
|
_PyEval_StartTheWorld(interp);
|
|
|
|
|
#endif
|
2024-07-11 02:02:08 +08:00
|
|
|
if (res == 0) {
|
2024-06-12 20:41:07 +08:00
|
|
|
if (oldto->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
2015-01-30 13:33:42 -05:00
|
|
|
Py_DECREF(oldto);
|
2024-06-12 20:41:07 +08:00
|
|
|
}
|
2024-01-25 06:10:51 -05:00
|
|
|
|
|
|
|
|
RARE_EVENT_INC(set_class);
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
2024-07-11 02:02:08 +08:00
|
|
|
return res;
|
2001-09-25 03:43:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyGetSetDef object_getsets[] = {
|
2010-05-09 15:52:27 +00:00
|
|
|
{"__class__", object_get_class, object_set_class,
|
|
|
|
|
PyDoc_STR("the object's class")},
|
|
|
|
|
{0}
|
2001-08-02 04:15:00 +00:00
|
|
|
};
|
|
|
|
|
|
2003-02-21 22:02:54 +00:00
|
|
|
|
|
|
|
|
/* Stuff to implement __reduce_ex__ for pickle protocols >= 2.
|
2008-05-11 08:55:36 +00:00
|
|
|
We fall back to helpers in copyreg for:
|
2003-02-21 22:02:54 +00:00
|
|
|
- pickle protocols < 2
|
|
|
|
|
- calculating the list of slot names (done only once per class)
|
|
|
|
|
- the __newobj__ function (which is used as a token but never called)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
2008-05-11 08:55:36 +00:00
|
|
|
import_copyreg(void)
|
2003-02-21 22:02:54 +00:00
|
|
|
{
|
2013-11-30 00:53:09 -08:00
|
|
|
/* Try to fetch cached copy of copyreg from sys.modules first in an
|
|
|
|
|
attempt to avoid the import overhead. Previously this was implemented
|
|
|
|
|
by storing a reference to the cached module in a static variable, but
|
2016-08-30 10:47:49 -07:00
|
|
|
this broke when multiple embedded interpreters were in use (see issue
|
2013-11-30 00:53:09 -08:00
|
|
|
#17408 and #19088). */
|
2022-02-08 13:39:07 -07:00
|
|
|
PyObject *copyreg_module = PyImport_GetModule(&_Py_ID(copyreg));
|
2013-11-30 00:53:09 -08:00
|
|
|
if (copyreg_module != NULL) {
|
|
|
|
|
return copyreg_module;
|
|
|
|
|
}
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return NULL;
|
2011-03-11 21:30:43 +01:00
|
|
|
}
|
2022-02-08 13:39:07 -07:00
|
|
|
return PyImport_Import(&_Py_ID(copyreg));
|
2003-02-21 22:02:54 +00:00
|
|
|
}
|
|
|
|
|
|
2016-09-09 12:42:51 -07:00
|
|
|
static PyObject *
|
2013-11-23 18:59:12 +01:00
|
|
|
_PyType_GetSlotNames(PyTypeObject *cls)
|
2003-02-21 22:02:54 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *copyreg;
|
|
|
|
|
PyObject *slotnames;
|
|
|
|
|
|
2013-11-23 18:59:12 +01:00
|
|
|
assert(PyType_Check(cls));
|
|
|
|
|
|
|
|
|
|
/* Get the slot names from the cache in the class if possible. */
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(cls);
|
2023-11-14 11:25:39 +02:00
|
|
|
if (PyDict_GetItemRef(dict, &_Py_ID(__slotnames__), &slotnames) < 0) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2013-11-23 18:59:12 +01:00
|
|
|
if (slotnames != NULL) {
|
|
|
|
|
if (slotnames != Py_None && !PyList_Check(slotnames)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"%.200s.__slotnames__ should be a list or None, "
|
|
|
|
|
"not %.200s",
|
|
|
|
|
cls->tp_name, Py_TYPE(slotnames)->tp_name);
|
2023-11-14 11:25:39 +02:00
|
|
|
Py_DECREF(slotnames);
|
2013-11-23 18:59:12 +01:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2023-11-14 11:25:39 +02:00
|
|
|
return slotnames;
|
2013-11-23 18:59:12 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2023-11-14 11:25:39 +02:00
|
|
|
/* The class does not have the slot names cached yet. */
|
2010-05-09 15:52:27 +00:00
|
|
|
copyreg = import_copyreg();
|
|
|
|
|
if (copyreg == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2013-11-23 18:59:12 +01:00
|
|
|
/* Use _slotnames function from the copyreg module to find the slots
|
|
|
|
|
by this class and its bases. This function will cache the result
|
|
|
|
|
in __slotnames__. */
|
2022-02-08 13:39:07 -07:00
|
|
|
slotnames = PyObject_CallMethodOneArg(
|
|
|
|
|
copyreg, &_Py_ID(_slotnames), (PyObject *)cls);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(copyreg);
|
2013-11-23 18:59:12 +01:00
|
|
|
if (slotnames == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (slotnames != Py_None && !PyList_Check(slotnames)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
2013-11-23 18:59:12 +01:00
|
|
|
"copyreg._slotnames didn't return a list or None");
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(slotnames);
|
2013-11-23 18:59:12 +01:00
|
|
|
return NULL;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return slotnames;
|
2003-02-21 22:02:54 +00:00
|
|
|
}
|
|
|
|
|
|
2016-09-09 12:42:51 -07:00
|
|
|
static PyObject *
|
2022-04-06 20:00:14 +03:00
|
|
|
object_getstate_default(PyObject *obj, int required)
|
2003-02-21 22:02:54 +00:00
|
|
|
{
|
2013-11-23 18:59:12 +01:00
|
|
|
PyObject *state;
|
2022-04-06 20:00:14 +03:00
|
|
|
PyObject *slotnames;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
if (required && Py_TYPE(obj)->tp_itemsize) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"cannot pickle %.200s objects",
|
|
|
|
|
Py_TYPE(obj)->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_PyObject_IsInstanceDictEmpty(obj)) {
|
2022-11-10 23:40:31 +01:00
|
|
|
state = Py_NewRef(Py_None);
|
2022-04-06 20:00:14 +03:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
state = PyObject_GenericGetDict(obj, NULL);
|
|
|
|
|
if (state == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
slotnames = _PyType_GetSlotNames(Py_TYPE(obj));
|
|
|
|
|
if (slotnames == NULL) {
|
|
|
|
|
Py_DECREF(state);
|
2018-01-25 10:49:40 +02:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
assert(slotnames == Py_None || PyList_Check(slotnames));
|
|
|
|
|
if (required) {
|
|
|
|
|
Py_ssize_t basicsize = PyBaseObject_Type.tp_basicsize;
|
|
|
|
|
if (Py_TYPE(obj)->tp_dictoffset &&
|
|
|
|
|
(Py_TYPE(obj)->tp_flags & Py_TPFLAGS_MANAGED_DICT) == 0)
|
|
|
|
|
{
|
|
|
|
|
basicsize += sizeof(PyObject *);
|
|
|
|
|
}
|
2022-08-16 13:57:18 +01:00
|
|
|
if (Py_TYPE(obj)->tp_weaklistoffset > 0) {
|
2022-04-06 20:00:14 +03:00
|
|
|
basicsize += sizeof(PyObject *);
|
|
|
|
|
}
|
|
|
|
|
if (slotnames != Py_None) {
|
|
|
|
|
basicsize += sizeof(PyObject *) * PyList_GET_SIZE(slotnames);
|
|
|
|
|
}
|
|
|
|
|
if (Py_TYPE(obj)->tp_basicsize > basicsize) {
|
|
|
|
|
Py_DECREF(slotnames);
|
|
|
|
|
Py_DECREF(state);
|
2015-12-25 21:04:29 +02:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
2018-10-31 02:28:07 +02:00
|
|
|
"cannot pickle '%.200s' object",
|
2015-12-25 21:04:29 +02:00
|
|
|
Py_TYPE(obj)->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-04-06 20:00:14 +03:00
|
|
|
}
|
2013-11-23 18:59:12 +01:00
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
if (slotnames != Py_None && PyList_GET_SIZE(slotnames) > 0) {
|
|
|
|
|
PyObject *slots;
|
|
|
|
|
Py_ssize_t slotnames_size, i;
|
|
|
|
|
|
|
|
|
|
slots = PyDict_New();
|
|
|
|
|
if (slots == NULL) {
|
|
|
|
|
Py_DECREF(slotnames);
|
2013-11-23 18:59:12 +01:00
|
|
|
Py_DECREF(state);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
slotnames_size = PyList_GET_SIZE(slotnames);
|
|
|
|
|
for (i = 0; i < slotnames_size; i++) {
|
|
|
|
|
PyObject *name, *value;
|
|
|
|
|
|
2022-11-16 18:34:24 +01:00
|
|
|
name = Py_NewRef(PyList_GET_ITEM(slotnames, i));
|
2023-07-12 08:57:10 +03:00
|
|
|
if (PyObject_GetOptionalAttr(obj, name, &value) < 0) {
|
2022-04-06 20:00:14 +03:00
|
|
|
Py_DECREF(name);
|
|
|
|
|
goto error;
|
2021-10-13 14:19:34 +01:00
|
|
|
}
|
2022-04-06 20:00:14 +03:00
|
|
|
if (value == NULL) {
|
|
|
|
|
Py_DECREF(name);
|
|
|
|
|
/* It is not an error if the attribute is not present. */
|
2021-10-13 14:19:34 +01:00
|
|
|
}
|
2022-04-06 20:00:14 +03:00
|
|
|
else {
|
|
|
|
|
int err = PyDict_SetItem(slots, name, value);
|
|
|
|
|
Py_DECREF(name);
|
|
|
|
|
Py_DECREF(value);
|
|
|
|
|
if (err) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The list is stored on the class so it may mutate while we
|
|
|
|
|
iterate over it */
|
|
|
|
|
if (slotnames_size != PyList_GET_SIZE(slotnames)) {
|
|
|
|
|
PyErr_Format(PyExc_RuntimeError,
|
2024-09-06 19:50:55 +08:00
|
|
|
"__slotnames__ changed size during iteration");
|
2022-04-06 20:00:14 +03:00
|
|
|
goto error;
|
2021-10-13 14:19:34 +01:00
|
|
|
}
|
2022-04-06 20:00:14 +03:00
|
|
|
|
|
|
|
|
/* We handle errors within the loop here. */
|
|
|
|
|
if (0) {
|
|
|
|
|
error:
|
2015-12-25 21:04:29 +02:00
|
|
|
Py_DECREF(slotnames);
|
2022-04-06 20:00:14 +03:00
|
|
|
Py_DECREF(slots);
|
2015-12-25 21:04:29 +02:00
|
|
|
Py_DECREF(state);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
/* If we found some slot attributes, pack them in a tuple along
|
|
|
|
|
the original attribute dictionary. */
|
|
|
|
|
if (PyDict_GET_SIZE(slots) > 0) {
|
|
|
|
|
PyObject *state2;
|
2013-11-23 18:59:12 +01:00
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
state2 = PyTuple_Pack(2, state, slots);
|
|
|
|
|
Py_DECREF(state);
|
|
|
|
|
if (state2 == NULL) {
|
2013-11-23 18:59:12 +01:00
|
|
|
Py_DECREF(slotnames);
|
2022-04-06 20:00:14 +03:00
|
|
|
Py_DECREF(slots);
|
2013-11-23 18:59:12 +01:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-04-06 20:00:14 +03:00
|
|
|
state = state2;
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(slots);
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(slotnames);
|
2013-11-23 18:59:12 +01:00
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
return state;
|
|
|
|
|
}
|
2013-11-23 18:59:12 +01:00
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
static PyObject *
|
|
|
|
|
object_getstate(PyObject *obj, int required)
|
|
|
|
|
{
|
|
|
|
|
PyObject *getstate, *state;
|
2013-11-23 18:59:12 +01:00
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
getstate = PyObject_GetAttr(obj, &_Py_ID(__getstate__));
|
|
|
|
|
if (getstate == NULL) {
|
|
|
|
|
return NULL;
|
2013-11-23 18:59:12 +01:00
|
|
|
}
|
2022-04-06 20:00:14 +03:00
|
|
|
if (PyCFunction_Check(getstate) &&
|
|
|
|
|
PyCFunction_GET_SELF(getstate) == obj &&
|
|
|
|
|
PyCFunction_GET_FUNCTION(getstate) == object___getstate__)
|
|
|
|
|
{
|
2022-08-08 18:02:45 +10:00
|
|
|
/* If __getstate__ is not overridden pass the required argument. */
|
2022-04-06 20:00:14 +03:00
|
|
|
state = object_getstate_default(obj, required);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2021-10-12 00:42:23 +02:00
|
|
|
state = _PyObject_CallNoArgs(getstate);
|
2013-11-23 18:59:12 +01:00
|
|
|
}
|
2022-04-06 20:00:14 +03:00
|
|
|
Py_DECREF(getstate);
|
2013-11-23 18:59:12 +01:00
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
PyObject *
|
|
|
|
|
_PyObject_GetState(PyObject *obj)
|
|
|
|
|
{
|
|
|
|
|
return object_getstate(obj, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*[clinic input]
|
|
|
|
|
object.__getstate__
|
|
|
|
|
|
|
|
|
|
Helper for pickle.
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
object___getstate___impl(PyObject *self)
|
|
|
|
|
/*[clinic end generated code: output=5a2500dcb6217e9e input=692314d8fbe194ee]*/
|
|
|
|
|
{
|
|
|
|
|
return object_getstate_default(self, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-09 12:42:51 -07:00
|
|
|
static int
|
2013-11-23 18:59:12 +01:00
|
|
|
_PyObject_GetNewArguments(PyObject *obj, PyObject **args, PyObject **kwargs)
|
|
|
|
|
{
|
|
|
|
|
PyObject *getnewargs, *getnewargs_ex;
|
|
|
|
|
|
|
|
|
|
if (args == NULL || kwargs == NULL) {
|
|
|
|
|
PyErr_BadInternalCall();
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We first attempt to fetch the arguments for __new__ by calling
|
|
|
|
|
__getnewargs_ex__ on the object. */
|
2022-02-08 13:39:07 -07:00
|
|
|
getnewargs_ex = _PyObject_LookupSpecial(obj, &_Py_ID(__getnewargs_ex__));
|
2013-11-23 18:59:12 +01:00
|
|
|
if (getnewargs_ex != NULL) {
|
2021-10-12 00:42:23 +02:00
|
|
|
PyObject *newargs = _PyObject_CallNoArgs(getnewargs_ex);
|
2013-11-23 18:59:12 +01:00
|
|
|
Py_DECREF(getnewargs_ex);
|
|
|
|
|
if (newargs == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!PyTuple_Check(newargs)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"__getnewargs_ex__ should return a tuple, "
|
|
|
|
|
"not '%.200s'", Py_TYPE(newargs)->tp_name);
|
|
|
|
|
Py_DECREF(newargs);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2017-03-21 08:53:25 +02:00
|
|
|
if (PyTuple_GET_SIZE(newargs) != 2) {
|
2013-11-23 18:59:12 +01:00
|
|
|
PyErr_Format(PyExc_ValueError,
|
|
|
|
|
"__getnewargs_ex__ should return a tuple of "
|
2017-03-21 08:53:25 +02:00
|
|
|
"length 2, not %zd", PyTuple_GET_SIZE(newargs));
|
2013-11-23 18:59:12 +01:00
|
|
|
Py_DECREF(newargs);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2022-11-16 18:34:24 +01:00
|
|
|
*args = Py_NewRef(PyTuple_GET_ITEM(newargs, 0));
|
|
|
|
|
*kwargs = Py_NewRef(PyTuple_GET_ITEM(newargs, 1));
|
2013-11-23 18:59:12 +01:00
|
|
|
Py_DECREF(newargs);
|
|
|
|
|
|
|
|
|
|
/* XXX We should perhaps allow None to be passed here. */
|
|
|
|
|
if (!PyTuple_Check(*args)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"first item of the tuple returned by "
|
|
|
|
|
"__getnewargs_ex__ must be a tuple, not '%.200s'",
|
|
|
|
|
Py_TYPE(*args)->tp_name);
|
|
|
|
|
Py_CLEAR(*args);
|
|
|
|
|
Py_CLEAR(*kwargs);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!PyDict_Check(*kwargs)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"second item of the tuple returned by "
|
|
|
|
|
"__getnewargs_ex__ must be a dict, not '%.200s'",
|
|
|
|
|
Py_TYPE(*kwargs)->tp_name);
|
|
|
|
|
Py_CLEAR(*args);
|
|
|
|
|
Py_CLEAR(*kwargs);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2014-02-16 13:49:16 -05:00
|
|
|
} else if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
2013-11-23 18:59:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The object does not have __getnewargs_ex__ so we fallback on using
|
|
|
|
|
__getnewargs__ instead. */
|
2022-02-08 13:39:07 -07:00
|
|
|
getnewargs = _PyObject_LookupSpecial(obj, &_Py_ID(__getnewargs__));
|
2013-11-23 18:59:12 +01:00
|
|
|
if (getnewargs != NULL) {
|
2021-10-12 00:42:23 +02:00
|
|
|
*args = _PyObject_CallNoArgs(getnewargs);
|
2013-11-23 18:59:12 +01:00
|
|
|
Py_DECREF(getnewargs);
|
|
|
|
|
if (*args == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!PyTuple_Check(*args)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"__getnewargs__ should return a tuple, "
|
|
|
|
|
"not '%.200s'", Py_TYPE(*args)->tp_name);
|
|
|
|
|
Py_CLEAR(*args);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
*kwargs = NULL;
|
|
|
|
|
return 0;
|
2014-02-16 13:49:16 -05:00
|
|
|
} else if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
2013-11-23 18:59:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The object does not have __getnewargs_ex__ and __getnewargs__. This may
|
2016-04-19 04:03:41 +00:00
|
|
|
mean __new__ does not takes any arguments on this object, or that the
|
2013-11-23 18:59:12 +01:00
|
|
|
object does not implement the reduce protocol for pickling or
|
|
|
|
|
copying. */
|
|
|
|
|
*args = NULL;
|
|
|
|
|
*kwargs = NULL;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-09 12:42:51 -07:00
|
|
|
static int
|
2013-11-23 18:59:12 +01:00
|
|
|
_PyObject_GetItemsIter(PyObject *obj, PyObject **listitems,
|
|
|
|
|
PyObject **dictitems)
|
|
|
|
|
{
|
|
|
|
|
if (listitems == NULL || dictitems == NULL) {
|
|
|
|
|
PyErr_BadInternalCall();
|
|
|
|
|
return -1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!PyList_Check(obj)) {
|
2022-11-10 23:40:31 +01:00
|
|
|
*listitems = Py_NewRef(Py_None);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2013-11-23 18:59:12 +01:00
|
|
|
*listitems = PyObject_GetIter(obj);
|
2013-11-23 21:19:43 +01:00
|
|
|
if (*listitems == NULL)
|
2013-11-23 18:59:12 +01:00
|
|
|
return -1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!PyDict_Check(obj)) {
|
2022-11-10 23:40:31 +01:00
|
|
|
*dictitems = Py_NewRef(Py_None);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2022-02-08 13:39:07 -07:00
|
|
|
PyObject *items = PyObject_CallMethodNoArgs(obj, &_Py_ID(items));
|
2013-11-23 18:59:12 +01:00
|
|
|
if (items == NULL) {
|
|
|
|
|
Py_CLEAR(*listitems);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
*dictitems = PyObject_GetIter(items);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(items);
|
2013-11-23 18:59:12 +01:00
|
|
|
if (*dictitems == NULL) {
|
|
|
|
|
Py_CLEAR(*listitems);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
2013-11-23 18:59:12 +01:00
|
|
|
assert(*listitems != NULL && *dictitems != NULL);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
2015-10-10 22:42:18 +03:00
|
|
|
reduce_newobj(PyObject *obj)
|
2013-11-23 18:59:12 +01:00
|
|
|
{
|
|
|
|
|
PyObject *args = NULL, *kwargs = NULL;
|
|
|
|
|
PyObject *copyreg;
|
|
|
|
|
PyObject *newobj, *newargs, *state, *listitems, *dictitems;
|
|
|
|
|
PyObject *result;
|
2015-12-25 21:04:29 +02:00
|
|
|
int hasargs;
|
2013-11-23 18:59:12 +01:00
|
|
|
|
2015-11-12 11:23:04 +02:00
|
|
|
if (Py_TYPE(obj)->tp_new == NULL) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
2018-10-31 02:28:07 +02:00
|
|
|
"cannot pickle '%.200s' object",
|
2015-11-12 11:23:04 +02:00
|
|
|
Py_TYPE(obj)->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2014-12-16 19:43:46 +02:00
|
|
|
if (_PyObject_GetNewArguments(obj, &args, &kwargs) < 0)
|
2013-11-23 18:59:12 +01:00
|
|
|
return NULL;
|
2014-12-16 19:43:46 +02:00
|
|
|
|
2013-11-23 18:59:12 +01:00
|
|
|
copyreg = import_copyreg();
|
|
|
|
|
if (copyreg == NULL) {
|
2015-12-25 21:04:29 +02:00
|
|
|
Py_XDECREF(args);
|
2014-12-16 19:43:46 +02:00
|
|
|
Py_XDECREF(kwargs);
|
2013-11-23 18:59:12 +01:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2015-12-25 21:04:29 +02:00
|
|
|
hasargs = (args != NULL);
|
2016-12-16 16:18:57 +02:00
|
|
|
if (kwargs == NULL || PyDict_GET_SIZE(kwargs) == 0) {
|
2014-12-16 19:43:46 +02:00
|
|
|
PyObject *cls;
|
|
|
|
|
Py_ssize_t i, n;
|
|
|
|
|
|
|
|
|
|
Py_XDECREF(kwargs);
|
2022-02-08 13:39:07 -07:00
|
|
|
newobj = PyObject_GetAttr(copyreg, &_Py_ID(__newobj__));
|
2014-12-16 19:43:46 +02:00
|
|
|
Py_DECREF(copyreg);
|
|
|
|
|
if (newobj == NULL) {
|
2015-12-25 21:04:29 +02:00
|
|
|
Py_XDECREF(args);
|
2014-12-16 19:43:46 +02:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2015-12-25 21:04:29 +02:00
|
|
|
n = args ? PyTuple_GET_SIZE(args) : 0;
|
2014-12-16 19:43:46 +02:00
|
|
|
newargs = PyTuple_New(n+1);
|
|
|
|
|
if (newargs == NULL) {
|
2015-12-25 21:04:29 +02:00
|
|
|
Py_XDECREF(args);
|
2014-12-16 19:43:46 +02:00
|
|
|
Py_DECREF(newobj);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
cls = (PyObject *) Py_TYPE(obj);
|
2022-11-10 23:40:31 +01:00
|
|
|
PyTuple_SET_ITEM(newargs, 0, Py_NewRef(cls));
|
2014-12-16 19:43:46 +02:00
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
|
PyObject *v = PyTuple_GET_ITEM(args, i);
|
2022-11-10 23:40:31 +01:00
|
|
|
PyTuple_SET_ITEM(newargs, i+1, Py_NewRef(v));
|
2014-12-16 19:43:46 +02:00
|
|
|
}
|
2015-12-25 21:04:29 +02:00
|
|
|
Py_XDECREF(args);
|
2014-12-16 19:43:46 +02:00
|
|
|
}
|
2016-09-09 00:21:22 +02:00
|
|
|
else if (args != NULL) {
|
2022-02-08 13:39:07 -07:00
|
|
|
newobj = PyObject_GetAttr(copyreg, &_Py_ID(__newobj_ex__));
|
2014-12-16 19:43:46 +02:00
|
|
|
Py_DECREF(copyreg);
|
|
|
|
|
if (newobj == NULL) {
|
|
|
|
|
Py_DECREF(args);
|
|
|
|
|
Py_DECREF(kwargs);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
newargs = PyTuple_Pack(3, Py_TYPE(obj), args, kwargs);
|
2013-11-23 18:59:12 +01:00
|
|
|
Py_DECREF(args);
|
|
|
|
|
Py_DECREF(kwargs);
|
2014-12-16 19:43:46 +02:00
|
|
|
if (newargs == NULL) {
|
|
|
|
|
Py_DECREF(newobj);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2013-11-23 18:59:12 +01:00
|
|
|
}
|
2016-09-09 00:21:22 +02:00
|
|
|
else {
|
|
|
|
|
/* args == NULL */
|
2024-03-04 10:46:18 +01:00
|
|
|
Py_DECREF(copyreg);
|
2016-09-09 00:21:22 +02:00
|
|
|
Py_DECREF(kwargs);
|
|
|
|
|
PyErr_BadInternalCall();
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2014-12-16 19:43:46 +02:00
|
|
|
|
2022-04-06 20:00:14 +03:00
|
|
|
state = object_getstate(obj, !(hasargs || PyList_Check(obj) || PyDict_Check(obj)));
|
2013-11-23 18:59:12 +01:00
|
|
|
if (state == NULL) {
|
|
|
|
|
Py_DECREF(newobj);
|
|
|
|
|
Py_DECREF(newargs);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (_PyObject_GetItemsIter(obj, &listitems, &dictitems) < 0) {
|
|
|
|
|
Py_DECREF(newobj);
|
|
|
|
|
Py_DECREF(newargs);
|
|
|
|
|
Py_DECREF(state);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = PyTuple_Pack(5, newobj, newargs, state, listitems, dictitems);
|
|
|
|
|
Py_DECREF(newobj);
|
|
|
|
|
Py_DECREF(newargs);
|
|
|
|
|
Py_DECREF(state);
|
|
|
|
|
Py_DECREF(listitems);
|
|
|
|
|
Py_DECREF(dictitems);
|
2014-01-24 06:17:25 -08:00
|
|
|
return result;
|
2013-11-23 18:59:12 +01:00
|
|
|
}
|
|
|
|
|
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
/*
|
|
|
|
|
* There were two problems when object.__reduce__ and object.__reduce_ex__
|
|
|
|
|
* were implemented in the same function:
|
|
|
|
|
* - trying to pickle an object with a custom __reduce__ method that
|
|
|
|
|
* fell back to object.__reduce__ in certain circumstances led to
|
2015-07-03 01:04:23 -04:00
|
|
|
* infinite recursion at Python level and eventual RecursionError.
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
* - Pickling objects that lied about their type by overwriting the
|
|
|
|
|
* __class__ descriptor could lead to infinite recursion at C level
|
|
|
|
|
* and eventual segfault.
|
|
|
|
|
*
|
|
|
|
|
* Because of backwards compatibility, the two methods still have to
|
|
|
|
|
* behave in the same way, even if this is not required by the pickle
|
|
|
|
|
* protocol. This common functionality was moved to the _common_reduce
|
|
|
|
|
* function.
|
|
|
|
|
*/
|
|
|
|
|
static PyObject *
|
|
|
|
|
_common_reduce(PyObject *self, int proto)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *copyreg, *res;
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
|
2014-12-16 19:43:46 +02:00
|
|
|
if (proto >= 2)
|
2015-10-10 22:42:18 +03:00
|
|
|
return reduce_newobj(self);
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
copyreg = import_copyreg();
|
|
|
|
|
if (!copyreg)
|
|
|
|
|
return NULL;
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
|
2017-02-16 09:26:01 +09:00
|
|
|
res = PyObject_CallMethod(copyreg, "_reduce_ex", "Oi", self, proto);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(copyreg);
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return res;
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
object.__reduce__
|
|
|
|
|
|
|
|
|
|
Helper for pickle.
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
static PyObject *
|
2017-04-08 09:52:59 +03:00
|
|
|
object___reduce___impl(PyObject *self)
|
|
|
|
|
/*[clinic end generated code: output=d4ca691f891c6e2f input=11562e663947e18b]*/
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
{
|
2017-04-08 09:52:59 +03:00
|
|
|
return _common_reduce(self, 0);
|
2017-03-19 08:46:44 +02:00
|
|
|
}
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
object.__reduce_ex__
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
|
2017-04-08 09:52:59 +03:00
|
|
|
protocol: int
|
2017-03-19 08:46:44 +02:00
|
|
|
/
|
|
|
|
|
|
|
|
|
|
Helper for pickle.
|
|
|
|
|
[clinic start generated code]*/
|
Merged revisions 53952-54987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53954 | jeremy.hylton | 2007-02-26 10:41:18 -0800 (Mon, 26 Feb 2007) | 10 lines
Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
........
r53955 | jeremy.hylton | 2007-02-26 11:00:20 -0800 (Mon, 26 Feb 2007) | 2 lines
Fix assertion.
........
r53969 | neal.norwitz | 2007-02-26 14:41:45 -0800 (Mon, 26 Feb 2007) | 3 lines
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
........
r53970 | andrew.kuchling | 2007-02-26 15:02:47 -0800 (Mon, 26 Feb 2007) | 1 line
Markup fix
........
r53975 | neal.norwitz | 2007-02-26 15:48:27 -0800 (Mon, 26 Feb 2007) | 3 lines
SF #1669182, 2.5 was already fixed. Just assert in 2.6 since string exceptions
are gone.
........
r53976 | andrew.kuchling | 2007-02-26 15:54:17 -0800 (Mon, 26 Feb 2007) | 1 line
Add some items
........
r53981 | jeremy.hylton | 2007-02-26 17:01:59 -0800 (Mon, 26 Feb 2007) | 4 lines
Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
........
r53993 | jeremy.hylton | 2007-02-27 08:00:06 -0800 (Tue, 27 Feb 2007) | 2 lines
tabify
........
r53994 | jeremy.hylton | 2007-02-27 08:13:23 -0800 (Tue, 27 Feb 2007) | 5 lines
tabify
Note that ast.c still has a mix of tabs and spaces, because it
attempts to use four-space indents for more of the new code.
........
r53996 | jeremy.hylton | 2007-02-27 09:24:48 -0800 (Tue, 27 Feb 2007) | 2 lines
whitespace normalization
........
r53997 | jeremy.hylton | 2007-02-27 10:29:45 -0800 (Tue, 27 Feb 2007) | 24 lines
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
........
r53998 | jeremy.hylton | 2007-02-27 10:33:31 -0800 (Tue, 27 Feb 2007) | 2 lines
Add news about changes to metaclasses and __bases__ error checking.
........
r54016 | armin.rigo | 2007-02-28 01:25:29 -0800 (Wed, 28 Feb 2007) | 3 lines
Modify the segfaulting example to show why r53997 is not a solution to
it.
........
r54022 | brett.cannon | 2007-02-28 10:15:00 -0800 (Wed, 28 Feb 2007) | 2 lines
Add a test for instantiating SyntaxError with no arguments.
........
r54026 | raymond.hettinger | 2007-02-28 10:27:41 -0800 (Wed, 28 Feb 2007) | 1 line
Docstring nit.
........
r54033 | raymond.hettinger | 2007-02-28 10:37:52 -0800 (Wed, 28 Feb 2007) | 1 line
Prepare collections module for pure python code entries.
........
r54053 | raymond.hettinger | 2007-02-28 22:16:43 -0800 (Wed, 28 Feb 2007) | 1 line
Add collections.NamedTuple
........
r54054 | neal.norwitz | 2007-02-28 23:04:41 -0800 (Wed, 28 Feb 2007) | 1 line
Add Pat and Eric for work on PEP 3101 in the sandbox
........
r54061 | andrew.kuchling | 2007-03-01 06:36:12 -0800 (Thu, 01 Mar 2007) | 1 line
Add NamedTuple
........
r54080 | georg.brandl | 2007-03-02 06:37:12 -0800 (Fri, 02 Mar 2007) | 2 lines
Bug #1628895: some better tries to find HTML documentation in pydoc.
........
r54086 | raymond.hettinger | 2007-03-02 11:20:46 -0800 (Fri, 02 Mar 2007) | 1 line
Fix embarrassing typo and fix constantification of None
........
r54088 | georg.brandl | 2007-03-02 12:30:14 -0800 (Fri, 02 Mar 2007) | 2 lines
Bugs #1668032, #1668036, #1669304: clarify behavior of PyMem_Realloc and _Resize.
........
r54114 | georg.brandl | 2007-03-04 09:18:54 -0800 (Sun, 04 Mar 2007) | 2 lines
Fix a bug in test_dict and test_userdict, found at the PyPy sprint.
........
r54124 | skip.montanaro | 2007-03-04 12:52:28 -0800 (Sun, 04 Mar 2007) | 2 lines
Teach setup.py how to find Berkeley DB on Macs using MacPorts.
........
r54125 | skip.montanaro | 2007-03-04 12:54:12 -0800 (Sun, 04 Mar 2007) | 1 line
note MacPorts/BerkDB change in setup.py
........
r54136 | neal.norwitz | 2007-03-04 23:52:01 -0800 (Sun, 04 Mar 2007) | 1 line
Added Pete for 3101 too
........
r54138 | facundo.batista | 2007-03-05 08:31:54 -0800 (Mon, 05 Mar 2007) | 1 line
Minor corrections to docs, and an explanation comentary
........
r54139 | georg.brandl | 2007-03-05 14:28:08 -0800 (Mon, 05 Mar 2007) | 3 lines
Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
........
r54149 | georg.brandl | 2007-03-06 01:33:01 -0800 (Tue, 06 Mar 2007) | 3 lines
Nit: a struct field is set to GenericAlloc, not GenericAlloc().
........
r54150 | georg.brandl | 2007-03-06 02:02:47 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1671450: add a section about subclassing builtin types to the
"extending and embedding" tutorial.
........
r54152 | martin.v.loewis | 2007-03-06 02:41:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1121142: Implement ZipFile.open.
........
r54154 | georg.brandl | 2007-03-06 03:51:14 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the fix in #1674228.
........
r54156 | georg.brandl | 2007-03-06 03:52:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1672481: fix bug in idlelib.MultiCall.
........
r54159 | georg.brandl | 2007-03-06 04:17:50 -0800 (Tue, 06 Mar 2007) | 1 line
Bug #1674503: close the file opened by execfile() in an error condition.
........
r54160 | georg.brandl | 2007-03-06 05:32:52 -0800 (Tue, 06 Mar 2007) | 3 lines
Fix another reincarnation of bug #1576657 in defaultdict.
........
r54162 | georg.brandl | 2007-03-06 05:35:00 -0800 (Tue, 06 Mar 2007) | 2 lines
A test case for the defaultdict KeyError bug.
........
r54164 | georg.brandl | 2007-03-06 05:37:45 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
........
r54165 | martin.v.loewis | 2007-03-06 06:43:00 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
........
r54166 | skip.montanaro | 2007-03-06 07:41:38 -0800 (Tue, 06 Mar 2007) | 1 line
patch 1673619 - identify extension modules which cannot be built
........
r54167 | guido.van.rossum | 2007-03-06 07:50:01 -0800 (Tue, 06 Mar 2007) | 5 lines
Patch #1646728: datetime.fromtimestamp fails with negative
fractional times. With unittest.
Somebody please backport to 2.5.
........
r54169 | georg.brandl | 2007-03-06 09:49:14 -0800 (Tue, 06 Mar 2007) | 2 lines
Fix cmp vs. key argument for list.sort.
........
r54170 | georg.brandl | 2007-03-06 10:21:32 -0800 (Tue, 06 Mar 2007) | 2 lines
Small nit, found by Neal.
........
r54171 | georg.brandl | 2007-03-06 10:29:58 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1602128: clarify that richcmp methods can return NotImplemented
and should return True or False otherwise.
........
r54173 | georg.brandl | 2007-03-06 10:41:12 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1638879: don't accept strings with embedded NUL bytes in long().
........
r54175 | georg.brandl | 2007-03-06 10:47:31 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #1673121: update README wrt. OSX default shell.
........
r54177 | georg.brandl | 2007-03-06 10:59:11 -0800 (Tue, 06 Mar 2007) | 3 lines
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
........
r54180 | walter.doerwald | 2007-03-06 12:38:57 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
........
r54182 | walter.doerwald | 2007-03-06 13:15:24 -0800 (Tue, 06 Mar 2007) | 2 lines
Document change to curses.
........
r54188 | georg.brandl | 2007-03-06 16:34:46 -0800 (Tue, 06 Mar 2007) | 5 lines
Variant of patch #697613: don't exit the interpreter on a SystemExit
exception if the -i command line option or PYTHONINSPECT environment
variable is given, but break into the interactive interpreter just like
on other exceptions or normal program exit.
(backport)
........
r54189 | georg.brandl | 2007-03-06 16:40:28 -0800 (Tue, 06 Mar 2007) | 4 lines
Patch #703779: unset __file__ in __main__ after running a file. This
makes the filenames the warning module prints much more sensible when
a PYTHONSTARTUP file is used.
........
r54192 | george.yoshida | 2007-03-06 20:21:18 -0800 (Tue, 06 Mar 2007) | 2 lines
add versionadded info
........
r54195 | georg.brandl | 2007-03-06 23:39:06 -0800 (Tue, 06 Mar 2007) | 2 lines
Patch #812285: allow multiple auth schemes in AbstractBasicAuthHandler.
........
r54197 | georg.brandl | 2007-03-07 00:31:51 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
........
r54199 | georg.brandl | 2007-03-07 01:09:40 -0800 (Wed, 07 Mar 2007) | 3 lines
Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
........
r54201 | georg.brandl | 2007-03-07 01:21:06 -0800 (Wed, 07 Mar 2007) | 3 lines
Patch #787789: allow to pass custom TestRunner instances to unittest's
main() function.
........
r54202 | georg.brandl | 2007-03-07 01:34:45 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1669331: clarify shutil.copyfileobj() behavior wrt. file position.
........
r54204 | martin.v.loewis | 2007-03-07 03:04:33 -0800 (Wed, 07 Mar 2007) | 2 lines
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
........
r54206 | georg.brandl | 2007-03-07 03:37:42 -0800 (Wed, 07 Mar 2007) | 2 lines
Patch #1675471: convert test_pty to unittest.
........
r54207 | georg.brandl | 2007-03-07 03:54:49 -0800 (Wed, 07 Mar 2007) | 4 lines
Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
........
r54209 | guido.van.rossum | 2007-03-07 07:16:29 -0800 (Wed, 07 Mar 2007) | 3 lines
Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
........
r54219 | martin.v.loewis | 2007-03-08 05:42:43 -0800 (Thu, 08 Mar 2007) | 2 lines
Add missing ) in parenthical remark.
........
r54220 | georg.brandl | 2007-03-08 09:49:06 -0800 (Thu, 08 Mar 2007) | 2 lines
Fix #1676656: \em is different from \emph...
........
r54222 | georg.brandl | 2007-03-08 10:37:31 -0800 (Thu, 08 Mar 2007) | 2 lines
Add a NEWS entry for rev. 54207,8.
........
r54225 | raymond.hettinger | 2007-03-08 11:24:27 -0800 (Thu, 08 Mar 2007) | 1 line
SF 1676321: empty() returned wrong result
........
r54227 | collin.winter | 2007-03-08 11:58:14 -0800 (Thu, 08 Mar 2007) | 1 line
Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order.
........
r54230 | raymond.hettinger | 2007-03-08 13:33:47 -0800 (Thu, 08 Mar 2007) | 1 line
SF #1637850: make_table in difflib did not work with unicode
........
r54232 | collin.winter | 2007-03-08 14:16:25 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1668482: don't use '-' in mkstemp
........
r54233 | brett.cannon | 2007-03-08 15:58:11 -0800 (Thu, 08 Mar 2007) | 10 lines
Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available. Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.
This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches. It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
........
r54234 | collin.winter | 2007-03-08 19:15:56 -0800 (Thu, 08 Mar 2007) | 1 line
Patch #1481079: Support of HTTP_REFERER in CGIHTTPServer.py
........
r54235 | collin.winter | 2007-03-08 19:26:32 -0800 (Thu, 08 Mar 2007) | 1 line
Add NEWS item for patch #1481079 (r54234).
........
r54237 | neal.norwitz | 2007-03-08 21:59:01 -0800 (Thu, 08 Mar 2007) | 1 line
Fix SF #1676971, Complex OverflowError has a typo
........
r54239 | georg.brandl | 2007-03-09 04:58:41 -0800 (Fri, 09 Mar 2007) | 2 lines
Typo.
........
r54240 | martin.v.loewis | 2007-03-09 07:35:55 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #957003: Implement smtplib.LMTP.
........
r54243 | collin.winter | 2007-03-09 10:09:10 -0800 (Fri, 09 Mar 2007) | 2 lines
Bug #1629566: clarify the docs on the return values of parsedate() and parsedate_tz() in email.utils and rfc822.
........
r54244 | thomas.heller | 2007-03-09 11:21:28 -0800 (Fri, 09 Mar 2007) | 3 lines
Fix bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0)
returned string up to the first NUL character.
........
r54245 | martin.v.loewis | 2007-03-09 11:36:01 -0800 (Fri, 09 Mar 2007) | 2 lines
Add Ziga Seilnacht.
........
r54247 | collin.winter | 2007-03-09 12:33:07 -0800 (Fri, 09 Mar 2007) | 2 lines
Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError.
........
r54248 | thomas.heller | 2007-03-09 12:39:22 -0800 (Fri, 09 Mar 2007) | 7 lines
Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.
The crash was caused by a section of code that should have been
removed long ago, at that time ctypes had other ways to pass
parameters to function calls.
........
r54250 | collin.winter | 2007-03-09 15:30:39 -0800 (Fri, 09 Mar 2007) | 1 line
Hashing simplification pointed out by Thomas Wouters.
........
r54252 | collin.winter | 2007-03-09 18:23:40 -0800 (Fri, 09 Mar 2007) | 5 lines
* Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
........
r54253 | collin.winter | 2007-03-09 18:51:26 -0800 (Fri, 09 Mar 2007) | 3 lines
Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
........
r54254 | neal.norwitz | 2007-03-09 19:19:18 -0800 (Fri, 09 Mar 2007) | 4 lines
Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
........
r54256 | collin.winter | 2007-03-09 19:35:34 -0800 (Fri, 09 Mar 2007) | 1 line
Add proper attribution for a bug fix.
........
r54257 | georg.brandl | 2007-03-09 23:38:14 -0800 (Fri, 09 Mar 2007) | 2 lines
Typos.
........
r54260 | collin.winter | 2007-03-10 06:33:32 -0800 (Sat, 10 Mar 2007) | 1 line
Convert an assert to a raise so it works even in the presence of -O.
........
r54262 | collin.winter | 2007-03-10 06:41:48 -0800 (Sat, 10 Mar 2007) | 2 lines
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
........
r54268 | georg.brandl | 2007-03-11 00:28:46 -0800 (Sun, 11 Mar 2007) | 2 lines
Add missing "return" statements in exception handler.
........
r54270 | ziga.seilnacht | 2007-03-11 08:54:54 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1675981: remove unreachable code from type.__new__() method.
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
........
r54271 | collin.winter | 2007-03-11 09:00:20 -0700 (Sun, 11 Mar 2007) | 3 lines
Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap the IndexError caused by passing in an invalid breakpoint number.
Will backport.
........
r54274 | vinay.sajip | 2007-03-11 11:32:07 -0700 (Sun, 11 Mar 2007) | 1 line
Fix resource leak reported in SF #1516995.
........
r54278 | collin.winter | 2007-03-11 18:55:54 -0700 (Sun, 11 Mar 2007) | 4 lines
Patch #1678662: ftp.python.org does not exist. So the testcode in urllib.py must use a more
stable FTP.
Will backport.
........
r54280 | barry.warsaw | 2007-03-11 20:20:01 -0700 (Sun, 11 Mar 2007) | 8 lines
Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in the
display name of an email address, e.g.
Foo
\tBar <foo@example.com>
Test case added by Barry.
........
r54282 | skip.montanaro | 2007-03-11 20:30:50 -0700 (Sun, 11 Mar 2007) | 4 lines
Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect. Document that for future confused folks.
........
r54283 | martin.v.loewis | 2007-03-12 03:50:39 -0700 (Mon, 12 Mar 2007) | 2 lines
Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86.
........
r54285 | martin.v.loewis | 2007-03-12 04:01:10 -0700 (Mon, 12 Mar 2007) | 2 lines
Patch #1677862: Require a space or tab after import in .pth files.
........
r54287 | georg.brandl | 2007-03-12 06:17:36 -0700 (Mon, 12 Mar 2007) | 8 lines
Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.
Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
........
r54288 | georg.brandl | 2007-03-12 07:30:05 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #1678647: write a newline after printing an exception in any
case, even when converting the value to a string failed.
........
r54290 | collin.winter | 2007-03-12 08:57:19 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1678088: convert test_operations to use unittest, fold the result into test_dict.
........
r54291 | collin.winter | 2007-03-12 09:11:39 -0700 (Mon, 12 Mar 2007) | 3 lines
Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
........
r54292 | georg.brandl | 2007-03-12 09:15:09 -0700 (Mon, 12 Mar 2007) | 2 lines
Typo fix.
........
r54295 | collin.winter | 2007-03-12 10:24:07 -0700 (Mon, 12 Mar 2007) | 1 line
Patch #1670993: Refactor test_threadedtempfile.py to use unittest.
........
r54296 | tim.peters | 2007-03-12 11:07:52 -0700 (Mon, 12 Mar 2007) | 2 lines
Whitespace normalization.
........
r54297 | tim.peters | 2007-03-12 11:09:22 -0700 (Mon, 12 Mar 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54315 | brett.cannon | 2007-03-12 19:34:09 -0700 (Mon, 12 Mar 2007) | 8 lines
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.
Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
........
r54316 | brett.cannon | 2007-03-12 20:05:40 -0700 (Mon, 12 Mar 2007) | 2 lines
Fix a typo where the variable name was not updated.
........
r54318 | neal.norwitz | 2007-03-12 21:59:58 -0700 (Mon, 12 Mar 2007) | 1 line
Add Jerry Seutter for a bunch of his recent patches refactoring tests
........
r54319 | neal.norwitz | 2007-03-12 22:07:14 -0700 (Mon, 12 Mar 2007) | 7 lines
Add some other acks for recent checkins:
Brian Leair - 922167
Tomer Filiba - 1591665
Jeremy Jones - 1192590
........
r54321 | neal.norwitz | 2007-03-12 22:31:38 -0700 (Mon, 12 Mar 2007) | 9 lines
Fix some style nits:
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
........
r54322 | georg.brandl | 2007-03-13 00:23:16 -0700 (Tue, 13 Mar 2007) | 2 lines
Typo and grammar fixes.
........
r54323 | georg.brandl | 2007-03-13 00:50:57 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1679379: add documentation for fnmatch.translate().
........
r54325 | georg.brandl | 2007-03-13 00:57:51 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1642844: comments to clarify the complexobject constructor.
........
r54326 | georg.brandl | 2007-03-13 01:14:27 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1668100: urllib2 now correctly raises URLError instead of
OSError if accessing a local file via the file:// protocol fails.
........
r54327 | georg.brandl | 2007-03-13 02:32:11 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1635454: the csv.DictWriter class now includes the offending
field names in its exception message if you try to write a record with
a dictionary containing fields not in the CSV field names list.
........
r54328 | georg.brandl | 2007-03-13 02:41:31 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1555098: use str.join() instead of repeated string
concatenation in robotparser.
........
r54329 | georg.brandl | 2007-03-13 03:06:48 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to
pydoc's help keywords.
........
r54331 | georg.brandl | 2007-03-13 03:19:22 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1569798: fix a bug in distutils when building Python from a
directory within sys.exec_prefix.
........
r54333 | martin.v.loewis | 2007-03-13 03:24:00 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1449244: Support Unicode strings in
email.message.Message.{set_charset,get_content_charset}.
Will backport.
........
r54335 | lars.gustaebel | 2007-03-13 03:47:19 -0700 (Tue, 13 Mar 2007) | 34 lines
This is the implementation of POSIX.1-2001 (pax) format read/write
support.
The TarInfo class now contains all necessary logic to process and
create tar header data which has been moved there from the TarFile
class. The fromtarfile() method was added. The new path and linkpath
properties are aliases for the name and linkname attributes in
correspondence to the pax naming scheme.
The TarFile constructor and classmethods now accept a number of
keyword arguments which could only be set as attributes before (e.g.
dereference, ignore_zeros). The encoding and pax_headers arguments
were added for pax support. There is a new tarinfo keyword argument
that allows using subclassed TarInfo objects in TarFile.
The boolean TarFile.posix attribute is deprecated, because now three
tar formats are supported. Instead, the desired format for writing is
specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT
as the format keyword argument. This change affects TarInfo.tobuf()
as well.
The test suite has been heavily reorganized and partially rewritten.
A new testtar.tar was added that contains sample data in many formats
from 4 different tar programs.
Some bugs and quirks that also have been fixed:
Directory names do no longer have a trailing slash in TarInfo.name or
TarFile.getnames().
Adding the same file twice does not create a hardlink file member.
The TarFile constructor does no longer need a name argument.
The TarFile._mode attribute was renamed to mode and contains either
'r', 'w' or 'a'.
........
r54336 | georg.brandl | 2007-03-13 05:34:25 -0700 (Tue, 13 Mar 2007) | 3 lines
Bug #1622896: fix a rare corner case where the bz2 module raised an
error in spite of a succesful compression.
........
r54338 | lars.gustaebel | 2007-03-13 08:47:07 -0700 (Tue, 13 Mar 2007) | 3 lines
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
........
r54339 | georg.brandl | 2007-03-13 10:43:32 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1603688: ConfigParser.SafeConfigParser now checks values that
are set for invalid interpolation sequences that would lead to errors
on reading back those values.
........
r54341 | georg.brandl | 2007-03-13 11:15:41 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1581073: add a flag to textwrap that prevents the dropping of
whitespace while wrapping.
........
r54343 | georg.brandl | 2007-03-13 11:24:40 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1605192: list allowed states in error messages for imaplib.
........
r54344 | georg.brandl | 2007-03-13 11:31:49 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter
which can be set to False to prevent the default delete-on-close
behavior.
........
r54345 | collin.winter | 2007-03-13 11:53:04 -0700 (Tue, 13 Mar 2007) | 9 lines
Add acks for recent patch checkins:
Arvin Schnell - 1668482
S?\195?\169bastien Martini - 1481079
Heiko Wundram - 1491866
Damon Kohler - 1545011
Peter Parente - 1599845
Bjorn Lindqvist - 1678662
........
r54346 | georg.brandl | 2007-03-13 12:00:36 -0700 (Tue, 13 Mar 2007) | 2 lines
Acks for recent patches.
........
r54347 | georg.brandl | 2007-03-13 12:18:18 -0700 (Tue, 13 Mar 2007) | 3 lines
Fix a tab.
........
r54348 | georg.brandl | 2007-03-13 12:32:21 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
........
r54352 | georg.brandl | 2007-03-13 13:02:57 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1530482: add pydoc.render_doc() which returns the documentation
for a thing instead of paging it to stdout, which pydoc.doc() does.
........
r54357 | thomas.heller | 2007-03-13 13:42:52 -0700 (Tue, 13 Mar 2007) | 1 line
Patch #1649190: Adding support for _Bool to ctypes as c_bool, by David Remahl.
........
r54358 | georg.brandl | 2007-03-13 13:46:32 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
........
r54359 | thomas.heller | 2007-03-13 14:01:39 -0700 (Tue, 13 Mar 2007) | 1 line
Add versionadded marker for ctypes.c_bool.
........
r54360 | georg.brandl | 2007-03-13 14:08:15 -0700 (Tue, 13 Mar 2007) | 3 lines
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
........
r54361 | georg.brandl | 2007-03-13 14:32:01 -0700 (Tue, 13 Mar 2007) | 3 lines
Deprecate commands.getstatus().
........
r54362 | georg.brandl | 2007-03-13 14:32:56 -0700 (Tue, 13 Mar 2007) | 2 lines
NEWS entry for getstatus() deprecation.
........
r54363 | georg.brandl | 2007-03-13 14:58:44 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #1429539: pdb now correctly initializes the __main__ module for
the debugged script, which means that imports from __main__ work
correctly now.
........
r54364 | georg.brandl | 2007-03-13 15:07:36 -0700 (Tue, 13 Mar 2007) | 4 lines
Patch #957650: "%var%" environment variable references are now properly
expanded in ntpath.expandvars(), also "~user" home directory references
are recognized and handled on Windows.
........
r54365 | georg.brandl | 2007-03-13 15:16:30 -0700 (Tue, 13 Mar 2007) | 2 lines
Patch #1194449: correctly detect unbound methods in pydoc.
........
r54367 | georg.brandl | 2007-03-13 15:49:43 -0700 (Tue, 13 Mar 2007) | 5 lines
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if
they occur on a single line, as opposed to the previous behavior of
quoting dots if they are the second character of any line.
........
r54368 | collin.winter | 2007-03-13 16:02:15 -0700 (Tue, 13 Mar 2007) | 1 line
Inline PyImport_GetModulesReloading().
........
r54371 | barry.warsaw | 2007-03-13 21:59:50 -0700 (Tue, 13 Mar 2007) | 6 lines
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
........
r54372 | gregory.p.smith | 2007-03-14 00:17:40 -0700 (Wed, 14 Mar 2007) | 2 lines
correct order and names of the less often used keyword parameters.
........
r54373 | gregory.p.smith | 2007-03-14 00:19:50 -0700 (Wed, 14 Mar 2007) | 5 lines
Its time to stop listing (Unix, Windows) when we really mean "everything but Mac OS 9"
now that nobody is likely to use Python on Mac OS 9 and most of the (Mac) platform
items are all OS X special API specific since OS X is unixy enough for these modules
to be available out of the box.
........
r54376 | georg.brandl | 2007-03-14 01:27:52 -0700 (Wed, 14 Mar 2007) | 4 lines
Bug #767111: fix long-standing bug in urllib which caused an
AttributeError instead of an IOError when the server's response didn't
contain a valid HTTP status line.
........
r54378 | ziga.seilnacht | 2007-03-14 05:24:09 -0700 (Wed, 14 Mar 2007) | 4 lines
Patch #1680015: Don't modify __slots__ tuple if it contains an unicode
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
........
r54386 | martin.v.loewis | 2007-03-14 13:02:31 -0700 (Wed, 14 Mar 2007) | 3 lines
Patch #1559413: Fix test_cmd_line if sys.executable contains a space.
Will backport.
........
r54389 | brett.cannon | 2007-03-14 14:40:13 -0700 (Wed, 14 Mar 2007) | 3 lines
Note how test_socket_ssl has various exceptions that deal with a flaky Net
connection are silenced.
........
r54390 | brett.cannon | 2007-03-14 14:44:15 -0700 (Wed, 14 Mar 2007) | 2 lines
Raise ResourceDenied in test_urllib2net when the Net connection goes bad.
........
r54391 | neal.norwitz | 2007-03-14 21:41:20 -0700 (Wed, 14 Mar 2007) | 1 line
Wrap a long line and fix a typo (is -> if)
........
r54392 | georg.brandl | 2007-03-15 00:38:14 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1680978: consistently use "alive" instead of "active" in the
thread lib doc.
........
r54394 | georg.brandl | 2007-03-15 00:41:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1681153: the wave module now closes a file object it opened if
initialization failed.
........
r54397 | ziga.seilnacht | 2007-03-15 04:44:55 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1462488: prevent a segfault in object_reduce_ex() by splitting
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
........
r54404 | collin.winter | 2007-03-15 21:11:30 -0700 (Thu, 15 Mar 2007) | 3 lines
Patch #1642547: Fix an error/crash when encountering syntax errors in complex if statements.
Will backport.
........
r54406 | georg.brandl | 2007-03-16 00:55:09 -0700 (Fri, 16 Mar 2007) | 5 lines
Bug #1681228: the webbrowser module now correctly uses the default
GNOME or KDE browser, depending on whether there is a session of one
of those present. Also, it tries the Windows default browser before
trying Mozilla variants.
(backport)
........
r54407 | georg.brandl | 2007-03-16 01:22:40 -0700 (Fri, 16 Mar 2007) | 4 lines
Patch #1273829: os.walk() now has a "followlinks" parameter. If set to
True (which is not the default), it visits symlinks pointing to
directories.
........
r54408 | georg.brandl | 2007-03-16 01:24:21 -0700 (Fri, 16 Mar 2007) | 2 lines
Add \versionadded tag.
........
r54409 | georg.brandl | 2007-03-16 01:33:47 -0700 (Fri, 16 Mar 2007) | 2 lines
RFE #1670167: fix in isinstance() docs.
........
r54412 | ziga.seilnacht | 2007-03-16 04:59:38 -0700 (Fri, 16 Mar 2007) | 3 lines
Patch #1623563: allow __class__ assignment for classes with __slots__.
The old and the new class are still required to have the same slot
names, but the order in which they are specified is not relevant.
........
r54413 | ziga.seilnacht | 2007-03-16 05:11:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Whitespace cleanup. Also remove the empty lines
from the previous check in.
........
r54414 | jeremy.hylton | 2007-03-16 07:49:11 -0700 (Fri, 16 Mar 2007) | 2 lines
Remove warning: funcion declaration isn't a prototype
........
r54415 | jeremy.hylton | 2007-03-16 08:59:47 -0700 (Fri, 16 Mar 2007) | 11 lines
Clean up formatting of this file.
The file should now follow PEP 7, except that it uses 4 space indents
(in the style of Py3k). This particular code would be really hard to
read with the regular tab idents.
Other changes:
- reflow long lines
- change multi-line conditionals to have test at end of line
........
r54417 | collin.winter | 2007-03-16 14:13:35 -0700 (Fri, 16 Mar 2007) | 1 line
Patch #1676994: Refactor test_popen2 to use unittest.
........
r54418 | collin.winter | 2007-03-16 14:15:35 -0700 (Fri, 16 Mar 2007) | 1 line
Remove test/output/test_popen2 (missed in r54417).
........
r54419 | collin.winter | 2007-03-16 15:16:08 -0700 (Fri, 16 Mar 2007) | 1 line
Patch 1339796: add a relpath() function to os.path.
........
r54421 | georg.brandl | 2007-03-17 09:08:45 -0700 (Sat, 17 Mar 2007) | 5 lines
Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
to complex using its __complex__() method before falling back to the
__float__() method. Therefore, the functions in the cmath module now
can operate on objects that define a __complex__() method.
(backport)
........
r54423 | gregory.p.smith | 2007-03-17 15:33:35 -0700 (Sat, 17 Mar 2007) | 2 lines
move note to the correct section
........
r54426 | georg.brandl | 2007-03-18 01:25:00 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1682878: the new socket methods are recv_into and recvfrom_into, not *_buf.
........
r54432 | georg.brandl | 2007-03-18 11:28:25 -0700 (Sun, 18 Mar 2007) | 2 lines
Patch #1678339: test case for bug in difflib.
........
r54439 | collin.winter | 2007-03-19 11:52:08 -0700 (Mon, 19 Mar 2007) | 1 line
Patch #1630118: add a SpooledTemporaryFile class to tempfile.
........
r54441 | georg.brandl | 2007-03-19 12:02:48 -0700 (Mon, 19 Mar 2007) | 2 lines
Patch #1683328: fixes and enhancements for "unparse" demo.
........
r54456 | neal.norwitz | 2007-03-19 22:07:28 -0700 (Mon, 19 Mar 2007) | 1 line
Add some doc that was left out from some change to platform.py
........
r54457 | neal.norwitz | 2007-03-19 22:08:23 -0700 (Mon, 19 Mar 2007) | 1 line
Add a comment about 3k migration
........
r54458 | neal.norwitz | 2007-03-19 22:21:21 -0700 (Mon, 19 Mar 2007) | 1 line
Get rid of deprecation warning when testing commands.getstatus()
........
r54459 | neal.norwitz | 2007-03-19 22:23:09 -0700 (Mon, 19 Mar 2007) | 4 lines
Try backing out 54407 to see if it corrects the problems on the Windows
buildbots. This rev was backported, so we will need to keep both branches
in sync, pending the outcome of the test after this checkin.
........
r54460 | neal.norwitz | 2007-03-19 23:13:25 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54461 | neal.norwitz | 2007-03-19 23:16:26 -0700 (Mon, 19 Mar 2007) | 1 line
Try to make this test more resistant to dropping from previous runs (ie, files that may exist but cause the test to fail). Should be backported (assuming it works :-)
........
r54462 | neal.norwitz | 2007-03-19 23:53:17 -0700 (Mon, 19 Mar 2007) | 5 lines
Try to be a little more resilient to errors. This might help the test
pass, but my guess is that it won't. I'm guessing that some other
test is leaving this file open which means it can't be removed
under Windows AFAIK.
........
r54463 | neal.norwitz | 2007-03-20 01:14:57 -0700 (Tue, 20 Mar 2007) | 8 lines
Try to get test_urllib to pass on Windows by closing the file.
I'm guessing that's the problem. h.getfile() must be called *after*
h.getreply() and the fp can be None.
I'm not entirely convinced this is the best fix (or even correct).
The buildbots will tell us if things improve or not. I don't
know if this needs to be backported (assuming it actually works).
........
r54465 | raymond.hettinger | 2007-03-20 14:27:24 -0700 (Tue, 20 Mar 2007) | 1 line
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.
........
r54468 | georg.brandl | 2007-03-20 16:05:14 -0700 (Tue, 20 Mar 2007) | 2 lines
Fix for glob.py if filesystem encoding is None.
........
r54479 | neal.norwitz | 2007-03-20 23:39:48 -0700 (Tue, 20 Mar 2007) | 1 line
Remove unused file spotted by Paul Hankin
........
r54480 | georg.brandl | 2007-03-21 02:00:39 -0700 (Wed, 21 Mar 2007) | 3 lines
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".
........
r54482 | georg.brandl | 2007-03-21 02:10:29 -0700 (Wed, 21 Mar 2007) | 2 lines
New test for rev. 54407 which only uses directories under TESTFN.
........
r54483 | georg.brandl | 2007-03-21 02:16:53 -0700 (Wed, 21 Mar 2007) | 2 lines
Patch #1684834: document some utility C API functions.
........
r54485 | georg.brandl | 2007-03-21 04:51:25 -0700 (Wed, 21 Mar 2007) | 2 lines
Fix #1684254: split BROWSER contents with shlex to avoid displaying 'URL'.
........
r54487 | andrew.kuchling | 2007-03-21 07:32:43 -0700 (Wed, 21 Mar 2007) | 1 line
Add comments on maintenance of this file
........
r54489 | andrew.kuchling | 2007-03-21 09:57:32 -0700 (Wed, 21 Mar 2007) | 1 line
Fix sentence, and fix typo in example
........
r54490 | andrew.kuchling | 2007-03-21 09:59:20 -0700 (Wed, 21 Mar 2007) | 1 line
Put code examples at left margin instead of indenting them
........
r54491 | facundo.batista | 2007-03-21 12:41:24 -0700 (Wed, 21 Mar 2007) | 1 line
Minor clarification, saying that blocking means no timeout (from bug #882297)
........
r54492 | ziga.seilnacht | 2007-03-21 13:07:56 -0700 (Wed, 21 Mar 2007) | 2 lines
Bug #1675967: re patterns pickled with older Python versions can
now be unpickled. Will backport.
........
r54495 | raymond.hettinger | 2007-03-21 13:33:57 -0700 (Wed, 21 Mar 2007) | 1 line
Add test and fix for fromkeys() optional argument.
........
r54524 | georg.brandl | 2007-03-22 01:05:45 -0700 (Thu, 22 Mar 2007) | 2 lines
Bug #1685704: use -m switch in timeit docs.
........
r54533 | thomas.heller | 2007-03-22 12:44:31 -0700 (Thu, 22 Mar 2007) | 5 lines
Back out "Patch #1643874: memory leak in ctypes fixed."
The code in this patch leaves no way to give up the ownership of a
BSTR instance.
........
r54538 | thomas.heller | 2007-03-22 13:34:37 -0700 (Thu, 22 Mar 2007) | 2 lines
Explain the purpose of the b_needsfree flag (forward ported from release25-maint).
........
r54539 | guido.van.rossum | 2007-03-22 21:58:42 -0700 (Thu, 22 Mar 2007) | 12 lines
- Bug #1683368: The object.__init__() and object.__new__() methods are
now stricter in rejecting excess arguments. The only time when
either allows excess arguments is when it is not overridden and the
other one is. For backwards compatibility, when both are
overridden, it is a deprecation warning (for now; maybe a Py3k
warning later).
When merging this into 3.0, the warnings should become errors.
Note: without the change to string.py, lots of spurious warnings happen.
What's going on there?
........
r54540 | neal.norwitz | 2007-03-22 22:17:23 -0700 (Thu, 22 Mar 2007) | 1 line
Add Mark Dickinson for SF # 1675423.
........
r54541 | martin.v.loewis | 2007-03-23 03:35:49 -0700 (Fri, 23 Mar 2007) | 3 lines
Patch #1686451: Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}.
Will backport.
........
r54543 | martin.v.loewis | 2007-03-23 06:27:15 -0700 (Fri, 23 Mar 2007) | 3 lines
Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
........
r54545 | guido.van.rossum | 2007-03-23 11:53:03 -0700 (Fri, 23 Mar 2007) | 8 lines
Add a type.__init__() method that enforces the same signature as
type.__new__(), and then calls object.__init__(cls), just to be anal.
This allows us to restore the code in string.py's _TemplateMetaclass
that called super(...).__init__(name, bases, dct), which I commented
out yesterday since it broke due to the stricter argument checking
added to object.__init__().
........
r54546 | facundo.batista | 2007-03-23 11:54:07 -0700 (Fri, 23 Mar 2007) | 4 lines
Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
........
r54547 | guido.van.rossum | 2007-03-23 12:39:01 -0700 (Fri, 23 Mar 2007) | 2 lines
Add note about type.__init__().
........
r54553 | thomas.heller | 2007-03-23 12:55:27 -0700 (Fri, 23 Mar 2007) | 5 lines
Prevent creation (followed by a segfault) of array types when the size
overflows the valid Py_ssize_t range. Check return values of
PyMem_Malloc.
Will backport to release25-maint.
........
r54555 | facundo.batista | 2007-03-23 13:23:08 -0700 (Fri, 23 Mar 2007) | 6 lines
Surrounded with try/finally to socket's default timeout setting
changes in the tests, so failing one test won't produce strange
results in others. Also relaxed the timeout settings in the test
(where actually the value didn't mean anything).
........
r54556 | collin.winter | 2007-03-23 15:24:39 -0700 (Fri, 23 Mar 2007) | 1 line
Make test_relpath() pass on Windows.
........
r54559 | ziga.seilnacht | 2007-03-24 07:24:26 -0700 (Sat, 24 Mar 2007) | 6 lines
Patch #1489771: update syntax rules in Python Reference Manual.
Python 2.5 added support for explicit relative import statements and
yield expressions, which were missing in the manual.
Also fix grammar productions that used the names from the Grammar file,
markup that broke the generated grammar.txt, and wrap some lines that
broke the pdf output. Will backport.
........
r54565 | georg.brandl | 2007-03-24 15:20:34 -0700 (Sat, 24 Mar 2007) | 2 lines
Remove typo accent.
........
r54566 | georg.brandl | 2007-03-24 15:27:56 -0700 (Sat, 24 Mar 2007) | 2 lines
Revert accidental change.
........
r54567 | brett.cannon | 2007-03-24 18:32:36 -0700 (Sat, 24 Mar 2007) | 3 lines
Change the docs to no longer claim that unittest is preferred over doctest for
regression tests.
........
r54568 | facundo.batista | 2007-03-24 18:53:21 -0700 (Sat, 24 Mar 2007) | 4 lines
Redone the tests, using the infrastructure already present
for threading and socket serving.
........
r54570 | facundo.batista | 2007-03-24 20:20:05 -0700 (Sat, 24 Mar 2007) | 3 lines
Closing the HTTP connection after each test, and listening more.
........
r54572 | georg.brandl | 2007-03-25 11:44:35 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54573 | georg.brandl | 2007-03-25 12:04:55 -0700 (Sun, 25 Mar 2007) | 2 lines
Markup fix.
........
r54580 | facundo.batista | 2007-03-26 13:18:31 -0700 (Mon, 26 Mar 2007) | 5 lines
Added an optional timeout to FTP class. Also I started a test_ftplib.py
file to test the ftp lib (right now I included a basic test, the timeout
one, and nothing else).
........
r54581 | georg.brandl | 2007-03-26 13:28:28 -0700 (Mon, 26 Mar 2007) | 2 lines
Some nits.
........
r54582 | facundo.batista | 2007-03-26 13:56:09 -0700 (Mon, 26 Mar 2007) | 4 lines
Forgot to add the file before the previous commit, here go
the ftplib tests.
........
r54585 | facundo.batista | 2007-03-27 11:23:21 -0700 (Tue, 27 Mar 2007) | 5 lines
Added an optional timeout to poplib.POP3. Also created a
test_poplib.py file with a basic test and the timeout
ones. Docs are also updated.
........
r54586 | facundo.batista | 2007-03-27 11:50:29 -0700 (Tue, 27 Mar 2007) | 3 lines
The basic test cases of poplib.py.
........
r54594 | facundo.batista | 2007-03-27 20:45:20 -0700 (Tue, 27 Mar 2007) | 4 lines
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
........
r54599 | facundo.batista | 2007-03-28 11:25:54 -0700 (Wed, 28 Mar 2007) | 5 lines
Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
........
r54603 | collin.winter | 2007-03-28 16:34:06 -0700 (Wed, 28 Mar 2007) | 3 lines
Consolidate patches #1690164, 1683397, and 1690169, all of which refactor XML-related test suites. The patches are applied together because they use a common output/xmltests file.
Thanks to Jerry Seutter for all three patches.
........
r54604 | collin.winter | 2007-03-28 19:28:16 -0700 (Wed, 28 Mar 2007) | 1 line
Make test_zipfile clean up its temporary files properly.
........
r54605 | georg.brandl | 2007-03-29 00:41:32 -0700 (Thu, 29 Mar 2007) | 2 lines
These are actually methods.
........
r54606 | georg.brandl | 2007-03-29 05:42:07 -0700 (Thu, 29 Mar 2007) | 4 lines
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC
as for the POSIX implementation (thanks to #pypy).
........
r54608 | facundo.batista | 2007-03-29 11:22:35 -0700 (Thu, 29 Mar 2007) | 5 lines
Added timout parameter to telnetlib.Telnet. Also created
test_telnetlib.py with a basic test and timeout ones.
Docs are also updated.
........
r54613 | facundo.batista | 2007-03-30 06:00:35 -0700 (Fri, 30 Mar 2007) | 4 lines
Added the posibility to pass the timeout to FTP.connect, not only when
instantiating the class. Docs and tests are updated.
........
r54614 | collin.winter | 2007-03-30 07:01:25 -0700 (Fri, 30 Mar 2007) | 1 line
Bug #1688274: add documentation for C-level class objects.
........
r54615 | marc-andre.lemburg | 2007-03-30 08:01:42 -0700 (Fri, 30 Mar 2007) | 4 lines
Bump the patch level version of distutils since there were a few bug fixes since
the 2.5.0 release.
........
r54617 | georg.brandl | 2007-03-30 08:49:05 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54618 | georg.brandl | 2007-03-30 10:39:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Label name fix.
........
r54619 | georg.brandl | 2007-03-30 10:47:21 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54620 | georg.brandl | 2007-03-30 10:48:39 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54623 | andrew.kuchling | 2007-03-30 11:00:15 -0700 (Fri, 30 Mar 2007) | 1 line
Add item. (Oops, accidentally checked this in on my branch)
........
r54624 | georg.brandl | 2007-03-30 12:01:38 -0700 (Fri, 30 Mar 2007) | 2 lines
Duplicate label fix.
........
r54625 | georg.brandl | 2007-03-30 12:14:02 -0700 (Fri, 30 Mar 2007) | 2 lines
Markup fix.
........
r54629 | georg.brandl | 2007-03-31 03:17:31 -0700 (Sat, 31 Mar 2007) | 2 lines
repair string literal.
........
r54630 | georg.brandl | 2007-03-31 04:54:58 -0700 (Sat, 31 Mar 2007) | 2 lines
Markup fix.
........
r54631 | georg.brandl | 2007-03-31 04:58:36 -0700 (Sat, 31 Mar 2007) | 2 lines
Duplicate label fix.
........
r54632 | georg.brandl | 2007-03-31 04:59:54 -0700 (Sat, 31 Mar 2007) | 2 lines
Typo fix.
........
r54633 | neal.norwitz | 2007-03-31 11:54:18 -0700 (Sat, 31 Mar 2007) | 1 line
Fix method names. Will backport.
........
r54634 | georg.brandl | 2007-03-31 11:56:11 -0700 (Sat, 31 Mar 2007) | 4 lines
Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS
returned by python-config if Python was built with --enable-shared
because that prevented the shared library from being used.
........
r54637 | collin.winter | 2007-03-31 12:31:34 -0700 (Sat, 31 Mar 2007) | 1 line
Shut up an occaisonal buildbot error due to test files being left around.
........
r54644 | neal.norwitz | 2007-04-01 11:24:22 -0700 (Sun, 01 Apr 2007) | 11 lines
SF #1685563, MSVCCompiler creates redundant and long PATH strings
If MSVCCompiler.initialize() was called multiple times, the path
would get duplicated. On Windows, this is a problem because the
path is limited to 4k. There's no benefit in adding a path multiple
times, so prevent that from occuring. We also normalize the path
before checking for duplicates so things like /a and /a/ won't both
be stored.
Will backport.
........
r54646 | brett.cannon | 2007-04-01 11:47:27 -0700 (Sun, 01 Apr 2007) | 8 lines
time.strptime's caching of its locale object was being recreated when the
locale changed but not used during the function call it was recreated during.
The test in this checkin is untested (OS X does not have the proper locale
support for me to test), although the fix for the bug this deals with
was tested by the OP (#1290505). Once the buildbots verify the test at least
doesn't fail it becomes a backport candidate.
........
r54647 | brett.cannon | 2007-04-01 12:46:19 -0700 (Sun, 01 Apr 2007) | 3 lines
Fix the test for recreating the locale cache object by not worrying about if
one of the test locales cannot be set.
........
r54649 | georg.brandl | 2007-04-01 14:29:15 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix a lot of markup and meta-information glitches.
........
r54650 | georg.brandl | 2007-04-01 14:39:52 -0700 (Sun, 01 Apr 2007) | 2 lines
Another fix.
........
r54651 | georg.brandl | 2007-04-01 15:39:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Lots of explicit class names for method and member descs.
........
r54652 | georg.brandl | 2007-04-01 15:40:12 -0700 (Sun, 01 Apr 2007) | 2 lines
Explicit class names.
........
r54653 | georg.brandl | 2007-04-01 15:47:31 -0700 (Sun, 01 Apr 2007) | 2 lines
Some semantic fixes.
........
r54654 | georg.brandl | 2007-04-01 16:29:10 -0700 (Sun, 01 Apr 2007) | 2 lines
Remove bogus entry.
........
r54655 | georg.brandl | 2007-04-01 16:31:30 -0700 (Sun, 01 Apr 2007) | 2 lines
Fix the class name of strings.
........
r54658 | raymond.hettinger | 2007-04-02 10:29:30 -0700 (Mon, 02 Apr 2007) | 1 line
SF #1693079: Cannot save empty array in shelve
........
r54663 | raymond.hettinger | 2007-04-02 15:54:21 -0700 (Mon, 02 Apr 2007) | 3 lines
Array module's buffer interface can now handle empty arrays.
........
r54664 | guido.van.rossum | 2007-04-02 16:55:37 -0700 (Mon, 02 Apr 2007) | 5 lines
Fix warnings about object.__init__() signature.
Two (test_array and test_descr) were bug IMO; the third (copy_reg)
is a work-around which recognizes that object.__init__() doesn't do
anything.
........
r54666 | raymond.hettinger | 2007-04-02 17:02:11 -0700 (Mon, 02 Apr 2007) | 1 line
SF 1602378 Clarify docstrings for bisect
........
r54668 | raymond.hettinger | 2007-04-02 18:39:43 -0700 (Mon, 02 Apr 2007) | 3 lines
SF #1382213: Tutorial section 9.5.1 ignores MRO for new-style classes
........
r54669 | matthias.klose | 2007-04-02 21:35:59 -0700 (Mon, 02 Apr 2007) | 4 lines
- Fix an off-by-one bug in locale.strxfrm().
patch taken from http://bugs.debian.org/416934.
........
r54671 | georg.brandl | 2007-04-03 00:04:27 -0700 (Tue, 03 Apr 2007) | 9 lines
Fix the strange case of
\begin{methoddesc}[NNTP]{...}
where
\ifx#1\@undefined ended up comparing N and N, therefore executing
the true part of the conditional, blowing up at \@undefined.
........
r54672 | facundo.batista | 2007-04-03 07:05:08 -0700 (Tue, 03 Apr 2007) | 4 lines
Now using unittest for the tests infraestructure. Also split the
tests in those who need the network, and that who doesn't.
........
r54673 | walter.doerwald | 2007-04-03 09:08:10 -0700 (Tue, 03 Apr 2007) | 4 lines
Move the functionality for catching warnings in test_warnings.py into a separate
class to that reusing the functionality in test_structmembers.py doesn't rerun
the tests from test_warnings.py.
........
r54674 | walter.doerwald | 2007-04-03 09:16:24 -0700 (Tue, 03 Apr 2007) | 2 lines
Document that CatchWarningTests is reused by test_structmembers.py.
........
r54675 | walter.doerwald | 2007-04-03 09:53:43 -0700 (Tue, 03 Apr 2007) | 4 lines
Add tests for the filename.
Test that the stacklevel is handled correctly.
........
r54676 | facundo.batista | 2007-04-03 10:29:48 -0700 (Tue, 03 Apr 2007) | 6 lines
Added a SSL server to test_socket_ssl.py to be able to test
locally. Now, it checks if have openssl available and run
those specific tests (it starts openssl at the beggining of
all the tests and then kills it at the end).
........
r54677 | walter.doerwald | 2007-04-03 11:33:29 -0700 (Tue, 03 Apr 2007) | 6 lines
Implement a contextmanager test.test_support.catch_warning that can
be used to catch the last warning issued by the warning framework.
Change test_warnings.py and test_structmembers.py to use this
new contextmanager.
........
r54678 | facundo.batista | 2007-04-03 14:15:34 -0700 (Tue, 03 Apr 2007) | 4 lines
Changed the whole structure of startup and checking if the
server is available. Hope to not get more false alarms.
........
r54681 | facundo.batista | 2007-04-04 07:10:40 -0700 (Wed, 04 Apr 2007) | 4 lines
Fixed the way that the .pem files are looked for, and changed
how to kill the process in win32 to use the _handle attribute.
........
r54682 | guido.van.rossum | 2007-04-04 10:43:02 -0700 (Wed, 04 Apr 2007) | 4 lines
Fix a race condition in this test -- instead of assuming that it will take
the test server thread at most 0.5 seconds to get ready, use an event
variable.
........
r54683 | collin.winter | 2007-04-04 11:14:17 -0700 (Wed, 04 Apr 2007) | 1 line
Clean up imports.
........
r54684 | collin.winter | 2007-04-04 11:16:24 -0700 (Wed, 04 Apr 2007) | 1 line
Stop using test_support.verify().
........
r54685 | martin.v.loewis | 2007-04-04 11:30:36 -0700 (Wed, 04 Apr 2007) | 2 lines
Bug #1686475: Support stat'ing open files on Windows again.
Will backport to 2.5.
........
r54687 | collin.winter | 2007-04-04 11:33:40 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_getopt use unittest.
........
r54688 | collin.winter | 2007-04-04 11:36:30 -0700 (Wed, 04 Apr 2007) | 1 line
Make test_softspace use unittest.
........
r54689 | ziga.seilnacht | 2007-04-04 11:38:47 -0700 (Wed, 04 Apr 2007) | 2 lines
Fix WalkTests.test_traversal() on Windows. The cleanup in
MakedirTests.setUp() can now be removed.
........
r54695 | raymond.hettinger | 2007-04-05 11:00:03 -0700 (Thu, 05 Apr 2007) | 3 lines
Bug #1563759: struct.unpack doens't support buffer protocol objects
........
r54697 | collin.winter | 2007-04-05 13:05:07 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_long_future to use unittest.
........
r54698 | collin.winter | 2007-04-05 13:08:56 -0700 (Thu, 05 Apr 2007) | 1 line
Convert test_normalization to use unittest.
........
r54699 | andrew.kuchling | 2007-04-05 18:11:58 -0700 (Thu, 05 Apr 2007) | 1 line
Some grammar fixes
........
r54704 | collin.winter | 2007-04-06 12:27:40 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_stringprep to use unittest.
........
r54705 | collin.winter | 2007-04-06 12:32:32 -0700 (Fri, 06 Apr 2007) | 1 line
Import cleanup in test_crypt.
........
r54706 | collin.winter | 2007-04-06 13:00:05 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_gc to use unittest.
........
r54707 | collin.winter | 2007-04-06 13:03:11 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_module to use unittest.
........
r54711 | collin.winter | 2007-04-06 21:40:43 -0700 (Fri, 06 Apr 2007) | 1 line
Convert test_fileinput to use unittest.
........
r54712 | brett.cannon | 2007-04-07 21:29:32 -0700 (Sat, 07 Apr 2007) | 5 lines
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
........
r54726 | vinay.sajip | 2007-04-09 09:16:10 -0700 (Mon, 09 Apr 2007) | 1 line
Added optional timeout to SocketHandler.makeSocket (SF #1695948)
........
r54727 | ziga.seilnacht | 2007-04-09 12:10:29 -0700 (Mon, 09 Apr 2007) | 3 lines
Patch #1695862: remove old test directory that causes test_urllib failures
on Windows buildbots. The change is a one time fix and will be removed
after a successful buildbot run.
........
r54729 | facundo.batista | 2007-04-09 20:00:37 -0700 (Mon, 09 Apr 2007) | 3 lines
Minor fix to the tests pass ok even with -O.
........
r54730 | collin.winter | 2007-04-09 21:44:49 -0700 (Mon, 09 Apr 2007) | 1 line
Typo fix.
........
r54732 | facundo.batista | 2007-04-10 05:58:45 -0700 (Tue, 10 Apr 2007) | 5 lines
General clean-up. Lot of margin corrections, comments, some typos.
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
........
r54741 | georg.brandl | 2007-04-10 14:39:38 -0700 (Tue, 10 Apr 2007) | 2 lines
Repair a duplicate label and some obsolete uses of \setindexsubitem.
........
r54746 | andrew.kuchling | 2007-04-11 06:39:00 -0700 (Wed, 11 Apr 2007) | 1 line
Add window.chgat() method, submitted via e-mail by Fabian Kreutz
........
r54747 | andrew.kuchling | 2007-04-11 06:42:25 -0700 (Wed, 11 Apr 2007) | 1 line
Point readers at the patch submission instructions
........
r54748 | andrew.kuchling | 2007-04-11 06:47:13 -0700 (Wed, 11 Apr 2007) | 1 line
Describe undocumented third argument to touchline()
........
r54757 | georg.brandl | 2007-04-11 10:16:24 -0700 (Wed, 11 Apr 2007) | 3 lines
Add some missing NULL checks which trigger crashes on low-memory conditions.
Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
........
r54760 | raymond.hettinger | 2007-04-11 11:40:58 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1191699: Make slices picklable
........
r54762 | georg.brandl | 2007-04-11 12:25:11 -0700 (Wed, 11 Apr 2007) | 2 lines
Exceptions are no longer old-style instances. Fix accordingly.
........
r54763 | georg.brandl | 2007-04-11 16:28:44 -0700 (Wed, 11 Apr 2007) | 2 lines
Repair missing spaces after \UNIX.
........
r54772 | raymond.hettinger | 2007-04-11 21:10:00 -0700 (Wed, 11 Apr 2007) | 1 line
SF 1193128: Let str.translate(None) be an identity transformation
........
r54784 | georg.brandl | 2007-04-12 00:01:19 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1698951: clarify deprecation message in rexec and Bastion
........
r54785 | ziga.seilnacht | 2007-04-12 01:46:51 -0700 (Thu, 12 Apr 2007) | 2 lines
Patch #1695862: remove the cleanup code, now that Windows buildbots are green
again.
........
r54786 | walter.doerwald | 2007-04-12 03:35:00 -0700 (Thu, 12 Apr 2007) | 3 lines
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
........
r54807 | barry.warsaw | 2007-04-13 11:47:14 -0700 (Fri, 13 Apr 2007) | 8 lines
Port r54805 from python25-maint branch:
Add code to read from master_fd in the parent, breaking when we get an OSError
(EIO can occur on Linux) or there's no more data to read. Without this,
test_pty.py can hang on the waitpid() because the child is blocking on the
stdout write. This will definitely happen on Mac OS X and could potentially
happen on other platforms. See the comment for details.
........
r54812 | kristjan.jonsson | 2007-04-13 15:07:33 -0700 (Fri, 13 Apr 2007) | 1 line
Fix a bug when using the __lltrace__ opcode tracer, and a problem sith signed chars in frameobject.c which can occur with opcodes > 127
........
r54814 | kristjan.jonsson | 2007-04-13 15:20:13 -0700 (Fri, 13 Apr 2007) | 1 line
Fix potential crash in path manipulation on windows
........
r54816 | trent.mick | 2007-04-13 16:22:05 -0700 (Fri, 13 Apr 2007) | 4 lines
Add the necessary dependency for the Windows VC6 build to ensure 'pythoncore'
is built before '_ctypes' is attempted.
Will backport to 2.5 once it is unfrozen for 2.5.1.
........
r54825 | neal.norwitz | 2007-04-13 22:25:50 -0700 (Fri, 13 Apr 2007) | 3 lines
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
........
r54841 | neal.norwitz | 2007-04-16 00:37:55 -0700 (Mon, 16 Apr 2007) | 1 line
SF #1701207, Fix bogus assertion (and test it!)
........
r54844 | collin.winter | 2007-04-16 15:10:32 -0700 (Mon, 16 Apr 2007) | 1 line
Check the availability of the urlfetch resource earlier than before.
........
r54849 | martin.v.loewis | 2007-04-16 22:02:01 -0700 (Mon, 16 Apr 2007) | 2 lines
Add Travis Oliphant.
........
r54873 | brett.cannon | 2007-04-18 20:44:17 -0700 (Wed, 18 Apr 2007) | 2 lines
Silence a compiler warning about incompatible pointer types.
........
r54874 | neal.norwitz | 2007-04-18 22:52:37 -0700 (Wed, 18 Apr 2007) | 2 lines
SF #1703270, add missing declaration in readline.c to avoid compiler warning.
........
r54875 | armin.rigo | 2007-04-19 07:44:48 -0700 (Thu, 19 Apr 2007) | 8 lines
Revert r53997 as per
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
........
r54876 | armin.rigo | 2007-04-19 07:56:48 -0700 (Thu, 19 Apr 2007) | 2 lines
Fix a usage of the dangerous pattern decref - modify field - incref.
........
r54884 | neal.norwitz | 2007-04-19 22:20:38 -0700 (Thu, 19 Apr 2007) | 9 lines
Add an optional address to copy the failure mails to.
Detect a conflict in the only file that should have outstanding changes
when this script is run. This doesn't matter on the trunk, but does
when run on a branch. Trunk always has the date set to today in
boilerplate.tex. Each time a release is cut with a different date,
a conflict occurs. (We could copy a known good version, but then
we would lose changes to this file.)
........
r54918 | georg.brandl | 2007-04-21 13:35:38 -0700 (Sat, 21 Apr 2007) | 3 lines
Bug #1704790: bind name "sys" locally in __del__ method so that it is
not cleared before __del__ is run.
........
r54920 | facundo.batista | 2007-04-21 18:18:56 -0700 (Sat, 21 Apr 2007) | 5 lines
Added tests for other methods of SSL object. Now we cover
all the object methods. This is the final step to close
the #451607 bug.
........
r54927 | facundo.batista | 2007-04-23 10:08:31 -0700 (Mon, 23 Apr 2007) | 5 lines
As specified in RFC 2616, 2xx code indicates that the client's
request was successfully received, understood, and accepted.
Now in these cases no error is raised. Also fixed tests.
........
r54929 | collin.winter | 2007-04-23 20:43:46 -0700 (Mon, 23 Apr 2007) | 1 line
Convert PyUnit -> unittest.
........
r54931 | collin.winter | 2007-04-23 21:09:52 -0700 (Mon, 23 Apr 2007) | 1 line
Remove code that hasn't been called in years.
........
r54932 | neal.norwitz | 2007-04-23 21:53:12 -0700 (Mon, 23 Apr 2007) | 1 line
Fix SF #1703110, Incorrect example for add_password() (use uri, not host)
........
r54934 | georg.brandl | 2007-04-24 03:36:42 -0700 (Tue, 24 Apr 2007) | 2 lines
Some new year updates.
........
r54938 | facundo.batista | 2007-04-24 06:54:38 -0700 (Tue, 24 Apr 2007) | 4 lines
Added a comment about last change in urllib2.py (all 2xx responses
are ok now).
........
r54939 | georg.brandl | 2007-04-24 08:10:09 -0700 (Tue, 24 Apr 2007) | 2 lines
Bug #1705717: error in sys.argv docs.
........
r54941 | georg.brandl | 2007-04-24 08:27:13 -0700 (Tue, 24 Apr 2007) | 4 lines
Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file
(as opposed to the command line) will now write file names ending in
".cpp" too.
........
r54944 | raymond.hettinger | 2007-04-24 15:13:43 -0700 (Tue, 24 Apr 2007) | 1 line
Fix markup
........
r54945 | kristjan.jonsson | 2007-04-24 17:10:50 -0700 (Tue, 24 Apr 2007) | 1 line
Merge change 54909 from release25-maint: Fix several minor issues discovered using code analysis in VisualStudio 2005 Team Edition
........
r54947 | kristjan.jonsson | 2007-04-24 17:17:39 -0700 (Tue, 24 Apr 2007) | 1 line
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
........
r54948 | kristjan.jonsson | 2007-04-24 17:19:26 -0700 (Tue, 24 Apr 2007) | 1 line
Remove obsolete comment. Importing of .dll files has been discontinued, only .pyd files supported on windows now.
........
r54949 | georg.brandl | 2007-04-24 23:24:59 -0700 (Tue, 24 Apr 2007) | 2 lines
Patch #1698768: updated the "using Python on the Mac" intro.
........
r54951 | georg.brandl | 2007-04-24 23:25:55 -0700 (Tue, 24 Apr 2007) | 2 lines
Markup fix.
........
r54953 | neal.norwitz | 2007-04-24 23:30:05 -0700 (Tue, 24 Apr 2007) | 3 lines
Whitespace normalization. Ugh, we really need to do this more often.
You might want to review this change as it's my first time. Be gentle. :-)
........
r54956 | collin.winter | 2007-04-25 10:29:52 -0700 (Wed, 25 Apr 2007) | 1 line
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
........
r54957 | collin.winter | 2007-04-25 10:37:35 -0700 (Wed, 25 Apr 2007) | 1 line
Remove functionality from test_datetime.test_main() that does reference count checking; 'regrtest.py -R' is the way to do this kind of testing.
........
r54958 | collin.winter | 2007-04-25 10:57:53 -0700 (Wed, 25 Apr 2007) | 1 line
Change test_support.have_unicode to use True/False instead of 1/0.
........
r54959 | tim.peters | 2007-04-25 11:47:18 -0700 (Wed, 25 Apr 2007) | 2 lines
Whitespace normalization.
........
r54960 | tim.peters | 2007-04-25 11:48:35 -0700 (Wed, 25 Apr 2007) | 2 lines
Set missing svn:eol-style property on text files.
........
r54961 | collin.winter | 2007-04-25 11:54:36 -0700 (Wed, 25 Apr 2007) | 1 line
Import and raise statement cleanup.
........
r54969 | collin.winter | 2007-04-25 13:41:34 -0700 (Wed, 25 Apr 2007) | 1 line
Convert test_ossaudiodev to use unittest.
........
r54974 | collin.winter | 2007-04-25 14:50:25 -0700 (Wed, 25 Apr 2007) | 1 line
Fix an issue related to the unittest conversion.
........
r54979 | fred.drake | 2007-04-25 21:42:19 -0700 (Wed, 25 Apr 2007) | 1 line
fix some markup errors
........
r54982 | kristjan.jonsson | 2007-04-26 02:15:08 -0700 (Thu, 26 Apr 2007) | 1 line
Export function sanitize_the_mode from fileobject.c as _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
........
r54983 | kristjan.jonsson | 2007-04-26 06:44:16 -0700 (Thu, 26 Apr 2007) | 1 line
The locale "En" appears not to be valid on windows underi VisualStudio.2005. Added "English" to the test_locale.py to make the testsuite pass for that build
........
r54984 | steve.holden | 2007-04-26 07:23:12 -0700 (Thu, 26 Apr 2007) | 1 line
Minor wording change on slicing aide-memoire.
........
r54985 | kristjan.jonsson | 2007-04-26 08:24:54 -0700 (Thu, 26 Apr 2007) | 1 line
Accomodate 64 bit time_t in the _bsddb module.
........
2007-04-27 19:54:29 +00:00
|
|
|
|
2001-09-25 16:25:58 +00:00
|
|
|
static PyObject *
|
2017-03-19 08:46:44 +02:00
|
|
|
object___reduce_ex___impl(PyObject *self, int protocol)
|
2017-04-08 09:52:59 +03:00
|
|
|
/*[clinic end generated code: output=2e157766f6b50094 input=f326b43fb8a4c5ff]*/
|
2001-09-25 16:25:58 +00:00
|
|
|
{
|
2024-10-11 03:56:01 -04:00
|
|
|
PyObject *reduce;
|
2023-07-12 08:57:10 +03:00
|
|
|
if (PyObject_GetOptionalAttr(self, &_Py_ID(__reduce__), &reduce) < 0) {
|
2019-02-25 17:59:46 +02:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (reduce != NULL) {
|
2011-03-11 21:30:43 +01:00
|
|
|
PyObject *cls, *clsreduce;
|
2010-05-09 15:52:27 +00:00
|
|
|
int override;
|
2011-03-11 21:30:43 +01:00
|
|
|
|
|
|
|
|
cls = (PyObject *) Py_TYPE(self);
|
2022-02-08 13:39:07 -07:00
|
|
|
clsreduce = PyObject_GetAttr(cls, &_Py_ID(__reduce__));
|
2010-05-09 15:52:27 +00:00
|
|
|
if (clsreduce == NULL) {
|
|
|
|
|
Py_DECREF(reduce);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2024-10-11 03:56:01 -04:00
|
|
|
|
|
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
|
|
|
|
override = (clsreduce != _Py_INTERP_CACHED_OBJECT(interp, objreduce));
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(clsreduce);
|
|
|
|
|
if (override) {
|
2024-10-11 03:56:01 -04:00
|
|
|
PyObject *res = _PyObject_CallNoArgs(reduce);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(reduce);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
Py_DECREF(reduce);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
return _common_reduce(self, protocol);
|
2001-09-25 16:25:58 +00:00
|
|
|
}
|
|
|
|
|
|
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61103 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61098 | jeffrey.yasskin | 2008-02-28 05:45:36 +0100 (Thu, 28 Feb 2008) | 7 lines
Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed
./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'
up from 2.5us to 0.201us. This fixes issue 1762.
........
r61099 | jeffrey.yasskin | 2008-02-28 06:53:18 +0100 (Thu, 28 Feb 2008) | 3 lines
Speed test_socketserver up from 28.739s to 0.226s, simplify the logic, and make
sure all tests run even if some fail.
........
r61100 | jeffrey.yasskin | 2008-02-28 07:09:19 +0100 (Thu, 28 Feb 2008) | 21 lines
Thread.start() used sleep(0.000001) to make sure it didn't return before the
new thread had started. At least on my MacBook Pro, that wound up sleeping for
a full 10ms (probably 1 jiffy). By using an Event instead, we can be absolutely
certain that the thread has started, and return more quickly (217us).
Before:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
100 loops, best of 3: 10.3 msec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.47 usec per loop
After:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
1000 loops, best of 3: 217 usec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.86 usec per loop
To be fair, the 10ms isn't CPU time, and other threads including the spawned
one get to run during it. There are also some slightly more complicated ways to
get back the .4us in isAlive() if we want.
........
r61101 | raymond.hettinger | 2008-02-28 10:23:48 +0100 (Thu, 28 Feb 2008) | 1 line
Add repeat keyword argument to itertools.product().
........
r61102 | christian.heimes | 2008-02-28 12:18:49 +0100 (Thu, 28 Feb 2008) | 1 line
The empty tuple is usually a singleton with a much higher refcnt than 1
........
2008-02-28 12:27:11 +00:00
|
|
|
static PyObject *
|
|
|
|
|
object_subclasshook(PyObject *cls, PyObject *args)
|
|
|
|
|
{
|
2011-08-10 20:28:54 -05:00
|
|
|
Py_RETURN_NOTIMPLEMENTED;
|
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61103 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61098 | jeffrey.yasskin | 2008-02-28 05:45:36 +0100 (Thu, 28 Feb 2008) | 7 lines
Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed
./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'
up from 2.5us to 0.201us. This fixes issue 1762.
........
r61099 | jeffrey.yasskin | 2008-02-28 06:53:18 +0100 (Thu, 28 Feb 2008) | 3 lines
Speed test_socketserver up from 28.739s to 0.226s, simplify the logic, and make
sure all tests run even if some fail.
........
r61100 | jeffrey.yasskin | 2008-02-28 07:09:19 +0100 (Thu, 28 Feb 2008) | 21 lines
Thread.start() used sleep(0.000001) to make sure it didn't return before the
new thread had started. At least on my MacBook Pro, that wound up sleeping for
a full 10ms (probably 1 jiffy). By using an Event instead, we can be absolutely
certain that the thread has started, and return more quickly (217us).
Before:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
100 loops, best of 3: 10.3 msec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.47 usec per loop
After:
$ ./python.exe -m timeit -s 'from threading import Thread' 't = Thread(); t.start(); t.join()'
1000 loops, best of 3: 217 usec per loop
$ ./python.exe -m timeit -s 'from threading import Thread; t = Thread()' 't.isAlive()'
1000000 loops, best of 3: 0.86 usec per loop
To be fair, the 10ms isn't CPU time, and other threads including the spawned
one get to run during it. There are also some slightly more complicated ways to
get back the .4us in isAlive() if we want.
........
r61101 | raymond.hettinger | 2008-02-28 10:23:48 +0100 (Thu, 28 Feb 2008) | 1 line
Add repeat keyword argument to itertools.product().
........
r61102 | christian.heimes | 2008-02-28 12:18:49 +0100 (Thu, 28 Feb 2008) | 1 line
The empty tuple is usually a singleton with a much higher refcnt than 1
........
2008-02-28 12:27:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyDoc_STRVAR(object_subclasshook_doc,
|
|
|
|
|
"Abstract classes can override this to customize issubclass().\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"This is invoked early on by abc.ABCMeta.__subclasscheck__().\n"
|
|
|
|
|
"It should return True, False or NotImplemented. If it returns\n"
|
|
|
|
|
"NotImplemented, the normal algorithm is used. Otherwise, it\n"
|
|
|
|
|
"overrides the normal algorithm (and the outcome is cached).\n");
|
2007-08-25 02:26:07 +00:00
|
|
|
|
2016-07-30 16:26:03 +10:00
|
|
|
static PyObject *
|
|
|
|
|
object_init_subclass(PyObject *cls, PyObject *arg)
|
|
|
|
|
{
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyDoc_STRVAR(object_init_subclass_doc,
|
2016-07-30 14:06:15 +03:00
|
|
|
"This method is called when a class is subclassed.\n"
|
2016-07-30 16:26:03 +10:00
|
|
|
"\n"
|
2016-07-30 14:06:15 +03:00
|
|
|
"The default implementation does nothing. It may be\n"
|
|
|
|
|
"overridden to extend subclasses.\n");
|
2016-07-30 16:26:03 +10:00
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
object.__format__
|
|
|
|
|
|
|
|
|
|
format_spec: unicode
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
Default object formatter.
|
2022-10-04 00:28:02 +02:00
|
|
|
|
|
|
|
|
Return str(self) if format_spec is empty. Raise TypeError otherwise.
|
2017-03-19 08:46:44 +02:00
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
2007-08-25 02:26:07 +00:00
|
|
|
static PyObject *
|
2017-03-19 08:46:44 +02:00
|
|
|
object___format___impl(PyObject *self, PyObject *format_spec)
|
2022-10-04 00:28:02 +02:00
|
|
|
/*[clinic end generated code: output=34897efb543a974b input=b94d8feb006689ea]*/
|
2007-08-25 02:26:07 +00:00
|
|
|
{
|
2016-10-30 19:33:54 +02:00
|
|
|
/* Issue 7994: If we're converting to a string, we
|
|
|
|
|
should reject format specifications */
|
|
|
|
|
if (PyUnicode_GET_LENGTH(format_spec) > 0) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"unsupported format string passed to %.200s.__format__",
|
2020-02-07 03:04:21 +01:00
|
|
|
Py_TYPE(self)->tp_name);
|
2016-10-30 19:33:54 +02:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2017-05-13 12:40:52 +03:00
|
|
|
return PyObject_Str(self);
|
2007-08-25 02:26:07 +00:00
|
|
|
}
|
|
|
|
|
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
object.__sizeof__
|
|
|
|
|
|
|
|
|
|
Size of object in memory, in bytes.
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
2008-06-04 14:18:43 +00:00
|
|
|
static PyObject *
|
2017-03-19 08:46:44 +02:00
|
|
|
object___sizeof___impl(PyObject *self)
|
|
|
|
|
/*[clinic end generated code: output=73edab332f97d550 input=1200ff3dfe485306]*/
|
2008-06-04 14:18:43 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_ssize_t res, isize;
|
2008-06-04 14:18:43 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
res = 0;
|
2020-02-07 03:04:21 +01:00
|
|
|
isize = Py_TYPE(self)->tp_itemsize;
|
2024-05-23 11:06:10 +01:00
|
|
|
if (isize > 0) {
|
|
|
|
|
/* This assumes that ob_size is valid if tp_itemsize is not 0,
|
|
|
|
|
which isn't true for PyLongObject. */
|
|
|
|
|
res = _PyVarObject_CAST(self)->ob_size * isize;
|
|
|
|
|
}
|
2020-02-07 03:04:21 +01:00
|
|
|
res += Py_TYPE(self)->tp_basicsize;
|
2008-06-04 14:18:43 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return PyLong_FromSsize_t(res);
|
2008-06-04 14:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-24 11:09:06 -05:00
|
|
|
/* __dir__ for generic objects: returns __dict__, __class__,
|
|
|
|
|
and recursively up the __class__.__bases__ chain.
|
|
|
|
|
*/
|
2017-03-19 08:46:44 +02:00
|
|
|
/*[clinic input]
|
|
|
|
|
object.__dir__
|
|
|
|
|
|
|
|
|
|
Default dir() implementation.
|
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
2011-05-24 11:09:06 -05:00
|
|
|
static PyObject *
|
2017-03-19 08:46:44 +02:00
|
|
|
object___dir___impl(PyObject *self)
|
|
|
|
|
/*[clinic end generated code: output=66dd48ea62f26c90 input=0a89305bec669b10]*/
|
2011-05-24 11:09:06 -05:00
|
|
|
{
|
|
|
|
|
PyObject *result = NULL;
|
|
|
|
|
PyObject *dict = NULL;
|
|
|
|
|
PyObject *itsclass = NULL;
|
|
|
|
|
|
|
|
|
|
/* Get __dict__ (which may or may not be a real dict...) */
|
2023-07-12 08:57:10 +03:00
|
|
|
if (PyObject_GetOptionalAttr(self, &_Py_ID(__dict__), &dict) < 0) {
|
2019-09-01 12:03:39 +03:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2011-05-24 11:09:06 -05:00
|
|
|
if (dict == NULL) {
|
|
|
|
|
dict = PyDict_New();
|
|
|
|
|
}
|
|
|
|
|
else if (!PyDict_Check(dict)) {
|
|
|
|
|
Py_DECREF(dict);
|
|
|
|
|
dict = PyDict_New();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Copy __dict__ to avoid mutating it. */
|
|
|
|
|
PyObject *temp = PyDict_Copy(dict);
|
2022-11-22 13:39:11 +01:00
|
|
|
Py_SETREF(dict, temp);
|
2011-05-24 11:09:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dict == NULL)
|
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
|
|
/* Merge in attrs reachable from its class. */
|
2023-07-12 08:57:10 +03:00
|
|
|
if (PyObject_GetOptionalAttr(self, &_Py_ID(__class__), &itsclass) < 0) {
|
2019-09-01 12:03:39 +03:00
|
|
|
goto error;
|
|
|
|
|
}
|
2020-02-07 03:04:21 +01:00
|
|
|
/* XXX(tomer): Perhaps fall back to Py_TYPE(obj) if no
|
2019-09-01 12:03:39 +03:00
|
|
|
__class__ exists? */
|
|
|
|
|
if (itsclass != NULL && merge_class_dict(dict, itsclass) < 0)
|
2011-05-24 11:09:06 -05:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
|
|
result = PyDict_Keys(dict);
|
|
|
|
|
/* fall through */
|
|
|
|
|
error:
|
|
|
|
|
Py_XDECREF(itsclass);
|
|
|
|
|
Py_XDECREF(dict);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-25 16:25:58 +00:00
|
|
|
static PyMethodDef object_methods[] = {
|
2017-03-19 08:46:44 +02:00
|
|
|
OBJECT___REDUCE_EX___METHODDEF
|
|
|
|
|
OBJECT___REDUCE___METHODDEF
|
2022-04-06 20:00:14 +03:00
|
|
|
OBJECT___GETSTATE___METHODDEF
|
2024-04-12 13:56:41 +03:00
|
|
|
{"__subclasshook__", object_subclasshook, METH_CLASS | METH_O,
|
2010-05-09 15:52:27 +00:00
|
|
|
object_subclasshook_doc},
|
2016-07-30 16:26:03 +10:00
|
|
|
{"__init_subclass__", object_init_subclass, METH_CLASS | METH_NOARGS,
|
|
|
|
|
object_init_subclass_doc},
|
2017-03-19 08:46:44 +02:00
|
|
|
OBJECT___FORMAT___METHODDEF
|
|
|
|
|
OBJECT___SIZEOF___METHODDEF
|
|
|
|
|
OBJECT___DIR___METHODDEF
|
2010-05-09 15:52:27 +00:00
|
|
|
{0}
|
2001-09-25 16:25:58 +00:00
|
|
|
};
|
|
|
|
|
|
2019-05-24 06:43:29 -04:00
|
|
|
PyDoc_STRVAR(object_doc,
|
|
|
|
|
"object()\n--\n\n"
|
|
|
|
|
"The base class of the class hierarchy.\n\n"
|
|
|
|
|
"When called, it accepts no arguments and returns a new featureless\n"
|
|
|
|
|
"instance that has no instance attributes and cannot be given any.\n");
|
2003-02-21 22:02:54 +00:00
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
PyTypeObject PyBaseObject_Type = {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
|
|
|
|
"object", /* tp_name */
|
|
|
|
|
sizeof(PyObject), /* tp_basicsize */
|
|
|
|
|
0, /* tp_itemsize */
|
|
|
|
|
object_dealloc, /* tp_dealloc */
|
2019-05-31 04:13:39 +02:00
|
|
|
0, /* tp_vectorcall_offset */
|
2010-05-09 15:52:27 +00:00
|
|
|
0, /* tp_getattr */
|
|
|
|
|
0, /* tp_setattr */
|
2019-05-31 04:13:39 +02:00
|
|
|
0, /* tp_as_async */
|
2010-05-09 15:52:27 +00:00
|
|
|
object_repr, /* tp_repr */
|
|
|
|
|
0, /* tp_as_number */
|
|
|
|
|
0, /* tp_as_sequence */
|
|
|
|
|
0, /* tp_as_mapping */
|
2024-03-22 20:19:10 +02:00
|
|
|
PyObject_GenericHash, /* tp_hash */
|
2010-05-09 15:52:27 +00:00
|
|
|
0, /* tp_call */
|
|
|
|
|
object_str, /* tp_str */
|
|
|
|
|
PyObject_GenericGetAttr, /* tp_getattro */
|
|
|
|
|
PyObject_GenericSetAttr, /* tp_setattro */
|
|
|
|
|
0, /* tp_as_buffer */
|
2014-01-24 06:17:25 -08:00
|
|
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
2019-05-24 06:43:29 -04:00
|
|
|
object_doc, /* tp_doc */
|
2010-05-09 15:52:27 +00:00
|
|
|
0, /* tp_traverse */
|
|
|
|
|
0, /* tp_clear */
|
|
|
|
|
object_richcompare, /* tp_richcompare */
|
|
|
|
|
0, /* tp_weaklistoffset */
|
|
|
|
|
0, /* tp_iter */
|
|
|
|
|
0, /* tp_iternext */
|
|
|
|
|
object_methods, /* tp_methods */
|
|
|
|
|
0, /* tp_members */
|
|
|
|
|
object_getsets, /* tp_getset */
|
|
|
|
|
0, /* tp_base */
|
|
|
|
|
0, /* tp_dict */
|
|
|
|
|
0, /* tp_descr_get */
|
|
|
|
|
0, /* tp_descr_set */
|
|
|
|
|
0, /* tp_dictoffset */
|
|
|
|
|
object_init, /* tp_init */
|
|
|
|
|
PyType_GenericAlloc, /* tp_alloc */
|
|
|
|
|
object_new, /* tp_new */
|
2024-08-01 14:12:33 +02:00
|
|
|
PyObject_Free, /* tp_free */
|
1990-10-14 12:07:46 +00:00
|
|
|
};
|
2001-08-02 04:15:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2021-04-13 15:25:16 +02:00
|
|
|
type_add_method(PyTypeObject *type, PyMethodDef *meth)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2021-04-13 15:25:16 +02:00
|
|
|
PyObject *descr;
|
|
|
|
|
int isdescr = 1;
|
|
|
|
|
if (meth->ml_flags & METH_CLASS) {
|
|
|
|
|
if (meth->ml_flags & METH_STATIC) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError,
|
|
|
|
|
"method cannot be both class and static");
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2017-01-28 16:35:44 +09:00
|
|
|
}
|
2021-04-13 15:25:16 +02:00
|
|
|
descr = PyDescr_NewClassMethod(type, meth);
|
|
|
|
|
}
|
|
|
|
|
else if (meth->ml_flags & METH_STATIC) {
|
|
|
|
|
PyObject *cfunc = PyCFunction_NewEx(meth, (PyObject*)type, NULL);
|
|
|
|
|
if (cfunc == NULL) {
|
|
|
|
|
return -1;
|
2019-02-25 17:59:46 +02:00
|
|
|
}
|
2021-04-13 15:25:16 +02:00
|
|
|
descr = PyStaticMethod_New(cfunc);
|
|
|
|
|
isdescr = 0; // PyStaticMethod is not PyDescrObject
|
|
|
|
|
Py_DECREF(cfunc);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
descr = PyDescr_NewMethod(type, meth);
|
|
|
|
|
}
|
|
|
|
|
if (descr == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2019-02-25 17:59:46 +02:00
|
|
|
|
2021-04-13 15:25:16 +02:00
|
|
|
PyObject *name;
|
|
|
|
|
if (isdescr) {
|
|
|
|
|
name = PyDescr_NAME(descr);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
name = PyUnicode_FromString(meth->ml_name);
|
|
|
|
|
if (name == NULL) {
|
|
|
|
|
Py_DECREF(descr);
|
|
|
|
|
return -1;
|
2017-01-28 16:35:44 +09:00
|
|
|
}
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int err;
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2021-04-13 15:25:16 +02:00
|
|
|
if (!(meth->ml_flags & METH_COEXIST)) {
|
2024-02-07 13:43:18 -05:00
|
|
|
err = PyDict_SetDefaultRef(dict, name, descr, NULL) < 0;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2023-05-01 20:34:43 -06:00
|
|
|
err = PyDict_SetItem(dict, name, descr) < 0;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
|
|
|
|
if (!isdescr) {
|
|
|
|
|
Py_DECREF(name);
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(descr);
|
|
|
|
|
if (err) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-05 08:23:17 +02:00
|
|
|
int
|
|
|
|
|
_PyType_AddMethod(PyTypeObject *type, PyMethodDef *meth)
|
|
|
|
|
{
|
|
|
|
|
return type_add_method(type, meth);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-13 15:25:16 +02:00
|
|
|
|
|
|
|
|
/* Add the methods from tp_methods to the __dict__ in a type object */
|
|
|
|
|
static int
|
|
|
|
|
type_add_methods(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
PyMethodDef *meth = type->tp_methods;
|
|
|
|
|
if (meth == NULL) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (; meth->ml_name != NULL; meth++) {
|
|
|
|
|
if (type_add_method(type, meth) < 0) {
|
2012-05-08 09:22:24 -04:00
|
|
|
return -1;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
return 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-13 15:25:16 +02:00
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static int
|
2021-04-13 15:25:16 +02:00
|
|
|
type_add_members(PyTypeObject *type)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2021-04-13 15:25:16 +02:00
|
|
|
PyMemberDef *memb = type->tp_members;
|
|
|
|
|
if (memb == NULL) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2010-05-09 15:52:27 +00:00
|
|
|
for (; memb->name != NULL; memb++) {
|
2019-02-25 17:59:46 +02:00
|
|
|
PyObject *descr = PyDescr_NewMember(type, memb);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (descr == NULL)
|
|
|
|
|
return -1;
|
2019-02-25 17:59:46 +02:00
|
|
|
|
2024-02-07 13:43:18 -05:00
|
|
|
if (PyDict_SetDefaultRef(dict, PyDescr_NAME(descr), descr, NULL) < 0) {
|
2016-07-06 23:26:32 -07:00
|
|
|
Py_DECREF(descr);
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2016-07-06 23:26:32 -07:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(descr);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-13 15:25:16 +02:00
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static int
|
2021-04-13 15:25:16 +02:00
|
|
|
type_add_getset(PyTypeObject *type)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2021-04-13 15:25:16 +02:00
|
|
|
PyGetSetDef *gsp = type->tp_getset;
|
|
|
|
|
if (gsp == NULL) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2010-05-09 15:52:27 +00:00
|
|
|
for (; gsp->name != NULL; gsp++) {
|
2019-02-25 17:59:46 +02:00
|
|
|
PyObject *descr = PyDescr_NewGetSet(type, gsp);
|
2021-04-13 15:25:16 +02:00
|
|
|
if (descr == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
2019-02-25 17:59:46 +02:00
|
|
|
|
2024-02-07 13:43:18 -05:00
|
|
|
if (PyDict_SetDefaultRef(dict, PyDescr_NAME(descr), descr, NULL) < 0) {
|
2016-07-06 23:26:32 -07:00
|
|
|
Py_DECREF(descr);
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2016-07-06 23:26:32 -07:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(descr);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-13 15:25:16 +02:00
|
|
|
|
2001-08-10 21:24:08 +00:00
|
|
|
static void
|
|
|
|
|
inherit_special(PyTypeObject *type, PyTypeObject *base)
|
|
|
|
|
{
|
2019-05-28 14:42:53 +02:00
|
|
|
/* Copying tp_traverse and tp_clear is connected to the GC flags */
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_HAVE_GC) &&
|
|
|
|
|
(base->tp_flags & Py_TPFLAGS_HAVE_GC) &&
|
|
|
|
|
(!type->tp_traverse && !type->tp_clear)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_HAVE_GC);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (type->tp_traverse == NULL)
|
|
|
|
|
type->tp_traverse = base->tp_traverse;
|
|
|
|
|
if (type->tp_clear == NULL)
|
|
|
|
|
type->tp_clear = base->tp_clear;
|
|
|
|
|
}
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, base->tp_flags & Py_TPFLAGS_PREHEADER);
|
2021-04-30 12:46:15 +02:00
|
|
|
|
2010-07-05 15:01:22 +00:00
|
|
|
if (type->tp_basicsize == 0)
|
|
|
|
|
type->tp_basicsize = base->tp_basicsize;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* Copy other non-function slots */
|
2001-08-14 20:04:48 +00:00
|
|
|
|
|
|
|
|
#define COPYVAL(SLOT) \
|
2021-04-13 15:25:16 +02:00
|
|
|
if (type->SLOT == 0) { type->SLOT = base->SLOT; }
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
COPYVAL(tp_itemsize);
|
|
|
|
|
COPYVAL(tp_weaklistoffset);
|
|
|
|
|
COPYVAL(tp_dictoffset);
|
2022-08-15 12:29:27 +01:00
|
|
|
|
2021-04-13 15:25:16 +02:00
|
|
|
#undef COPYVAL
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* Setup fast subclass flags */
|
2024-03-15 12:35:29 -04:00
|
|
|
PyObject *mro = lookup_tp_mro(base);
|
2025-02-25 21:24:20 -08:00
|
|
|
unsigned long flags = 0;
|
2024-03-15 12:35:29 -04:00
|
|
|
if (is_subtype_with_mro(mro, base, (PyTypeObject*)PyExc_BaseException)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
flags |= Py_TPFLAGS_BASE_EXC_SUBCLASS;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
2024-03-15 12:35:29 -04:00
|
|
|
else if (is_subtype_with_mro(mro, base, &PyType_Type)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
flags |= Py_TPFLAGS_TYPE_SUBCLASS;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
2024-03-15 12:35:29 -04:00
|
|
|
else if (is_subtype_with_mro(mro, base, &PyLong_Type)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
flags |= Py_TPFLAGS_LONG_SUBCLASS;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
2024-03-15 12:35:29 -04:00
|
|
|
else if (is_subtype_with_mro(mro, base, &PyBytes_Type)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
flags |= Py_TPFLAGS_BYTES_SUBCLASS;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
2024-03-15 12:35:29 -04:00
|
|
|
else if (is_subtype_with_mro(mro, base, &PyUnicode_Type)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
flags |= Py_TPFLAGS_UNICODE_SUBCLASS;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
2024-03-15 12:35:29 -04:00
|
|
|
else if (is_subtype_with_mro(mro, base, &PyTuple_Type)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
flags |= Py_TPFLAGS_TUPLE_SUBCLASS;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
2024-03-15 12:35:29 -04:00
|
|
|
else if (is_subtype_with_mro(mro, base, &PyList_Type)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
flags |= Py_TPFLAGS_LIST_SUBCLASS;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
2024-03-15 12:35:29 -04:00
|
|
|
else if (is_subtype_with_mro(mro, base, &PyDict_Type)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
flags |= Py_TPFLAGS_DICT_SUBCLASS;
|
2021-04-13 15:25:16 +02:00
|
|
|
}
|
2023-05-04 09:56:53 +02:00
|
|
|
|
|
|
|
|
/* Setup some inheritable flags */
|
2021-02-26 14:51:55 -08:00
|
|
|
if (PyType_HasFeature(base, _Py_TPFLAGS_MATCH_SELF)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
flags |= _Py_TPFLAGS_MATCH_SELF;
|
2021-02-26 14:51:55 -08:00
|
|
|
}
|
2023-05-04 09:56:53 +02:00
|
|
|
if (PyType_HasFeature(base, Py_TPFLAGS_ITEMS_AT_END)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
flags |= Py_TPFLAGS_ITEMS_AT_END;
|
2023-05-04 09:56:53 +02:00
|
|
|
}
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, flags);
|
2001-08-10 21:24:08 +00:00
|
|
|
}
|
|
|
|
|
|
2006-08-21 23:36:26 +00:00
|
|
|
static int
|
2008-01-01 04:06:48 +00:00
|
|
|
overrides_hash(PyTypeObject *type)
|
2006-08-21 23:36:26 +00:00
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2006-08-21 23:36:26 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
assert(dict != NULL);
|
2022-02-08 13:39:07 -07:00
|
|
|
int r = PyDict_Contains(dict, &_Py_ID(__eq__));
|
2020-10-26 08:43:39 +02:00
|
|
|
if (r == 0) {
|
2022-02-08 13:39:07 -07:00
|
|
|
r = PyDict_Contains(dict, &_Py_ID(__hash__));
|
2020-10-26 08:43:39 +02:00
|
|
|
}
|
|
|
|
|
return r;
|
2006-08-21 23:36:26 +00:00
|
|
|
}
|
|
|
|
|
|
2020-10-26 08:43:39 +02:00
|
|
|
static int
|
2001-08-02 04:15:00 +00:00
|
|
|
inherit_slots(PyTypeObject *type, PyTypeObject *base)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *basebase;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2001-08-10 21:24:08 +00:00
|
|
|
#undef SLOTDEFINED
|
2001-08-02 04:15:00 +00:00
|
|
|
#undef COPYSLOT
|
|
|
|
|
#undef COPYNUM
|
|
|
|
|
#undef COPYSEQ
|
|
|
|
|
#undef COPYMAP
|
2001-10-12 14:13:21 +00:00
|
|
|
#undef COPYBUF
|
2001-08-10 21:24:08 +00:00
|
|
|
|
|
|
|
|
#define SLOTDEFINED(SLOT) \
|
2010-05-09 15:52:27 +00:00
|
|
|
(base->SLOT != 0 && \
|
|
|
|
|
(basebase == NULL || base->SLOT != basebase->SLOT))
|
2001-08-10 21:24:08 +00:00
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
#define COPYSLOT(SLOT) \
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!type->SLOT && SLOTDEFINED(SLOT)) type->SLOT = base->SLOT
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2015-05-11 22:57:16 -04:00
|
|
|
#define COPYASYNC(SLOT) COPYSLOT(tp_as_async->SLOT)
|
2001-08-02 04:15:00 +00:00
|
|
|
#define COPYNUM(SLOT) COPYSLOT(tp_as_number->SLOT)
|
|
|
|
|
#define COPYSEQ(SLOT) COPYSLOT(tp_as_sequence->SLOT)
|
|
|
|
|
#define COPYMAP(SLOT) COPYSLOT(tp_as_mapping->SLOT)
|
2001-10-12 02:38:24 +00:00
|
|
|
#define COPYBUF(SLOT) COPYSLOT(tp_as_buffer->SLOT)
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* This won't inherit indirect slots (from tp_as_number etc.)
|
|
|
|
|
if type doesn't provide the space. */
|
|
|
|
|
|
|
|
|
|
if (type->tp_as_number != NULL && base->tp_as_number != NULL) {
|
|
|
|
|
basebase = base->tp_base;
|
|
|
|
|
if (basebase->tp_as_number == NULL)
|
|
|
|
|
basebase = NULL;
|
|
|
|
|
COPYNUM(nb_add);
|
|
|
|
|
COPYNUM(nb_subtract);
|
|
|
|
|
COPYNUM(nb_multiply);
|
|
|
|
|
COPYNUM(nb_remainder);
|
|
|
|
|
COPYNUM(nb_divmod);
|
|
|
|
|
COPYNUM(nb_power);
|
|
|
|
|
COPYNUM(nb_negative);
|
|
|
|
|
COPYNUM(nb_positive);
|
|
|
|
|
COPYNUM(nb_absolute);
|
|
|
|
|
COPYNUM(nb_bool);
|
|
|
|
|
COPYNUM(nb_invert);
|
|
|
|
|
COPYNUM(nb_lshift);
|
|
|
|
|
COPYNUM(nb_rshift);
|
|
|
|
|
COPYNUM(nb_and);
|
|
|
|
|
COPYNUM(nb_xor);
|
|
|
|
|
COPYNUM(nb_or);
|
|
|
|
|
COPYNUM(nb_int);
|
|
|
|
|
COPYNUM(nb_float);
|
|
|
|
|
COPYNUM(nb_inplace_add);
|
|
|
|
|
COPYNUM(nb_inplace_subtract);
|
|
|
|
|
COPYNUM(nb_inplace_multiply);
|
|
|
|
|
COPYNUM(nb_inplace_remainder);
|
|
|
|
|
COPYNUM(nb_inplace_power);
|
|
|
|
|
COPYNUM(nb_inplace_lshift);
|
|
|
|
|
COPYNUM(nb_inplace_rshift);
|
|
|
|
|
COPYNUM(nb_inplace_and);
|
|
|
|
|
COPYNUM(nb_inplace_xor);
|
|
|
|
|
COPYNUM(nb_inplace_or);
|
|
|
|
|
COPYNUM(nb_true_divide);
|
|
|
|
|
COPYNUM(nb_floor_divide);
|
|
|
|
|
COPYNUM(nb_inplace_true_divide);
|
|
|
|
|
COPYNUM(nb_inplace_floor_divide);
|
|
|
|
|
COPYNUM(nb_index);
|
2014-04-09 23:55:56 -04:00
|
|
|
COPYNUM(nb_matrix_multiply);
|
|
|
|
|
COPYNUM(nb_inplace_matrix_multiply);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-11 22:57:16 -04:00
|
|
|
if (type->tp_as_async != NULL && base->tp_as_async != NULL) {
|
|
|
|
|
basebase = base->tp_base;
|
|
|
|
|
if (basebase->tp_as_async == NULL)
|
|
|
|
|
basebase = NULL;
|
|
|
|
|
COPYASYNC(am_await);
|
|
|
|
|
COPYASYNC(am_aiter);
|
|
|
|
|
COPYASYNC(am_anext);
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (type->tp_as_sequence != NULL && base->tp_as_sequence != NULL) {
|
|
|
|
|
basebase = base->tp_base;
|
|
|
|
|
if (basebase->tp_as_sequence == NULL)
|
|
|
|
|
basebase = NULL;
|
|
|
|
|
COPYSEQ(sq_length);
|
|
|
|
|
COPYSEQ(sq_concat);
|
|
|
|
|
COPYSEQ(sq_repeat);
|
|
|
|
|
COPYSEQ(sq_item);
|
|
|
|
|
COPYSEQ(sq_ass_item);
|
|
|
|
|
COPYSEQ(sq_contains);
|
|
|
|
|
COPYSEQ(sq_inplace_concat);
|
|
|
|
|
COPYSEQ(sq_inplace_repeat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type->tp_as_mapping != NULL && base->tp_as_mapping != NULL) {
|
|
|
|
|
basebase = base->tp_base;
|
|
|
|
|
if (basebase->tp_as_mapping == NULL)
|
|
|
|
|
basebase = NULL;
|
|
|
|
|
COPYMAP(mp_length);
|
|
|
|
|
COPYMAP(mp_subscript);
|
|
|
|
|
COPYMAP(mp_ass_subscript);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type->tp_as_buffer != NULL && base->tp_as_buffer != NULL) {
|
|
|
|
|
basebase = base->tp_base;
|
|
|
|
|
if (basebase->tp_as_buffer == NULL)
|
|
|
|
|
basebase = NULL;
|
|
|
|
|
COPYBUF(bf_getbuffer);
|
|
|
|
|
COPYBUF(bf_releasebuffer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
basebase = base->tp_base;
|
|
|
|
|
|
|
|
|
|
COPYSLOT(tp_dealloc);
|
|
|
|
|
if (type->tp_getattr == NULL && type->tp_getattro == NULL) {
|
|
|
|
|
type->tp_getattr = base->tp_getattr;
|
|
|
|
|
type->tp_getattro = base->tp_getattro;
|
|
|
|
|
}
|
|
|
|
|
if (type->tp_setattr == NULL && type->tp_setattro == NULL) {
|
|
|
|
|
type->tp_setattr = base->tp_setattr;
|
|
|
|
|
type->tp_setattro = base->tp_setattro;
|
|
|
|
|
}
|
|
|
|
|
COPYSLOT(tp_repr);
|
|
|
|
|
/* tp_hash see tp_richcompare */
|
2019-05-30 12:43:19 +02:00
|
|
|
{
|
2019-06-24 12:41:05 +02:00
|
|
|
/* Always inherit tp_vectorcall_offset to support PyVectorcall_Call().
|
2020-02-11 17:46:57 +01:00
|
|
|
* If Py_TPFLAGS_HAVE_VECTORCALL is not inherited, then vectorcall
|
2019-06-24 12:41:05 +02:00
|
|
|
* won't be used automatically. */
|
|
|
|
|
COPYSLOT(tp_vectorcall_offset);
|
|
|
|
|
|
2022-08-04 17:19:29 +02:00
|
|
|
/* Inherit Py_TPFLAGS_HAVE_VECTORCALL if tp_call is not overridden */
|
2019-06-02 23:52:20 +02:00
|
|
|
if (!type->tp_call &&
|
2022-08-04 17:19:29 +02:00
|
|
|
_PyType_HasFeature(base, Py_TPFLAGS_HAVE_VECTORCALL))
|
2019-06-02 23:52:20 +02:00
|
|
|
{
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_HAVE_VECTORCALL);
|
2019-06-02 23:52:20 +02:00
|
|
|
}
|
|
|
|
|
COPYSLOT(tp_call);
|
2019-05-30 12:43:19 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
COPYSLOT(tp_str);
|
|
|
|
|
{
|
|
|
|
|
/* Copy comparison-related slots only when
|
|
|
|
|
not overriding them anywhere */
|
|
|
|
|
if (type->tp_richcompare == NULL &&
|
2020-10-26 08:43:39 +02:00
|
|
|
type->tp_hash == NULL)
|
2010-05-09 15:52:27 +00:00
|
|
|
{
|
2020-10-26 08:43:39 +02:00
|
|
|
int r = overrides_hash(type);
|
|
|
|
|
if (r < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!r) {
|
|
|
|
|
type->tp_richcompare = base->tp_richcompare;
|
|
|
|
|
type->tp_hash = base->tp_hash;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
COPYSLOT(tp_iter);
|
|
|
|
|
COPYSLOT(tp_iternext);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
COPYSLOT(tp_descr_get);
|
2019-05-28 14:42:53 +02:00
|
|
|
/* Inherit Py_TPFLAGS_METHOD_DESCRIPTOR if tp_descr_get was inherited,
|
|
|
|
|
* but only for extension types */
|
|
|
|
|
if (base->tp_descr_get &&
|
|
|
|
|
type->tp_descr_get == base->tp_descr_get &&
|
2021-07-08 12:48:01 +02:00
|
|
|
_PyType_HasFeature(type, Py_TPFLAGS_IMMUTABLETYPE) &&
|
|
|
|
|
_PyType_HasFeature(base, Py_TPFLAGS_METHOD_DESCRIPTOR))
|
2019-05-28 14:42:53 +02:00
|
|
|
{
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_METHOD_DESCRIPTOR);
|
2019-05-28 14:42:53 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
COPYSLOT(tp_descr_set);
|
|
|
|
|
COPYSLOT(tp_dictoffset);
|
|
|
|
|
COPYSLOT(tp_init);
|
|
|
|
|
COPYSLOT(tp_alloc);
|
|
|
|
|
COPYSLOT(tp_is_gc);
|
2019-05-29 22:12:38 +02:00
|
|
|
COPYSLOT(tp_finalize);
|
2010-05-09 15:52:27 +00:00
|
|
|
if ((type->tp_flags & Py_TPFLAGS_HAVE_GC) ==
|
|
|
|
|
(base->tp_flags & Py_TPFLAGS_HAVE_GC)) {
|
|
|
|
|
/* They agree about gc. */
|
|
|
|
|
COPYSLOT(tp_free);
|
|
|
|
|
}
|
|
|
|
|
else if ((type->tp_flags & Py_TPFLAGS_HAVE_GC) &&
|
|
|
|
|
type->tp_free == NULL &&
|
|
|
|
|
base->tp_free == PyObject_Free) {
|
|
|
|
|
/* A bit of magic to plug in the correct default
|
|
|
|
|
* tp_free function when a derived class adds gc,
|
|
|
|
|
* didn't define tp_free, and the base uses the
|
|
|
|
|
* default non-gc tp_free.
|
|
|
|
|
*/
|
|
|
|
|
type->tp_free = PyObject_GC_Del;
|
|
|
|
|
}
|
|
|
|
|
/* else they didn't agree about gc, and there isn't something
|
|
|
|
|
* obvious to be done -- the type is on its own.
|
|
|
|
|
*/
|
|
|
|
|
}
|
2020-10-26 08:43:39 +02:00
|
|
|
return 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2024-09-09 08:04:58 -06:00
|
|
|
static int add_operators(PyTypeObject *type);
|
2021-04-30 12:46:15 +02:00
|
|
|
static int add_tp_new_wrapper(PyTypeObject *type);
|
2001-08-10 21:24:08 +00:00
|
|
|
|
2021-05-03 00:38:22 +01:00
|
|
|
#define COLLECTION_FLAGS (Py_TPFLAGS_SEQUENCE | Py_TPFLAGS_MAPPING)
|
2001-08-10 17:39:49 +00:00
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
static int
|
2021-06-01 23:37:12 +02:00
|
|
|
type_ready_pre_checks(PyTypeObject *type)
|
2021-04-11 23:57:09 +02:00
|
|
|
{
|
2019-06-03 01:57:22 +02:00
|
|
|
/* Consistency checks for PEP 590:
|
|
|
|
|
* - Py_TPFLAGS_METHOD_DESCRIPTOR requires tp_descr_get
|
2020-02-11 17:46:57 +01:00
|
|
|
* - Py_TPFLAGS_HAVE_VECTORCALL requires tp_call and
|
2019-06-03 01:57:22 +02:00
|
|
|
* tp_vectorcall_offset > 0
|
|
|
|
|
* To avoid mistakes, we require this before inheriting.
|
|
|
|
|
*/
|
|
|
|
|
if (type->tp_flags & Py_TPFLAGS_METHOD_DESCRIPTOR) {
|
|
|
|
|
_PyObject_ASSERT((PyObject *)type, type->tp_descr_get != NULL);
|
|
|
|
|
}
|
2020-02-11 17:46:57 +01:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_HAVE_VECTORCALL) {
|
2019-06-03 01:57:22 +02:00
|
|
|
_PyObject_ASSERT((PyObject *)type, type->tp_vectorcall_offset > 0);
|
|
|
|
|
_PyObject_ASSERT((PyObject *)type, type->tp_call != NULL);
|
|
|
|
|
}
|
2021-04-11 23:57:09 +02:00
|
|
|
|
2021-05-03 00:38:22 +01:00
|
|
|
/* Consistency checks for pattern matching
|
|
|
|
|
* Py_TPFLAGS_SEQUENCE and Py_TPFLAGS_MAPPING are mutually exclusive */
|
|
|
|
|
_PyObject_ASSERT((PyObject *)type, (type->tp_flags & COLLECTION_FLAGS) != COLLECTION_FLAGS);
|
|
|
|
|
|
2016-10-07 23:24:35 +03:00
|
|
|
if (type->tp_name == NULL) {
|
|
|
|
|
PyErr_Format(PyExc_SystemError,
|
|
|
|
|
"Type does not define the tp_name field.");
|
2021-04-11 23:57:09 +02:00
|
|
|
return -1;
|
2016-10-07 23:24:35 +03:00
|
|
|
}
|
2021-04-11 23:57:09 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-07 23:24:35 +03:00
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
static int
|
2023-06-01 16:28:31 -06:00
|
|
|
type_ready_set_base(PyTypeObject *type)
|
2021-04-11 23:57:09 +02:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Initialize tp_base (defaults to BaseObject unless that's us) */
|
2021-04-11 23:57:09 +02:00
|
|
|
PyTypeObject *base = type->tp_base;
|
2010-05-09 15:52:27 +00:00
|
|
|
if (base == NULL && type != &PyBaseObject_Type) {
|
2020-11-11 14:27:32 +01:00
|
|
|
base = &PyBaseObject_Type;
|
|
|
|
|
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
|
|
|
|
type->tp_base = (PyTypeObject*)Py_NewRef((PyObject*)base);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
type->tp_base = base;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2021-04-30 12:46:15 +02:00
|
|
|
assert(type->tp_base != NULL || type == &PyBaseObject_Type);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* Now the only way base can still be NULL is if type is
|
2021-04-11 23:57:09 +02:00
|
|
|
* &PyBaseObject_Type. */
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* Initialize the base class */
|
2021-04-11 23:57:09 +02:00
|
|
|
if (base != NULL && !_PyType_IsReady(base)) {
|
|
|
|
|
if (PyType_Ready(base) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
2023-06-01 16:28:31 -06:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
type_ready_set_type(PyTypeObject *type)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Initialize ob_type if NULL. This means extensions that want to be
|
|
|
|
|
compilable separately on Windows can call PyType_Ready() instead of
|
|
|
|
|
initializing the ob_type field of their type objects. */
|
|
|
|
|
/* The test for base != NULL is really unnecessary, since base is only
|
|
|
|
|
NULL when type is &PyBaseObject_Type, and we know its ob_type is
|
|
|
|
|
not NULL (it's initialized to &PyType_Type). But coverity doesn't
|
|
|
|
|
know that. */
|
2023-06-01 16:28:31 -06:00
|
|
|
PyTypeObject *base = type->tp_base;
|
2020-03-04 07:15:20 -06:00
|
|
|
if (Py_IS_TYPE(type, NULL) && base != NULL) {
|
2020-02-07 09:17:07 +01:00
|
|
|
Py_SET_TYPE(type, Py_TYPE(base));
|
|
|
|
|
}
|
2021-04-11 23:57:09 +02:00
|
|
|
|
2023-06-01 16:28:31 -06:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2024-06-03 19:09:18 -04:00
|
|
|
type_ready_set_bases(PyTypeObject *type, int initial)
|
2023-06-01 16:28:31 -06:00
|
|
|
{
|
|
|
|
|
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
2024-06-03 19:09:18 -04:00
|
|
|
if (!initial) {
|
2023-06-01 16:28:31 -06:00
|
|
|
assert(lookup_tp_bases(type) != NULL);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
assert(lookup_tp_bases(type) == NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *bases = lookup_tp_bases(type);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (bases == NULL) {
|
2021-04-11 23:57:09 +02:00
|
|
|
PyTypeObject *base = type->tp_base;
|
|
|
|
|
if (base == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
bases = PyTuple_New(0);
|
2021-04-11 23:57:09 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2010-05-09 15:52:27 +00:00
|
|
|
bases = PyTuple_Pack(1, base);
|
2021-04-11 23:57:09 +02:00
|
|
|
}
|
|
|
|
|
if (bases == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2024-06-03 19:09:18 -04:00
|
|
|
set_tp_bases(type, bases, 1);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2021-04-13 13:33:31 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-13 13:33:31 +02:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
type_ready_set_dict(PyTypeObject *type)
|
|
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
if (lookup_tp_dict(type) != NULL) {
|
2021-04-13 13:33:31 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *dict = PyDict_New();
|
2010-05-09 15:52:27 +00:00
|
|
|
if (dict == NULL) {
|
2021-04-13 13:33:31 +02:00
|
|
|
return -1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
set_tp_dict(type, dict);
|
2021-04-13 13:33:31 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-13 15:25:16 +02:00
|
|
|
/* If the type dictionary doesn't contain a __doc__, set it from
|
|
|
|
|
the tp_doc slot. */
|
2021-04-13 13:33:31 +02:00
|
|
|
static int
|
2021-04-13 15:25:16 +02:00
|
|
|
type_dict_set_doc(PyTypeObject *type)
|
2021-04-13 13:33:31 +02:00
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
|
|
|
|
int r = PyDict_Contains(dict, &_Py_ID(__doc__));
|
2021-04-13 15:25:16 +02:00
|
|
|
if (r < 0) {
|
2021-04-11 23:57:09 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2021-04-13 15:25:16 +02:00
|
|
|
if (r > 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type->tp_doc != NULL) {
|
|
|
|
|
const char *doc_str;
|
|
|
|
|
doc_str = _PyType_DocWithoutSignature(type->tp_name, type->tp_doc);
|
|
|
|
|
PyObject *doc = PyUnicode_FromString(doc_str);
|
|
|
|
|
if (doc == NULL) {
|
2021-04-11 23:57:09 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2021-04-13 15:25:16 +02:00
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
if (PyDict_SetItem(dict, &_Py_ID(__doc__), doc) < 0) {
|
2021-04-13 15:25:16 +02:00
|
|
|
Py_DECREF(doc);
|
2021-04-11 23:57:09 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2021-04-13 15:25:16 +02:00
|
|
|
Py_DECREF(doc);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2021-04-13 15:25:16 +02:00
|
|
|
else {
|
2023-05-01 20:34:43 -06:00
|
|
|
if (PyDict_SetItem(dict, &_Py_ID(__doc__), Py_None) < 0) {
|
2021-04-11 23:57:09 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2021-04-11 23:57:09 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
|
2021-04-13 15:25:16 +02:00
|
|
|
static int
|
2024-09-09 08:04:58 -06:00
|
|
|
type_ready_fill_dict(PyTypeObject *type)
|
2021-04-13 15:25:16 +02:00
|
|
|
{
|
|
|
|
|
/* Add type-specific descriptors to tp_dict */
|
2024-09-09 08:04:58 -06:00
|
|
|
if (add_operators(type) < 0) {
|
2021-04-13 15:25:16 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (type_add_methods(type) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (type_add_members(type) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (type_add_getset(type) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (type_dict_set_doc(type) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-15 12:29:27 +01:00
|
|
|
static int
|
2022-08-16 13:57:18 +01:00
|
|
|
type_ready_preheader(PyTypeObject *type)
|
2022-08-15 12:29:27 +01:00
|
|
|
{
|
|
|
|
|
if (type->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
|
|
|
|
|
if (type->tp_dictoffset > 0 || type->tp_dictoffset < -1) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"type %s has the Py_TPFLAGS_MANAGED_DICT flag "
|
|
|
|
|
"but tp_dictoffset is set",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
type->tp_dictoffset = -1;
|
|
|
|
|
}
|
2022-08-16 13:57:18 +01:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_MANAGED_WEAKREF) {
|
|
|
|
|
if (type->tp_weaklistoffset != 0 &&
|
|
|
|
|
type->tp_weaklistoffset != MANAGED_WEAKREF_OFFSET)
|
|
|
|
|
{
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"type %s has the Py_TPFLAGS_MANAGED_WEAKREF flag "
|
|
|
|
|
"but tp_weaklistoffset is set",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
type->tp_weaklistoffset = MANAGED_WEAKREF_OFFSET;
|
|
|
|
|
}
|
2022-08-15 12:29:27 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
2021-04-13 15:25:16 +02:00
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
static int
|
2024-06-03 19:09:18 -04:00
|
|
|
type_ready_mro(PyTypeObject *type, int initial)
|
2021-04-11 23:57:09 +02:00
|
|
|
{
|
2024-02-15 10:54:57 -08:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
2023-05-30 18:13:35 -06:00
|
|
|
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) {
|
2024-06-03 19:09:18 -04:00
|
|
|
if (!initial) {
|
2023-05-30 18:13:35 -06:00
|
|
|
assert(lookup_tp_mro(type) != NULL);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
assert(lookup_tp_mro(type) == NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Calculate method resolution order */
|
2025-04-28 23:38:29 -07:00
|
|
|
if (mro_internal_unlocked(type, initial, NULL) < 0) {
|
2021-04-11 23:57:09 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *mro = lookup_tp_mro(type);
|
|
|
|
|
assert(mro != NULL);
|
|
|
|
|
assert(PyTuple_Check(mro));
|
2021-04-11 23:57:09 +02:00
|
|
|
|
2023-04-24 16:30:13 -06:00
|
|
|
/* All bases of statically allocated type should be statically allocated,
|
|
|
|
|
and static builtin types must have static builtin bases. */
|
2021-04-11 23:57:09 +02:00
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
|
2023-04-24 16:30:13 -06:00
|
|
|
assert(type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE);
|
2021-04-11 23:57:09 +02:00
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(mro);
|
|
|
|
|
for (Py_ssize_t i = 0; i < n; i++) {
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *base = _PyType_CAST(PyTuple_GET_ITEM(mro, i));
|
2022-01-22 18:56:11 +01:00
|
|
|
if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
2021-04-11 23:57:09 +02:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"type '%.100s' is not dynamically allocated but "
|
|
|
|
|
"its base type '%.100s' is dynamically allocated",
|
|
|
|
|
type->tp_name, base->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2023-04-25 18:01:04 +08:00
|
|
|
assert(!(type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) ||
|
|
|
|
|
(base->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN));
|
2021-04-11 23:57:09 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-13 15:25:16 +02:00
|
|
|
// For static types, inherit tp_as_xxx structures from the base class
|
|
|
|
|
// if it's NULL.
|
|
|
|
|
//
|
|
|
|
|
// For heap types, tp_as_xxx structures are not NULL: they are set to the
|
|
|
|
|
// PyHeapTypeObject.as_xxx fields by type_new_alloc().
|
2021-04-13 13:33:31 +02:00
|
|
|
static void
|
2021-04-13 15:25:16 +02:00
|
|
|
type_ready_inherit_as_structs(PyTypeObject *type, PyTypeObject *base)
|
2021-04-13 13:33:31 +02:00
|
|
|
{
|
|
|
|
|
if (type->tp_as_async == NULL) {
|
|
|
|
|
type->tp_as_async = base->tp_as_async;
|
|
|
|
|
}
|
|
|
|
|
if (type->tp_as_number == NULL) {
|
|
|
|
|
type->tp_as_number = base->tp_as_number;
|
|
|
|
|
}
|
|
|
|
|
if (type->tp_as_sequence == NULL) {
|
|
|
|
|
type->tp_as_sequence = base->tp_as_sequence;
|
|
|
|
|
}
|
|
|
|
|
if (type->tp_as_mapping == NULL) {
|
|
|
|
|
type->tp_as_mapping = base->tp_as_mapping;
|
|
|
|
|
}
|
|
|
|
|
if (type->tp_as_buffer == NULL) {
|
|
|
|
|
type->tp_as_buffer = base->tp_as_buffer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-03 00:38:22 +01:00
|
|
|
static void
|
|
|
|
|
inherit_patma_flags(PyTypeObject *type, PyTypeObject *base) {
|
|
|
|
|
if ((type->tp_flags & COLLECTION_FLAGS) == 0) {
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, base->tp_flags & COLLECTION_FLAGS);
|
2021-05-03 00:38:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
2021-04-13 13:33:31 +02:00
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
static int
|
|
|
|
|
type_ready_inherit(PyTypeObject *type)
|
|
|
|
|
{
|
2024-02-15 10:54:57 -08:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Inherit special flags from dominant base */
|
2021-04-13 13:33:31 +02:00
|
|
|
PyTypeObject *base = type->tp_base;
|
|
|
|
|
if (base != NULL) {
|
|
|
|
|
inherit_special(type, base);
|
2021-04-11 23:57:09 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-13 15:25:16 +02:00
|
|
|
// Inherit slots
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *mro = lookup_tp_mro(type);
|
|
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(mro);
|
2021-04-11 23:57:09 +02:00
|
|
|
for (Py_ssize_t i = 1; i < n; i++) {
|
|
|
|
|
PyObject *b = PyTuple_GET_ITEM(mro, i);
|
2020-10-26 08:43:39 +02:00
|
|
|
if (PyType_Check(b)) {
|
|
|
|
|
if (inherit_slots(type, (PyTypeObject *)b) < 0) {
|
2021-04-11 23:57:09 +02:00
|
|
|
return -1;
|
2020-10-26 08:43:39 +02:00
|
|
|
}
|
2021-05-03 00:38:22 +01:00
|
|
|
inherit_patma_flags(type, (PyTypeObject *)b);
|
2020-10-26 08:43:39 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-13 13:33:31 +02:00
|
|
|
if (base != NULL) {
|
2021-04-13 15:25:16 +02:00
|
|
|
type_ready_inherit_as_structs(type, base);
|
2021-04-13 13:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Sanity check for tp_free. */
|
2020-04-08 01:42:27 +02:00
|
|
|
if (_PyType_IS_GC(type) && (type->tp_flags & Py_TPFLAGS_BASETYPE) &&
|
2024-08-01 14:12:33 +02:00
|
|
|
(type->tp_free == NULL || type->tp_free == PyObject_Free))
|
2021-04-11 23:57:09 +02:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
/* This base class needs to call tp_free, but doesn't have
|
|
|
|
|
* one, or its tp_free is for non-gc'ed objects.
|
|
|
|
|
*/
|
|
|
|
|
PyErr_Format(PyExc_TypeError, "type '%.100s' participates in "
|
|
|
|
|
"gc and is a base type but has inappropriate "
|
|
|
|
|
"tp_free slot",
|
|
|
|
|
type->tp_name);
|
2021-04-11 23:57:09 +02:00
|
|
|
return -1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2021-04-13 13:33:31 +02:00
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
|
|
|
|
|
/* Hack for tp_hash and __hash__.
|
|
|
|
|
If after all that, tp_hash is still NULL, and __hash__ is not in
|
|
|
|
|
tp_dict, set tp_hash to PyObject_HashNotImplemented and
|
|
|
|
|
tp_dict['__hash__'] equal to None.
|
|
|
|
|
This signals that __hash__ is not inherited. */
|
|
|
|
|
static int
|
|
|
|
|
type_ready_set_hash(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
if (type->tp_hash != NULL) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
|
|
|
|
int r = PyDict_Contains(dict, &_Py_ID(__hash__));
|
2021-04-11 23:57:09 +02:00
|
|
|
if (r < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (r > 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
if (PyDict_SetItem(dict, &_Py_ID(__hash__), Py_None) < 0) {
|
2021-04-11 23:57:09 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
type->tp_hash = PyObject_HashNotImplemented;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Link into each base class's list of subclasses */
|
|
|
|
|
static int
|
|
|
|
|
type_ready_add_subclasses(PyTypeObject *type)
|
|
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *bases = lookup_tp_bases(type);
|
2021-04-11 23:57:09 +02:00
|
|
|
Py_ssize_t nbase = PyTuple_GET_SIZE(bases);
|
|
|
|
|
for (Py_ssize_t i = 0; i < nbase; i++) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *b = PyTuple_GET_ITEM(bases, i);
|
2021-04-11 23:57:09 +02:00
|
|
|
if (PyType_Check(b) && add_subclass((PyTypeObject *)b, type) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-04-30 12:46:15 +02:00
|
|
|
// Set tp_new and the "__new__" key in the type dictionary.
|
|
|
|
|
// Use the Py_TPFLAGS_DISALLOW_INSTANTIATION flag.
|
|
|
|
|
static int
|
2024-06-03 19:09:18 -04:00
|
|
|
type_ready_set_new(PyTypeObject *type, int initial)
|
2021-04-30 12:46:15 +02:00
|
|
|
{
|
|
|
|
|
PyTypeObject *base = type->tp_base;
|
|
|
|
|
/* The condition below could use some explanation.
|
|
|
|
|
|
|
|
|
|
It appears that tp_new is not inherited for static types whose base
|
|
|
|
|
class is 'object'; this seems to be a precaution so that old extension
|
|
|
|
|
types don't suddenly become callable (object.__new__ wouldn't insure the
|
|
|
|
|
invariants that the extension type's own factory function ensures).
|
|
|
|
|
|
|
|
|
|
Heap types, of course, are under our control, so they do inherit tp_new;
|
|
|
|
|
static extension types that specify some other built-in type as the
|
|
|
|
|
default also inherit object.__new__. */
|
|
|
|
|
if (type->tp_new == NULL
|
|
|
|
|
&& base == &PyBaseObject_Type
|
|
|
|
|
&& !(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
|
|
|
|
|
{
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_DISALLOW_INSTANTIATION);
|
2021-04-30 12:46:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_DISALLOW_INSTANTIATION)) {
|
|
|
|
|
if (type->tp_new != NULL) {
|
2024-06-03 19:09:18 -04:00
|
|
|
if (initial || base == NULL || type->tp_new != base->tp_new) {
|
2023-05-02 21:30:03 -06:00
|
|
|
// If "__new__" key does not exists in the type dictionary,
|
|
|
|
|
// set it to tp_new_wrapper().
|
|
|
|
|
if (add_tp_new_wrapper(type) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2021-04-30 12:46:15 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// tp_new is NULL: inherit tp_new from base
|
|
|
|
|
type->tp_new = base->tp_new;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Py_TPFLAGS_DISALLOW_INSTANTIATION sets tp_new to NULL
|
|
|
|
|
type->tp_new = NULL;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-22 07:24:03 +02:00
|
|
|
static int
|
|
|
|
|
type_ready_managed_dict(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_MANAGED_DICT)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
|
|
|
|
|
PyErr_Format(PyExc_SystemError,
|
|
|
|
|
"type %s has the Py_TPFLAGS_MANAGED_DICT flag "
|
|
|
|
|
"but not Py_TPFLAGS_HEAPTYPE flag",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
PyHeapTypeObject* et = (PyHeapTypeObject*)type;
|
|
|
|
|
if (et->ht_cached_keys == NULL) {
|
2024-08-27 10:34:46 +01:00
|
|
|
et->ht_cached_keys = _PyDict_NewKeysForClass(et);
|
2022-08-22 07:24:03 +02:00
|
|
|
if (et->ht_cached_keys == NULL) {
|
|
|
|
|
PyErr_NoMemory();
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-21 15:52:04 +01:00
|
|
|
if (type->tp_itemsize == 0) {
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_INLINE_VALUES);
|
2024-04-02 11:59:21 +01:00
|
|
|
}
|
2022-08-22 07:24:03 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
2021-04-30 12:46:15 +02:00
|
|
|
|
2021-06-01 23:37:12 +02:00
|
|
|
static int
|
|
|
|
|
type_ready_post_checks(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
// bpo-44263: tp_traverse is required if Py_TPFLAGS_HAVE_GC is set.
|
|
|
|
|
// Note: tp_clear is optional.
|
|
|
|
|
if (type->tp_flags & Py_TPFLAGS_HAVE_GC
|
|
|
|
|
&& type->tp_traverse == NULL)
|
|
|
|
|
{
|
|
|
|
|
PyErr_Format(PyExc_SystemError,
|
|
|
|
|
"type %s has the Py_TPFLAGS_HAVE_GC flag "
|
|
|
|
|
"but has no traverse function",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2022-08-15 12:29:27 +01:00
|
|
|
if (type->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
|
|
|
|
|
if (type->tp_dictoffset != -1) {
|
|
|
|
|
PyErr_Format(PyExc_SystemError,
|
|
|
|
|
"type %s has the Py_TPFLAGS_MANAGED_DICT flag "
|
|
|
|
|
"but tp_dictoffset is set to incompatible value",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-16 13:57:18 +01:00
|
|
|
else if (type->tp_dictoffset < (Py_ssize_t)sizeof(PyObject)) {
|
2022-08-15 12:29:27 +01:00
|
|
|
if (type->tp_dictoffset + type->tp_basicsize <= 0) {
|
|
|
|
|
PyErr_Format(PyExc_SystemError,
|
2023-05-01 19:36:00 -06:00
|
|
|
"type %s has a tp_dictoffset that is too small",
|
|
|
|
|
type->tp_name);
|
2022-08-15 12:29:27 +01:00
|
|
|
}
|
|
|
|
|
}
|
2021-06-01 23:37:12 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
static int
|
2024-09-09 08:04:58 -06:00
|
|
|
type_ready(PyTypeObject *type, int initial)
|
2021-04-11 23:57:09 +02:00
|
|
|
{
|
2024-02-15 10:54:57 -08:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
2023-05-02 21:30:03 -06:00
|
|
|
_PyObject_ASSERT((PyObject *)type, !is_readying(type));
|
|
|
|
|
start_readying(type);
|
2023-04-27 16:19:43 -06:00
|
|
|
|
2021-06-01 23:37:12 +02:00
|
|
|
if (type_ready_pre_checks(type) < 0) {
|
2023-04-27 16:19:43 -06:00
|
|
|
goto error;
|
2021-04-11 23:57:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef Py_TRACE_REFS
|
|
|
|
|
/* PyType_Ready is the closest thing we have to a choke point
|
|
|
|
|
* for type objects, so is the best place I can think of to try
|
|
|
|
|
* to get type objects into the doubly-linked list of all objects.
|
|
|
|
|
* Still, not all type objects go through PyType_Ready.
|
|
|
|
|
*/
|
2023-08-31 18:33:34 +02:00
|
|
|
_Py_AddToAllObjects((PyObject *)type);
|
2021-04-11 23:57:09 +02:00
|
|
|
#endif
|
|
|
|
|
|
2021-04-13 13:33:31 +02:00
|
|
|
/* Initialize tp_dict: _PyType_IsReady() tests if tp_dict != NULL */
|
|
|
|
|
if (type_ready_set_dict(type) < 0) {
|
2023-04-27 16:19:43 -06:00
|
|
|
goto error;
|
2021-04-11 23:57:09 +02:00
|
|
|
}
|
2023-06-01 16:28:31 -06:00
|
|
|
if (type_ready_set_base(type) < 0) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
if (type_ready_set_type(type) < 0) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
2024-06-03 19:09:18 -04:00
|
|
|
if (type_ready_set_bases(type, initial) < 0) {
|
2023-04-27 16:19:43 -06:00
|
|
|
goto error;
|
2021-04-11 23:57:09 +02:00
|
|
|
}
|
2024-06-03 19:09:18 -04:00
|
|
|
if (type_ready_mro(type, initial) < 0) {
|
2023-04-27 16:19:43 -06:00
|
|
|
goto error;
|
2021-04-11 23:57:09 +02:00
|
|
|
}
|
2024-06-03 19:09:18 -04:00
|
|
|
if (type_ready_set_new(type, initial) < 0) {
|
2023-04-27 16:19:43 -06:00
|
|
|
goto error;
|
2021-04-30 12:46:15 +02:00
|
|
|
}
|
2024-09-09 08:04:58 -06:00
|
|
|
if (type_ready_fill_dict(type) < 0) {
|
2023-04-27 16:19:43 -06:00
|
|
|
goto error;
|
2021-04-13 13:33:31 +02:00
|
|
|
}
|
2024-06-03 19:09:18 -04:00
|
|
|
if (initial) {
|
2023-05-02 21:30:03 -06:00
|
|
|
if (type_ready_inherit(type) < 0) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
if (type_ready_preheader(type) < 0) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
2022-08-15 12:29:27 +01:00
|
|
|
}
|
2021-04-11 23:57:09 +02:00
|
|
|
if (type_ready_set_hash(type) < 0) {
|
2023-04-27 16:19:43 -06:00
|
|
|
goto error;
|
2021-04-11 23:57:09 +02:00
|
|
|
}
|
|
|
|
|
if (type_ready_add_subclasses(type) < 0) {
|
2023-04-27 16:19:43 -06:00
|
|
|
goto error;
|
2021-04-11 23:57:09 +02:00
|
|
|
}
|
2024-06-03 19:09:18 -04:00
|
|
|
if (initial) {
|
2023-05-02 21:30:03 -06:00
|
|
|
if (type_ready_managed_dict(type) < 0) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
if (type_ready_post_checks(type) < 0) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
2021-06-01 23:37:12 +02:00
|
|
|
}
|
2023-04-27 16:19:43 -06:00
|
|
|
|
|
|
|
|
/* All done -- set the ready flag */
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_READY);
|
2023-05-02 21:30:03 -06:00
|
|
|
stop_readying(type);
|
2023-04-27 16:19:43 -06:00
|
|
|
|
|
|
|
|
assert(_PyType_CheckConsistency(type));
|
2021-04-11 23:57:09 +02:00
|
|
|
return 0;
|
|
|
|
|
|
2023-04-27 16:19:43 -06:00
|
|
|
error:
|
2023-05-02 21:30:03 -06:00
|
|
|
stop_readying(type);
|
2023-04-27 16:19:43 -06:00
|
|
|
return -1;
|
|
|
|
|
}
|
2021-04-11 23:57:09 +02:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
PyType_Ready(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
if (type->tp_flags & Py_TPFLAGS_READY) {
|
|
|
|
|
assert(_PyType_CheckConsistency(type));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2023-04-27 16:19:43 -06:00
|
|
|
assert(!(type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN));
|
2021-04-11 23:57:09 +02:00
|
|
|
|
2021-04-28 19:02:42 +02:00
|
|
|
/* Historically, all static types were immutable. See bpo-43908 */
|
|
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(type, Py_TPFLAGS_IMMUTABLETYPE);
|
2024-04-02 11:59:21 +01:00
|
|
|
/* Static types must be immortal */
|
|
|
|
|
_Py_SetImmortalUntracked((PyObject *)type);
|
2021-04-28 19:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
int res;
|
2024-06-21 15:50:18 -04:00
|
|
|
BEGIN_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
if (!(type->tp_flags & Py_TPFLAGS_READY)) {
|
2024-09-09 08:04:58 -06:00
|
|
|
res = type_ready(type, 1);
|
2024-02-15 10:54:57 -08:00
|
|
|
} else {
|
|
|
|
|
res = 0;
|
|
|
|
|
assert(_PyType_CheckConsistency(type));
|
|
|
|
|
}
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
return res;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
init_static_type(PyInterpreterState *interp, PyTypeObject *self,
|
|
|
|
|
int isbuiltin, int initial)
|
2022-07-25 12:47:31 -06:00
|
|
|
{
|
2023-05-01 15:08:34 -06:00
|
|
|
assert(_Py_IsImmortal((PyObject *)self));
|
2023-04-27 16:19:43 -06:00
|
|
|
assert(!(self->tp_flags & Py_TPFLAGS_HEAPTYPE));
|
2023-05-01 19:36:00 -06:00
|
|
|
assert(!(self->tp_flags & Py_TPFLAGS_MANAGED_DICT));
|
|
|
|
|
assert(!(self->tp_flags & Py_TPFLAGS_MANAGED_WEAKREF));
|
2023-04-27 16:19:43 -06:00
|
|
|
|
2023-05-02 21:30:03 -06:00
|
|
|
if ((self->tp_flags & Py_TPFLAGS_READY) == 0) {
|
2024-06-03 19:09:18 -04:00
|
|
|
assert(initial);
|
2023-05-02 21:30:03 -06:00
|
|
|
|
2025-02-25 21:24:20 -08:00
|
|
|
type_add_flags(self, _Py_TPFLAGS_STATIC_BUILTIN);
|
|
|
|
|
type_add_flags(self, Py_TPFLAGS_IMMUTABLETYPE);
|
2023-05-02 21:30:03 -06:00
|
|
|
|
|
|
|
|
assert(NEXT_GLOBAL_VERSION_TAG <= _Py_MAX_GLOBAL_TYPE_VERSION_TAG);
|
2024-11-08 16:44:44 +00:00
|
|
|
if (self->tp_version_tag == 0) {
|
|
|
|
|
_PyType_SetVersion(self, NEXT_GLOBAL_VERSION_TAG++);
|
|
|
|
|
}
|
2023-05-02 21:30:03 -06:00
|
|
|
}
|
|
|
|
|
else {
|
2024-06-03 19:09:18 -04:00
|
|
|
assert(!initial);
|
2023-04-27 16:19:43 -06:00
|
|
|
assert(self->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
|
2024-06-19 17:38:45 +01:00
|
|
|
assert(self->tp_version_tag != 0);
|
2023-04-27 16:19:43 -06:00
|
|
|
}
|
|
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state_init(interp, self, isbuiltin, initial);
|
2022-07-26 17:26:43 -06:00
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
int res;
|
|
|
|
|
BEGIN_TYPE_LOCK();
|
2024-09-09 08:04:58 -06:00
|
|
|
res = type_ready(self, initial);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2022-07-26 17:26:43 -06:00
|
|
|
if (res < 0) {
|
2024-04-03 10:58:39 -06:00
|
|
|
_PyStaticType_ClearWeakRefs(interp, self);
|
2024-06-03 19:09:18 -04:00
|
|
|
managed_static_type_state_clear(interp, self, isbuiltin, initial);
|
2022-07-26 17:26:43 -06:00
|
|
|
}
|
|
|
|
|
return res;
|
2022-07-25 12:47:31 -06:00
|
|
|
}
|
|
|
|
|
|
2024-06-03 19:09:18 -04:00
|
|
|
int
|
|
|
|
|
_PyStaticType_InitForExtension(PyInterpreterState *interp, PyTypeObject *self)
|
|
|
|
|
{
|
|
|
|
|
return init_static_type(interp, self, 0, ((self->tp_flags & Py_TPFLAGS_READY) == 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
_PyStaticType_InitBuiltin(PyInterpreterState *interp, PyTypeObject *self)
|
|
|
|
|
{
|
|
|
|
|
return init_static_type(interp, self, 1, _Py_IsMainInterpreter(interp));
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 23:57:09 +02:00
|
|
|
|
2001-10-08 15:18:27 +00:00
|
|
|
static int
|
|
|
|
|
add_subclass(PyTypeObject *base, PyTypeObject *type)
|
|
|
|
|
{
|
2022-01-22 15:08:42 +01:00
|
|
|
PyObject *key = PyLong_FromVoidPtr((void *) type);
|
|
|
|
|
if (key == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
PyObject *ref = PyWeakref_NewRef((PyObject *)type, NULL);
|
|
|
|
|
if (ref == NULL) {
|
|
|
|
|
Py_DECREF(key);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-01-22 15:08:42 +01:00
|
|
|
// Only get tp_subclasses after creating the key and value.
|
|
|
|
|
// PyWeakref_NewRef() can trigger a garbage collection which can execute
|
|
|
|
|
// arbitrary Python code and so modify base->tp_subclasses.
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *subclasses = lookup_tp_subclasses(base);
|
2022-01-22 18:56:11 +01:00
|
|
|
if (subclasses == NULL) {
|
2023-05-01 20:34:43 -06:00
|
|
|
subclasses = init_tp_subclasses(base);
|
2022-06-19 11:36:37 +05:30
|
|
|
if (subclasses == NULL) {
|
|
|
|
|
Py_DECREF(key);
|
|
|
|
|
Py_DECREF(ref);
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2022-06-19 11:36:37 +05:30
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
assert(PyDict_CheckExact(subclasses));
|
2022-01-22 15:08:42 +01:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
int result = PyDict_SetItem(subclasses, key, ref);
|
2022-01-22 15:08:42 +01:00
|
|
|
Py_DECREF(ref);
|
2013-10-29 21:31:25 +01:00
|
|
|
Py_DECREF(key);
|
2010-05-09 15:52:27 +00:00
|
|
|
return result;
|
2001-10-08 15:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
static int
|
|
|
|
|
add_all_subclasses(PyTypeObject *type, PyObject *bases)
|
|
|
|
|
{
|
2022-01-22 18:56:11 +01:00
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(bases);
|
2015-02-05 22:29:14 -05:00
|
|
|
int res = 0;
|
2022-01-22 18:56:11 +01:00
|
|
|
for (Py_ssize_t i = 0; i < n; i++) {
|
|
|
|
|
PyObject *obj = PyTuple_GET_ITEM(bases, i);
|
|
|
|
|
// bases tuple must only contain types
|
|
|
|
|
PyTypeObject *base = _PyType_CAST(obj);
|
|
|
|
|
if (add_subclass(base, type) < 0) {
|
|
|
|
|
res = -1;
|
2015-02-05 22:29:14 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
static PyObject *
|
|
|
|
|
get_subclasses_key(PyTypeObject *type, PyTypeObject *base)
|
|
|
|
|
{
|
|
|
|
|
PyObject *key = PyLong_FromVoidPtr((void *) type);
|
|
|
|
|
if (key != NULL) {
|
|
|
|
|
return key;
|
|
|
|
|
}
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
|
|
|
|
|
/* This basically means we're out of memory.
|
|
|
|
|
We fall back to manually traversing the values. */
|
|
|
|
|
Py_ssize_t i = 0;
|
|
|
|
|
PyObject *ref; // borrowed ref
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *subclasses = lookup_tp_subclasses(base);
|
2022-08-04 19:26:59 -06:00
|
|
|
if (subclasses != NULL) {
|
|
|
|
|
while (PyDict_Next(subclasses, &i, &key, &ref)) {
|
2023-06-21 16:35:58 +02:00
|
|
|
PyTypeObject *subclass = type_from_ref(ref);
|
|
|
|
|
if (subclass == NULL) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2022-08-04 19:26:59 -06:00
|
|
|
if (subclass == type) {
|
2023-06-21 16:35:58 +02:00
|
|
|
Py_DECREF(subclass);
|
2022-08-04 19:26:59 -06:00
|
|
|
return Py_NewRef(key);
|
|
|
|
|
}
|
2023-06-21 16:35:58 +02:00
|
|
|
Py_DECREF(subclass);
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* It wasn't found. */
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 14:47:27 +00:00
|
|
|
static void
|
|
|
|
|
remove_subclass(PyTypeObject *base, PyTypeObject *type)
|
|
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *subclasses = lookup_tp_subclasses(base); // borrowed ref
|
2022-01-22 18:56:11 +01:00
|
|
|
if (subclasses == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
assert(PyDict_CheckExact(subclasses));
|
|
|
|
|
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
PyObject *key = get_subclasses_key(type, base);
|
|
|
|
|
if (key != NULL && PyDict_DelItem(subclasses, key)) {
|
2013-10-29 21:31:25 +01:00
|
|
|
/* This can happen if the type initialization errored out before
|
|
|
|
|
the base subclasses were updated (e.g. a non-str __qualname__
|
|
|
|
|
was passed in the type dict). */
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
}
|
|
|
|
|
Py_XDECREF(key);
|
2022-01-22 16:53:30 +01:00
|
|
|
|
2022-01-22 18:56:11 +01:00
|
|
|
if (PyDict_Size(subclasses) == 0) {
|
2023-05-01 20:34:43 -06:00
|
|
|
clear_tp_subclasses(base);
|
2022-01-22 16:53:30 +01:00
|
|
|
}
|
2013-10-29 21:31:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
remove_all_subclasses(PyTypeObject *type, PyObject *bases)
|
|
|
|
|
{
|
2022-01-22 18:56:11 +01:00
|
|
|
assert(bases != NULL);
|
|
|
|
|
// remove_subclass() can clear the current exception
|
|
|
|
|
assert(!PyErr_Occurred());
|
|
|
|
|
|
|
|
|
|
for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(bases); i++) {
|
|
|
|
|
PyObject *base = PyTuple_GET_ITEM(bases, i);
|
|
|
|
|
if (PyType_Check(base)) {
|
|
|
|
|
remove_subclass((PyTypeObject*) base, type);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
assert(!PyErr_Occurred());
|
2002-11-26 14:47:27 +00:00
|
|
|
}
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2003-12-13 15:21:55 +00:00
|
|
|
static int
|
|
|
|
|
check_num_args(PyObject *ob, int n)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!PyTuple_CheckExact(ob)) {
|
|
|
|
|
PyErr_SetString(PyExc_SystemError,
|
|
|
|
|
"PyArg_UnpackTuple() argument list is not a tuple");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (n == PyTuple_GET_SIZE(ob))
|
|
|
|
|
return 1;
|
|
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_TypeError,
|
2018-12-21 20:15:13 +05:30
|
|
|
"expected %d argument%s, got %zd", n, n == 1 ? "" : "s", PyTuple_GET_SIZE(ob));
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
2003-12-13 15:21:55 +00:00
|
|
|
}
|
|
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
static Py_ssize_t
|
|
|
|
|
check_pow_args(PyObject *ob)
|
|
|
|
|
{
|
|
|
|
|
// Returns the argument count on success or `-1` on error.
|
|
|
|
|
int min = 1;
|
|
|
|
|
int max = 2;
|
|
|
|
|
if (!PyTuple_CheckExact(ob)) {
|
|
|
|
|
PyErr_SetString(PyExc_SystemError,
|
|
|
|
|
"PyArg_UnpackTuple() argument list is not a tuple");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
Py_ssize_t size = PyTuple_GET_SIZE(ob);
|
|
|
|
|
if (size >= min && size <= max) {
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
PyErr_Format(
|
|
|
|
|
PyExc_TypeError,
|
|
|
|
|
"expected %d or %d arguments, got %zd", min, max, PyTuple_GET_SIZE(ob));
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
/* Generic wrappers for overloadable 'operators' such as __getitem__ */
|
|
|
|
|
|
|
|
|
|
/* There's a wrapper *function* for each distinct function typedef used
|
2010-05-09 15:52:27 +00:00
|
|
|
for type object slots (e.g. binaryfunc, ternaryfunc, etc.). There's a
|
2001-08-02 04:15:00 +00:00
|
|
|
wrapper *table* for each distinct operation (e.g. __len__, __add__).
|
|
|
|
|
Most tables have only one entry; the tables for binary operators have two
|
|
|
|
|
entries, one regular and one with reversed arguments. */
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
2006-02-15 17:27:45 +00:00
|
|
|
wrap_lenfunc(PyObject *self, PyObject *args, void *wrapped)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
lenfunc func = (lenfunc)wrapped;
|
|
|
|
|
Py_ssize_t res;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 0))
|
|
|
|
|
return NULL;
|
|
|
|
|
res = (*func)(self);
|
|
|
|
|
if (res == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
2019-05-28 06:55:29 -06:00
|
|
|
return PyLong_FromSsize_t(res);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2003-10-11 17:29:04 +00:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_inquirypred(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
inquiry func = (inquiry)wrapped;
|
|
|
|
|
int res;
|
2003-10-11 17:29:04 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 0))
|
|
|
|
|
return NULL;
|
|
|
|
|
res = (*func)(self);
|
|
|
|
|
if (res == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
|
|
|
|
return PyBool_FromLong((long)res);
|
2003-10-11 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_binaryfunc(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
binaryfunc func = (binaryfunc)wrapped;
|
|
|
|
|
PyObject *other;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 1))
|
|
|
|
|
return NULL;
|
|
|
|
|
other = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
return (*func)(self, other);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-10-09 11:07:24 +00:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_binaryfunc_l(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
binaryfunc func = (binaryfunc)wrapped;
|
|
|
|
|
PyObject *other;
|
2001-10-09 11:07:24 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 1))
|
|
|
|
|
return NULL;
|
|
|
|
|
other = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
return (*func)(self, other);
|
2001-10-09 11:07:24 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_binaryfunc_r(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
binaryfunc func = (binaryfunc)wrapped;
|
|
|
|
|
PyObject *other;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 1))
|
|
|
|
|
return NULL;
|
|
|
|
|
other = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
return (*func)(other, self);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
wrap_ternaryfunc(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
ternaryfunc func = (ternaryfunc)wrapped;
|
|
|
|
|
PyObject *other;
|
|
|
|
|
PyObject *third = Py_None;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Note: This wrapper only works for __pow__() */
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
Py_ssize_t size = check_pow_args(args);
|
|
|
|
|
if (size == -1) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
2024-08-30 10:36:51 +03:00
|
|
|
}
|
|
|
|
|
other = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
if (size == 2) {
|
|
|
|
|
third = PyTuple_GET_ITEM(args, 1);
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return (*func)(self, other, third);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-09-28 22:58:52 +00:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_ternaryfunc_r(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
ternaryfunc func = (ternaryfunc)wrapped;
|
|
|
|
|
PyObject *other;
|
|
|
|
|
PyObject *third = Py_None;
|
2001-09-28 22:58:52 +00:00
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
/* Note: This wrapper only works for __rpow__() */
|
2001-09-28 22:58:52 +00:00
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
Py_ssize_t size = check_pow_args(args);
|
|
|
|
|
if (size == -1) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
2024-08-30 10:36:51 +03:00
|
|
|
}
|
|
|
|
|
other = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
if (size == 2) {
|
|
|
|
|
third = PyTuple_GET_ITEM(args, 1);
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return (*func)(other, self, third);
|
2001-09-28 22:58:52 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_unaryfunc(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
unaryfunc func = (unaryfunc)wrapped;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 0))
|
|
|
|
|
return NULL;
|
|
|
|
|
return (*func)(self);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
2006-04-21 10:40:58 +00:00
|
|
|
wrap_indexargfunc(PyObject *self, PyObject *args, void *wrapped)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
ssizeargfunc func = (ssizeargfunc)wrapped;
|
|
|
|
|
PyObject* o;
|
|
|
|
|
Py_ssize_t i;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
if (!check_num_args(args, 1))
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
2024-08-30 10:36:51 +03:00
|
|
|
o = PyTuple_GET_ITEM(args, 0);
|
2010-05-09 15:52:27 +00:00
|
|
|
i = PyNumber_AsSsize_t(o, PyExc_OverflowError);
|
|
|
|
|
if (i == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
|
|
|
|
return (*func)(self, i);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2006-02-15 17:27:45 +00:00
|
|
|
static Py_ssize_t
|
2001-08-17 21:57:47 +00:00
|
|
|
getindex(PyObject *self, PyObject *arg)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_ssize_t i;
|
|
|
|
|
|
|
|
|
|
i = PyNumber_AsSsize_t(arg, PyExc_OverflowError);
|
|
|
|
|
if (i == -1 && PyErr_Occurred())
|
|
|
|
|
return -1;
|
|
|
|
|
if (i < 0) {
|
|
|
|
|
PySequenceMethods *sq = Py_TYPE(self)->tp_as_sequence;
|
|
|
|
|
if (sq && sq->sq_length) {
|
|
|
|
|
Py_ssize_t n = (*sq->sq_length)(self);
|
2017-04-16 09:21:44 +03:00
|
|
|
if (n < 0) {
|
|
|
|
|
assert(PyErr_Occurred());
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2017-04-16 09:21:44 +03:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
i += n;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return i;
|
2001-08-17 21:57:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
wrap_sq_item(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
ssizeargfunc func = (ssizeargfunc)wrapped;
|
|
|
|
|
PyObject *arg;
|
|
|
|
|
Py_ssize_t i;
|
2001-08-17 21:57:47 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (PyTuple_GET_SIZE(args) == 1) {
|
|
|
|
|
arg = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
i = getindex(self, arg);
|
|
|
|
|
if (i == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
|
|
|
|
return (*func)(self, i);
|
|
|
|
|
}
|
|
|
|
|
check_num_args(args, 1);
|
|
|
|
|
assert(PyErr_Occurred());
|
|
|
|
|
return NULL;
|
2001-08-17 21:57:47 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
2001-08-17 21:57:47 +00:00
|
|
|
wrap_sq_setitem(PyObject *self, PyObject *args, void *wrapped)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
ssizeobjargproc func = (ssizeobjargproc)wrapped;
|
|
|
|
|
Py_ssize_t i;
|
|
|
|
|
int res;
|
|
|
|
|
PyObject *arg, *value;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
if (!PyArg_UnpackTuple(args, "__setitem__", 2, 2, &arg, &value))
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
i = getindex(self, arg);
|
|
|
|
|
if (i == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
|
|
|
|
res = (*func)(self, i, value);
|
|
|
|
|
if (res == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 15:31:58 +00:00
|
|
|
static PyObject *
|
2001-08-17 21:57:47 +00:00
|
|
|
wrap_sq_delitem(PyObject *self, PyObject *args, void *wrapped)
|
2001-08-02 15:31:58 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
ssizeobjargproc func = (ssizeobjargproc)wrapped;
|
|
|
|
|
Py_ssize_t i;
|
|
|
|
|
int res;
|
|
|
|
|
PyObject *arg;
|
2001-08-02 15:31:58 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 1))
|
|
|
|
|
return NULL;
|
|
|
|
|
arg = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
i = getindex(self, arg);
|
|
|
|
|
if (i == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
|
|
|
|
res = (*func)(self, i, NULL);
|
|
|
|
|
if (res == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2001-08-02 15:31:58 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
/* XXX objobjproc is a misnomer; should be objargpred */
|
|
|
|
|
static PyObject *
|
|
|
|
|
wrap_objobjproc(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
objobjproc func = (objobjproc)wrapped;
|
|
|
|
|
int res;
|
|
|
|
|
PyObject *value;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 1))
|
|
|
|
|
return NULL;
|
|
|
|
|
value = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
res = (*func)(self, value);
|
|
|
|
|
if (res == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return PyBool_FromLong(res);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
wrap_objobjargproc(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
objobjargproc func = (objobjargproc)wrapped;
|
|
|
|
|
int res;
|
|
|
|
|
PyObject *key, *value;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
if (!PyArg_UnpackTuple(args, "__setitem__", 2, 2, &key, &value))
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
res = (*func)(self, key, value);
|
|
|
|
|
if (res == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 15:31:58 +00:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_delitem(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
objobjargproc func = (objobjargproc)wrapped;
|
|
|
|
|
int res;
|
|
|
|
|
PyObject *key;
|
2001-08-02 15:31:58 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 1))
|
|
|
|
|
return NULL;
|
|
|
|
|
key = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
res = (*func)(self, key, NULL);
|
|
|
|
|
if (res == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2001-08-02 15:31:58 +00:00
|
|
|
}
|
|
|
|
|
|
2003-04-14 21:46:03 +00:00
|
|
|
/* Helper to check for object.__setattr__ or __delattr__ applied to a type.
|
2020-07-03 02:09:28 +02:00
|
|
|
This is called the Carlo Verre hack after its discoverer. See
|
|
|
|
|
https://mail.python.org/pipermail/python-dev/2003-April/034535.html
|
|
|
|
|
*/
|
2003-04-14 21:46:03 +00:00
|
|
|
static int
|
2024-02-15 10:54:57 -08:00
|
|
|
hackcheck_unlocked(PyObject *self, setattrofunc func, const char *what)
|
2003-04-14 21:46:03 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *type = Py_TYPE(self);
|
2024-02-15 10:54:57 -08:00
|
|
|
|
|
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *mro = lookup_tp_mro(type);
|
2020-07-03 02:09:28 +02:00
|
|
|
if (!mro) {
|
|
|
|
|
/* Probably ok not to check the call in this case. */
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
assert(PyTuple_Check(mro));
|
2020-07-18 23:19:50 +02:00
|
|
|
|
|
|
|
|
/* Find the (base) type that defined the type's slot function. */
|
|
|
|
|
PyTypeObject *defining_type = type;
|
|
|
|
|
Py_ssize_t i;
|
|
|
|
|
for (i = PyTuple_GET_SIZE(mro) - 1; i >= 0; i--) {
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *base = _PyType_CAST(PyTuple_GET_ITEM(mro, i));
|
2020-07-18 23:19:50 +02:00
|
|
|
if (base->tp_setattro == slot_tp_setattro) {
|
|
|
|
|
/* Ignore Python classes:
|
|
|
|
|
they never define their own C-level setattro. */
|
|
|
|
|
}
|
|
|
|
|
else if (base->tp_setattro == type->tp_setattro) {
|
|
|
|
|
defining_type = base;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Reject calls that jump over intermediate C-level overrides. */
|
|
|
|
|
for (PyTypeObject *base = defining_type; base; base = base->tp_base) {
|
2020-07-03 02:09:28 +02:00
|
|
|
if (base->tp_setattro == func) {
|
2020-07-18 23:19:50 +02:00
|
|
|
/* 'func' is the right slot function to call. */
|
2020-07-03 02:09:28 +02:00
|
|
|
break;
|
2020-07-18 23:19:50 +02:00
|
|
|
}
|
|
|
|
|
else if (base->tp_setattro != slot_tp_setattro) {
|
2020-07-03 02:09:28 +02:00
|
|
|
/* 'base' is not a Python class and overrides 'func'.
|
|
|
|
|
Its tp_setattro should be called instead. */
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"can't apply this %s to %s object",
|
|
|
|
|
what,
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
return 1;
|
2003-04-14 21:46:03 +00:00
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
static int
|
|
|
|
|
hackcheck(PyObject *self, setattrofunc func, const char *what)
|
|
|
|
|
{
|
|
|
|
|
if (!PyType_Check(self)) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int res;
|
|
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
res = hackcheck_unlocked(self, func, what);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_setattr(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
setattrofunc func = (setattrofunc)wrapped;
|
|
|
|
|
int res;
|
|
|
|
|
PyObject *name, *value;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
if (!PyArg_UnpackTuple(args, "__setattr__", 2, 2, &name, &value))
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
if (!hackcheck(self, func, "__setattr__"))
|
|
|
|
|
return NULL;
|
|
|
|
|
res = (*func)(self, name, value);
|
|
|
|
|
if (res < 0)
|
|
|
|
|
return NULL;
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
wrap_delattr(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
setattrofunc func = (setattrofunc)wrapped;
|
|
|
|
|
int res;
|
|
|
|
|
PyObject *name;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 1))
|
|
|
|
|
return NULL;
|
|
|
|
|
name = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
if (!hackcheck(self, func, "__delattr__"))
|
|
|
|
|
return NULL;
|
|
|
|
|
res = (*func)(self, name, NULL);
|
|
|
|
|
if (res < 0)
|
|
|
|
|
return NULL;
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
wrap_hashfunc(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
hashfunc func = (hashfunc)wrapped;
|
2010-10-23 16:20:50 +00:00
|
|
|
Py_hash_t res;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 0))
|
|
|
|
|
return NULL;
|
|
|
|
|
res = (*func)(self);
|
|
|
|
|
if (res == -1 && PyErr_Occurred())
|
|
|
|
|
return NULL;
|
2010-10-23 16:20:50 +00:00
|
|
|
return PyLong_FromSsize_t(res);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
2001-10-22 00:43:43 +00:00
|
|
|
wrap_call(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
ternaryfunc func = (ternaryfunc)wrapped;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return (*func)(self, args, kwds);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2013-07-30 19:59:21 +02:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_del(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
|
|
|
|
destructor func = (destructor)wrapped;
|
|
|
|
|
|
|
|
|
|
if (!check_num_args(args, 0))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
(*func)(self);
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_richcmpfunc(PyObject *self, PyObject *args, void *wrapped, int op)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
richcmpfunc func = (richcmpfunc)wrapped;
|
|
|
|
|
PyObject *other;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 1))
|
|
|
|
|
return NULL;
|
|
|
|
|
other = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
return (*func)(self, other, op);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef RICHCMP_WRAPPER
|
|
|
|
|
#define RICHCMP_WRAPPER(NAME, OP) \
|
|
|
|
|
static PyObject * \
|
|
|
|
|
richcmp_##NAME(PyObject *self, PyObject *args, void *wrapped) \
|
|
|
|
|
{ \
|
2010-05-09 15:52:27 +00:00
|
|
|
return wrap_richcmpfunc(self, args, wrapped, OP); \
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-08 15:29:49 +00:00
|
|
|
RICHCMP_WRAPPER(lt, Py_LT)
|
|
|
|
|
RICHCMP_WRAPPER(le, Py_LE)
|
|
|
|
|
RICHCMP_WRAPPER(eq, Py_EQ)
|
|
|
|
|
RICHCMP_WRAPPER(ne, Py_NE)
|
|
|
|
|
RICHCMP_WRAPPER(gt, Py_GT)
|
|
|
|
|
RICHCMP_WRAPPER(ge, Py_GE)
|
2001-08-02 04:15:00 +00:00
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
wrap_next(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
unaryfunc func = (unaryfunc)wrapped;
|
|
|
|
|
PyObject *res;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 0))
|
|
|
|
|
return NULL;
|
|
|
|
|
res = (*func)(self);
|
|
|
|
|
if (res == NULL && !PyErr_Occurred())
|
|
|
|
|
PyErr_SetNone(PyExc_StopIteration);
|
|
|
|
|
return res;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
wrap_descr_get(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
descrgetfunc func = (descrgetfunc)wrapped;
|
|
|
|
|
PyObject *obj;
|
|
|
|
|
PyObject *type = NULL;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
if (!PyArg_UnpackTuple(args, "__get__", 1, 2, &obj, &type))
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
if (obj == Py_None)
|
|
|
|
|
obj = NULL;
|
|
|
|
|
if (type == Py_None)
|
|
|
|
|
type = NULL;
|
2022-06-21 12:45:38 -07:00
|
|
|
if (type == NULL && obj == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"__get__(None, None) is invalid");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return (*func)(self, obj, type);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
2001-10-09 19:39:46 +00:00
|
|
|
wrap_descr_set(PyObject *self, PyObject *args, void *wrapped)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
descrsetfunc func = (descrsetfunc)wrapped;
|
|
|
|
|
PyObject *obj, *value;
|
|
|
|
|
int ret;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
if (!PyArg_UnpackTuple(args, "__set__", 2, 2, &obj, &value))
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
ret = (*func)(self, obj, value);
|
|
|
|
|
if (ret < 0)
|
|
|
|
|
return NULL;
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
2002-08-06 21:41:44 +00:00
|
|
|
|
2002-08-01 14:39:25 +00:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
descrsetfunc func = (descrsetfunc)wrapped;
|
|
|
|
|
PyObject *obj;
|
|
|
|
|
int ret;
|
2002-08-01 14:39:25 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!check_num_args(args, 1))
|
|
|
|
|
return NULL;
|
|
|
|
|
obj = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
ret = (*func)(self, obj, NULL);
|
|
|
|
|
if (ret < 0)
|
|
|
|
|
return NULL;
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2002-08-01 14:39:25 +00:00
|
|
|
}
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2023-05-04 07:59:46 -07:00
|
|
|
static PyObject *
|
|
|
|
|
wrap_buffer(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
|
|
|
|
PyObject *arg = NULL;
|
|
|
|
|
|
2024-08-30 10:36:51 +03:00
|
|
|
if (!PyArg_UnpackTuple(args, "__buffer__", 1, 1, &arg)) {
|
2023-05-04 07:59:46 -07:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
Py_ssize_t flags = PyNumber_AsSsize_t(arg, PyExc_OverflowError);
|
|
|
|
|
if (flags == -1 && PyErr_Occurred()) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2024-11-19 09:13:20 +01:00
|
|
|
if (flags > INT_MAX || flags < INT_MIN) {
|
2023-05-04 07:59:46 -07:00
|
|
|
PyErr_SetString(PyExc_OverflowError,
|
2024-11-19 09:13:20 +01:00
|
|
|
"buffer flags out of range");
|
2023-05-04 07:59:46 -07:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-19 09:13:20 +01:00
|
|
|
return _PyMemoryView_FromBufferProc(self, (int)flags,
|
2023-05-08 09:52:41 -07:00
|
|
|
(getbufferproc)wrapped);
|
2023-05-04 07:59:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
wrap_releasebuffer(PyObject *self, PyObject *args, void *wrapped)
|
|
|
|
|
{
|
|
|
|
|
PyObject *arg = NULL;
|
2024-08-30 10:36:51 +03:00
|
|
|
if (!PyArg_UnpackTuple(args, "__release_buffer__", 1, 1, &arg)) {
|
2023-05-04 07:59:46 -07:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (!PyMemoryView_Check(arg)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"expected a memoryview object");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
PyMemoryViewObject *mview = (PyMemoryViewObject *)arg;
|
2023-05-08 09:52:41 -07:00
|
|
|
if (mview->view.obj == NULL) {
|
|
|
|
|
// Already released, ignore
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
2023-05-04 07:59:46 -07:00
|
|
|
if (mview->view.obj != self) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError,
|
|
|
|
|
"memoryview's buffer is not this object");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (mview->flags & _Py_MEMORYVIEW_RELEASED) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError,
|
|
|
|
|
"memoryview's buffer has already been released");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
PyObject *res = PyObject_CallMethodNoArgs((PyObject *)mview, &_Py_ID(release));
|
|
|
|
|
if (res == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(res);
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject *
|
2001-10-22 00:43:43 +00:00
|
|
|
wrap_init(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
initproc func = (initproc)wrapped;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (func(self, args, kwds) < 0)
|
|
|
|
|
return NULL;
|
2017-01-23 09:47:21 +02:00
|
|
|
Py_RETURN_NONE;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
2001-08-06 16:50:37 +00:00
|
|
|
tp_new_wrapper(PyObject *self, PyObject *args, PyObject *kwds)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *staticbase;
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *arg0, *res;
|
|
|
|
|
|
2020-01-30 09:02:49 +01:00
|
|
|
if (self == NULL || !PyType_Check(self)) {
|
|
|
|
|
PyErr_Format(PyExc_SystemError,
|
|
|
|
|
"__new__() called with non-type 'self'");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *type = (PyTypeObject *)self;
|
2021-04-30 12:46:15 +02:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!PyTuple_Check(args) || PyTuple_GET_SIZE(args) < 1) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"%s.__new__(): not enough arguments",
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
arg0 = PyTuple_GET_ITEM(args, 0);
|
|
|
|
|
if (!PyType_Check(arg0)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"%s.__new__(X): X is not a type object (%s)",
|
|
|
|
|
type->tp_name,
|
|
|
|
|
Py_TYPE(arg0)->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2022-01-21 21:39:01 +01:00
|
|
|
PyTypeObject *subtype = (PyTypeObject *)arg0;
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!PyType_IsSubtype(subtype, type)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"%s.__new__(%s): %s is not a subtype of %s",
|
|
|
|
|
type->tp_name,
|
|
|
|
|
subtype->tp_name,
|
|
|
|
|
subtype->tp_name,
|
|
|
|
|
type->tp_name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check that the use doesn't do something silly and unsafe like
|
|
|
|
|
object.__new__(dict). To do this, we check that the
|
|
|
|
|
most derived base that's not a heap type is this type. */
|
|
|
|
|
staticbase = subtype;
|
2012-06-23 23:20:45 +02:00
|
|
|
while (staticbase && (staticbase->tp_new == slot_tp_new))
|
2010-05-09 15:52:27 +00:00
|
|
|
staticbase = staticbase->tp_base;
|
|
|
|
|
/* If staticbase is NULL now, it is a really weird type.
|
|
|
|
|
In the spirit of backwards compatibility (?), just shut up. */
|
|
|
|
|
if (staticbase && staticbase->tp_new != type->tp_new) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"%s.__new__(%s) is not safe, use %s.__new__()",
|
|
|
|
|
type->tp_name,
|
|
|
|
|
subtype->tp_name,
|
2014-11-26 23:03:11 -06:00
|
|
|
staticbase->tp_name);
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args));
|
|
|
|
|
if (args == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
res = type->tp_new(subtype, args, kwds);
|
|
|
|
|
Py_DECREF(args);
|
|
|
|
|
return res;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-06 16:50:37 +00:00
|
|
|
static struct PyMethodDef tp_new_methoddef[] = {
|
2022-05-03 21:42:14 +02:00
|
|
|
{"__new__", _PyCFunction_CAST(tp_new_wrapper), METH_VARARGS|METH_KEYWORDS,
|
2014-02-08 22:15:29 -08:00
|
|
|
PyDoc_STR("__new__($type, *args, **kwargs)\n--\n\n"
|
2014-01-28 05:00:08 -08:00
|
|
|
"Create and return a new object. "
|
|
|
|
|
"See help(type) for accurate signature.")},
|
2010-05-09 15:52:27 +00:00
|
|
|
{0}
|
2001-08-02 04:15:00 +00:00
|
|
|
};
|
|
|
|
|
|
2001-08-06 16:50:37 +00:00
|
|
|
static int
|
|
|
|
|
add_tp_new_wrapper(PyTypeObject *type)
|
|
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
|
|
|
|
int r = PyDict_Contains(dict, &_Py_ID(__new__));
|
2021-04-30 12:46:15 +02:00
|
|
|
if (r > 0) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
2021-04-30 12:46:15 +02:00
|
|
|
}
|
|
|
|
|
if (r < 0) {
|
2019-02-25 17:59:46 +02:00
|
|
|
return -1;
|
2021-04-30 12:46:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *func = PyCFunction_NewEx(tp_new_methoddef, (PyObject *)type, NULL);
|
|
|
|
|
if (func == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2021-04-30 12:46:15 +02:00
|
|
|
}
|
2025-02-14 12:50:54 -08:00
|
|
|
_PyObject_SetDeferredRefcount(func);
|
2023-05-01 20:34:43 -06:00
|
|
|
r = PyDict_SetItem(dict, &_Py_ID(__new__), func);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(func);
|
2020-10-26 12:47:57 +02:00
|
|
|
return r;
|
2001-08-06 16:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-07 16:40:56 +00:00
|
|
|
/* Slot wrappers that call the corresponding __foo__ slot. See comments
|
|
|
|
|
below at override_slots() for more explanation. */
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
#define SLOT0(FUNCNAME, DUNDER) \
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject * \
|
2001-08-08 22:26:22 +00:00
|
|
|
FUNCNAME(PyObject *self) \
|
2001-08-02 04:15:00 +00:00
|
|
|
{ \
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject* stack[1] = {self}; \
|
2022-02-08 13:39:07 -07:00
|
|
|
return vectorcall_method(&_Py_ID(DUNDER), stack, 1); \
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
#define SLOT1(FUNCNAME, DUNDER, ARG1TYPE) \
|
2001-08-02 04:15:00 +00:00
|
|
|
static PyObject * \
|
2001-08-08 22:26:22 +00:00
|
|
|
FUNCNAME(PyObject *self, ARG1TYPE arg1) \
|
2001-08-02 04:15:00 +00:00
|
|
|
{ \
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject* stack[2] = {self, arg1}; \
|
2022-02-08 13:39:07 -07:00
|
|
|
return vectorcall_method(&_Py_ID(DUNDER), stack, 2); \
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-06 22:57:47 +00:00
|
|
|
/* Boolean helper for SLOT1BINFULL().
|
|
|
|
|
right.__class__ is a nontrivial subclass of left.__class__. */
|
|
|
|
|
static int
|
2022-02-08 13:39:07 -07:00
|
|
|
method_is_overloaded(PyObject *left, PyObject *right, PyObject *name)
|
2003-01-06 22:57:47 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *a, *b;
|
|
|
|
|
int ok;
|
2003-01-06 22:57:47 +00:00
|
|
|
|
2023-07-12 08:57:10 +03:00
|
|
|
if (PyObject_GetOptionalAttr((PyObject *)(Py_TYPE(right)), name, &b) < 0) {
|
2019-09-01 12:03:39 +03:00
|
|
|
return -1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
if (b == NULL) {
|
|
|
|
|
/* If right doesn't have it, it's not overloaded */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2003-01-06 22:57:47 +00:00
|
|
|
|
2023-07-12 08:57:10 +03:00
|
|
|
if (PyObject_GetOptionalAttr((PyObject *)(Py_TYPE(left)), name, &a) < 0) {
|
2019-09-01 12:03:39 +03:00
|
|
|
Py_DECREF(b);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
if (a == NULL) {
|
|
|
|
|
Py_DECREF(b);
|
|
|
|
|
/* If right has it but left doesn't, it's overloaded */
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2003-01-06 22:57:47 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
ok = PyObject_RichCompareBool(a, b, Py_NE);
|
|
|
|
|
Py_DECREF(a);
|
|
|
|
|
Py_DECREF(b);
|
|
|
|
|
return ok;
|
2003-01-06 22:57:47 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-08 22:26:22 +00:00
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
#define SLOT1BINFULL(FUNCNAME, TESTFUNC, SLOTNAME, DUNDER, RDUNDER) \
|
2001-08-08 22:26:22 +00:00
|
|
|
static PyObject * \
|
|
|
|
|
FUNCNAME(PyObject *self, PyObject *other) \
|
|
|
|
|
{ \
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject* stack[2]; \
|
2019-11-08 10:05:17 +01:00
|
|
|
PyThreadState *tstate = _PyThreadState_GET(); \
|
2020-03-06 16:53:17 -06:00
|
|
|
int do_other = !Py_IS_TYPE(self, Py_TYPE(other)) && \
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_TYPE(other)->tp_as_number != NULL && \
|
|
|
|
|
Py_TYPE(other)->tp_as_number->SLOTNAME == TESTFUNC; \
|
|
|
|
|
if (Py_TYPE(self)->tp_as_number != NULL && \
|
|
|
|
|
Py_TYPE(self)->tp_as_number->SLOTNAME == TESTFUNC) { \
|
|
|
|
|
PyObject *r; \
|
2019-09-01 12:03:39 +03:00
|
|
|
if (do_other && PyType_IsSubtype(Py_TYPE(other), Py_TYPE(self))) { \
|
2022-02-08 13:39:07 -07:00
|
|
|
int ok = method_is_overloaded(self, other, &_Py_ID(RDUNDER)); \
|
2019-09-01 12:03:39 +03:00
|
|
|
if (ok < 0) { \
|
|
|
|
|
return NULL; \
|
|
|
|
|
} \
|
|
|
|
|
if (ok) { \
|
|
|
|
|
stack[0] = other; \
|
|
|
|
|
stack[1] = self; \
|
2022-02-08 13:39:07 -07:00
|
|
|
r = vectorcall_maybe(tstate, &_Py_ID(RDUNDER), stack, 2); \
|
2019-09-01 12:03:39 +03:00
|
|
|
if (r != Py_NotImplemented) \
|
|
|
|
|
return r; \
|
|
|
|
|
Py_DECREF(r); \
|
|
|
|
|
do_other = 0; \
|
|
|
|
|
} \
|
2010-05-09 15:52:27 +00:00
|
|
|
} \
|
2019-06-13 11:26:44 +02:00
|
|
|
stack[0] = self; \
|
|
|
|
|
stack[1] = other; \
|
2022-02-08 13:39:07 -07:00
|
|
|
r = vectorcall_maybe(tstate, &_Py_ID(DUNDER), stack, 2); \
|
2010-05-09 15:52:27 +00:00
|
|
|
if (r != Py_NotImplemented || \
|
2020-05-04 21:31:38 +08:00
|
|
|
Py_IS_TYPE(other, Py_TYPE(self))) \
|
2010-05-09 15:52:27 +00:00
|
|
|
return r; \
|
|
|
|
|
Py_DECREF(r); \
|
|
|
|
|
} \
|
|
|
|
|
if (do_other) { \
|
2019-06-13 11:26:44 +02:00
|
|
|
stack[0] = other; \
|
|
|
|
|
stack[1] = self; \
|
2022-02-08 13:39:07 -07:00
|
|
|
return vectorcall_maybe(tstate, &_Py_ID(RDUNDER), stack, 2); \
|
2010-05-09 15:52:27 +00:00
|
|
|
} \
|
2011-08-10 20:28:54 -05:00
|
|
|
Py_RETURN_NOTIMPLEMENTED; \
|
2001-08-08 22:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
#define SLOT1BIN(FUNCNAME, SLOTNAME, DUNDER, RDUNDER) \
|
|
|
|
|
SLOT1BINFULL(FUNCNAME, FUNCNAME, SLOTNAME, DUNDER, RDUNDER)
|
2001-08-08 22:26:22 +00:00
|
|
|
|
2006-02-15 17:27:45 +00:00
|
|
|
static Py_ssize_t
|
2001-08-02 04:15:00 +00:00
|
|
|
slot_sq_length(PyObject *self)
|
|
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject* stack[1] = {self};
|
2022-02-08 13:39:07 -07:00
|
|
|
PyObject *res = vectorcall_method(&_Py_ID(__len__), stack, 1);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_ssize_t len;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (res == NULL)
|
|
|
|
|
return -1;
|
2017-04-16 09:37:18 +03:00
|
|
|
|
2020-05-28 10:33:45 +03:00
|
|
|
Py_SETREF(res, _PyNumber_Index(res));
|
2017-04-16 09:37:18 +03:00
|
|
|
if (res == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
assert(PyLong_Check(res));
|
2023-03-22 14:49:51 +00:00
|
|
|
if (_PyLong_IsNegative((PyLongObject *)res)) {
|
2017-04-17 00:54:21 +08:00
|
|
|
Py_DECREF(res);
|
2017-04-16 09:37:18 +03:00
|
|
|
PyErr_SetString(PyExc_ValueError,
|
|
|
|
|
"__len__() should return >= 0");
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
2017-04-16 09:37:18 +03:00
|
|
|
|
|
|
|
|
len = PyNumber_AsSsize_t(res, PyExc_OverflowError);
|
|
|
|
|
assert(len >= 0 || PyErr_ExceptionMatches(PyExc_OverflowError));
|
|
|
|
|
Py_DECREF(res);
|
2010-05-09 15:52:27 +00:00
|
|
|
return len;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-10-03 12:09:30 +00:00
|
|
|
static PyObject *
|
2006-02-15 17:27:45 +00:00
|
|
|
slot_sq_item(PyObject *self, Py_ssize_t i)
|
2001-10-03 12:09:30 +00:00
|
|
|
{
|
2017-06-01 08:18:25 +03:00
|
|
|
PyObject *ival = PyLong_FromSsize_t(i);
|
2016-08-19 18:17:37 +02:00
|
|
|
if (ival == NULL) {
|
2017-06-01 08:18:25 +03:00
|
|
|
return NULL;
|
2016-08-19 18:17:37 +02:00
|
|
|
}
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *stack[2] = {self, ival};
|
2022-02-08 13:39:07 -07:00
|
|
|
PyObject *retval = vectorcall_method(&_Py_ID(__getitem__), stack, 2);
|
2016-08-19 18:19:42 +02:00
|
|
|
Py_DECREF(ival);
|
2016-08-19 18:17:37 +02:00
|
|
|
return retval;
|
2001-10-03 12:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static int
|
2006-02-15 17:27:45 +00:00
|
|
|
slot_sq_ass_item(PyObject *self, Py_ssize_t index, PyObject *value)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *stack[3];
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *res;
|
2016-12-09 00:41:46 +01:00
|
|
|
PyObject *index_obj;
|
|
|
|
|
|
|
|
|
|
index_obj = PyLong_FromSsize_t(index);
|
|
|
|
|
if (index_obj == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2019-06-13 11:26:44 +02:00
|
|
|
stack[0] = self;
|
|
|
|
|
stack[1] = index_obj;
|
2017-01-11 00:07:40 +01:00
|
|
|
if (value == NULL) {
|
2022-02-08 13:39:07 -07:00
|
|
|
res = vectorcall_method(&_Py_ID(__delitem__), stack, 2);
|
2017-01-11 00:07:40 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2019-06-13 11:26:44 +02:00
|
|
|
stack[2] = value;
|
2022-02-08 13:39:07 -07:00
|
|
|
res = vectorcall_method(&_Py_ID(__setitem__), stack, 3);
|
2017-01-11 00:07:40 +01:00
|
|
|
}
|
2016-12-09 00:41:46 +01:00
|
|
|
Py_DECREF(index_obj);
|
|
|
|
|
|
|
|
|
|
if (res == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2016-12-09 00:41:46 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(res);
|
|
|
|
|
return 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
slot_sq_contains(PyObject *self, PyObject *value)
|
|
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
int attr_is_none = 0;
|
|
|
|
|
PyObject *res = maybe_call_special_one_arg(self, &_Py_ID(__contains__), value,
|
|
|
|
|
&attr_is_none);
|
|
|
|
|
if (attr_is_none) {
|
2016-08-18 09:22:23 -07:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
2025-03-26 14:38:47 -04:00
|
|
|
"'%.200s' object is not a container",
|
|
|
|
|
Py_TYPE(self)->tp_name);
|
2016-08-18 09:22:23 -07:00
|
|
|
return -1;
|
|
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
else if (res == NULL && PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
else if (res == NULL) {
|
|
|
|
|
return (int)_PySequence_IterSearch(self, value, PY_ITERSEARCH_CONTAINS);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
int result = PyObject_IsTrue(res);
|
|
|
|
|
Py_DECREF(res);
|
2010-05-09 15:52:27 +00:00
|
|
|
return result;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define slot_mp_length slot_sq_length
|
|
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
SLOT1(slot_mp_subscript, __getitem__, PyObject *)
|
2001-08-02 04:15:00 +00:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
slot_mp_ass_subscript(PyObject *self, PyObject *key, PyObject *value)
|
|
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *stack[3];
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *res;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2019-06-13 11:26:44 +02:00
|
|
|
stack[0] = self;
|
|
|
|
|
stack[1] = key;
|
2017-01-11 00:07:40 +01:00
|
|
|
if (value == NULL) {
|
2022-02-08 13:39:07 -07:00
|
|
|
res = vectorcall_method(&_Py_ID(__delitem__), stack, 2);
|
2017-01-11 00:07:40 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2019-06-13 11:26:44 +02:00
|
|
|
stack[2] = value;
|
2022-02-08 13:39:07 -07:00
|
|
|
res = vectorcall_method(&_Py_ID(__setitem__), stack, 3);
|
2017-01-11 00:07:40 +01:00
|
|
|
}
|
2012-01-22 11:24:29 -05:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (res == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
Py_DECREF(res);
|
|
|
|
|
return 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
SLOT1BIN(slot_nb_add, nb_add, __add__, __radd__)
|
|
|
|
|
SLOT1BIN(slot_nb_subtract, nb_subtract, __sub__, __rsub__)
|
|
|
|
|
SLOT1BIN(slot_nb_multiply, nb_multiply, __mul__, __rmul__)
|
|
|
|
|
SLOT1BIN(slot_nb_matrix_multiply, nb_matrix_multiply, __matmul__, __rmatmul__)
|
|
|
|
|
SLOT1BIN(slot_nb_remainder, nb_remainder, __mod__, __rmod__)
|
|
|
|
|
SLOT1BIN(slot_nb_divmod, nb_divmod, __divmod__, __rdivmod__)
|
2001-08-08 22:26:22 +00:00
|
|
|
|
2002-07-17 16:30:39 +00:00
|
|
|
static PyObject *slot_nb_power(PyObject *, PyObject *, PyObject *);
|
2001-08-08 22:26:22 +00:00
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
SLOT1BINFULL(slot_nb_power_binary, slot_nb_power, nb_power, __pow__, __rpow__)
|
2001-08-08 22:26:22 +00:00
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
slot_nb_power(PyObject *self, PyObject *other, PyObject *modulus)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
if (modulus == Py_None)
|
|
|
|
|
return slot_nb_power_binary(self, other);
|
2025-04-16 18:32:41 +03:00
|
|
|
|
|
|
|
|
/* The following code is a copy of SLOT1BINFULL, but for three arguments. */
|
|
|
|
|
PyObject* stack[3];
|
|
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
|
|
|
|
int do_other = !Py_IS_TYPE(self, Py_TYPE(other)) &&
|
|
|
|
|
Py_TYPE(other)->tp_as_number != NULL &&
|
|
|
|
|
Py_TYPE(other)->tp_as_number->nb_power == slot_nb_power;
|
2010-05-09 15:52:27 +00:00
|
|
|
if (Py_TYPE(self)->tp_as_number != NULL &&
|
|
|
|
|
Py_TYPE(self)->tp_as_number->nb_power == slot_nb_power) {
|
2025-04-16 18:32:41 +03:00
|
|
|
PyObject *r;
|
|
|
|
|
if (do_other && PyType_IsSubtype(Py_TYPE(other), Py_TYPE(self))) {
|
|
|
|
|
int ok = method_is_overloaded(self, other, &_Py_ID(__rpow__));
|
|
|
|
|
if (ok < 0) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (ok) {
|
|
|
|
|
stack[0] = other;
|
|
|
|
|
stack[1] = self;
|
|
|
|
|
stack[2] = modulus;
|
|
|
|
|
r = vectorcall_maybe(tstate, &_Py_ID(__rpow__), stack, 3);
|
|
|
|
|
if (r != Py_NotImplemented)
|
|
|
|
|
return r;
|
|
|
|
|
Py_DECREF(r);
|
|
|
|
|
do_other = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
stack[0] = self;
|
|
|
|
|
stack[1] = other;
|
|
|
|
|
stack[2] = modulus;
|
|
|
|
|
r = vectorcall_maybe(tstate, &_Py_ID(__pow__), stack, 3);
|
|
|
|
|
if (r != Py_NotImplemented ||
|
|
|
|
|
Py_IS_TYPE(other, Py_TYPE(self)))
|
|
|
|
|
return r;
|
|
|
|
|
Py_DECREF(r);
|
|
|
|
|
}
|
|
|
|
|
if (do_other) {
|
|
|
|
|
stack[0] = other;
|
|
|
|
|
stack[1] = self;
|
|
|
|
|
stack[2] = modulus;
|
|
|
|
|
return vectorcall_maybe(tstate, &_Py_ID(__rpow__), stack, 3);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2011-08-10 20:28:54 -05:00
|
|
|
Py_RETURN_NOTIMPLEMENTED;
|
2001-08-08 22:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
SLOT0(slot_nb_negative, __neg__)
|
|
|
|
|
SLOT0(slot_nb_positive, __pos__)
|
|
|
|
|
SLOT0(slot_nb_absolute, __abs__)
|
2001-08-02 04:15:00 +00:00
|
|
|
|
|
|
|
|
static int
|
2006-11-28 19:15:13 +00:00
|
|
|
slot_nb_bool(PyObject *self)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
int using_len = 0;
|
2025-03-26 14:38:47 -04:00
|
|
|
int attr_is_none = 0;
|
|
|
|
|
PyObject *value = maybe_call_special_no_args(self, &_Py_ID(__bool__),
|
|
|
|
|
&attr_is_none);
|
|
|
|
|
if (attr_is_none) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"'%.200s' cannot be interpreted as a boolean",
|
|
|
|
|
Py_TYPE(self)->tp_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
else if (value == NULL && !PyErr_Occurred()) {
|
|
|
|
|
value = _PyObject_MaybeCallSpecialNoArgs(self, &_Py_ID(__len__));
|
|
|
|
|
if (value == NULL && !PyErr_Occurred()) {
|
2016-08-19 18:26:05 +02:00
|
|
|
return 1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
using_len = 1;
|
|
|
|
|
}
|
2016-08-19 18:26:05 +02:00
|
|
|
|
|
|
|
|
if (value == NULL) {
|
2025-03-26 14:38:47 -04:00
|
|
|
return -1;
|
2016-08-19 18:26:05 +02:00
|
|
|
}
|
|
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
int result;
|
2016-08-19 18:26:05 +02:00
|
|
|
if (using_len) {
|
|
|
|
|
/* bool type enforced by slot_nb_len */
|
|
|
|
|
result = PyObject_IsTrue(value);
|
|
|
|
|
}
|
|
|
|
|
else if (PyBool_Check(value)) {
|
|
|
|
|
result = PyObject_IsTrue(value);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2016-08-19 18:26:05 +02:00
|
|
|
else {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"__bool__ should return "
|
|
|
|
|
"bool, returned %s",
|
|
|
|
|
Py_TYPE(value)->tp_name);
|
|
|
|
|
result = -1;
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(value);
|
2010-05-09 15:52:27 +00:00
|
|
|
return result;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2006-03-07 18:50:55 +00:00
|
|
|
|
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
which unfortunately means the errors from the bytes type change somewhat:
bytes([300]) still raises a ValueError, but bytes([10**100]) now raises a
TypeError (either that, or bytes(1.0) also raises a ValueError --
PyNumber_AsSsize_t() can only raise one type of exception.)
Merged revisions 51188-51433 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r51189 | kurt.kaiser | 2006-08-10 19:11:09 +0200 (Thu, 10 Aug 2006) | 4 lines
Retrieval of previous shell command was not always preserving indentation
since 1.2a1) Patch 1528468 Tal Einat.
........
r51190 | guido.van.rossum | 2006-08-10 19:41:07 +0200 (Thu, 10 Aug 2006) | 3 lines
Chris McDonough's patch to defend against certain DoS attacks on FieldStorage.
SF bug #1112549.
........
r51191 | guido.van.rossum | 2006-08-10 19:42:50 +0200 (Thu, 10 Aug 2006) | 2 lines
News item for SF bug 1112549.
........
r51192 | guido.van.rossum | 2006-08-10 20:09:25 +0200 (Thu, 10 Aug 2006) | 2 lines
Fix title -- it's rc1, not beta3.
........
r51194 | martin.v.loewis | 2006-08-10 21:04:00 +0200 (Thu, 10 Aug 2006) | 3 lines
Update dangling references to the 3.2 database to
mention that this is UCD 4.1 now.
........
r51195 | tim.peters | 2006-08-11 00:45:34 +0200 (Fri, 11 Aug 2006) | 6 lines
Followup to bug #1069160.
PyThreadState_SetAsyncExc(): internal correctness changes wrt
refcount safety and deadlock avoidance. Also added a basic test
case (relying on ctypes) and repaired the docs.
........
r51196 | tim.peters | 2006-08-11 00:48:45 +0200 (Fri, 11 Aug 2006) | 2 lines
Whitespace normalization.
........
r51197 | tim.peters | 2006-08-11 01:22:13 +0200 (Fri, 11 Aug 2006) | 5 lines
Whitespace normalization broke test_cgi, because a line
of quoted test data relied on preserving a single trailing
blank. Changed the string from raw to regular, and forced
in the trailing blank via an explicit \x20 escape.
........
r51198 | tim.peters | 2006-08-11 02:49:01 +0200 (Fri, 11 Aug 2006) | 10 lines
test_PyThreadState_SetAsyncExc(): This is failing on some
64-bit boxes. I have no idea what the ctypes docs mean
by "integers", and blind-guessing here that it intended to
mean the signed C "int" type, in which case perhaps I can
repair this by feeding the thread id argument to type
ctypes.c_long().
Also made the worker thread daemonic, so it doesn't hang
Python shutdown if the test continues to fail.
........
r51199 | tim.peters | 2006-08-11 05:49:10 +0200 (Fri, 11 Aug 2006) | 6 lines
force_test_exit(): This has been completely ineffective
at stopping test_signal from hanging forever on the Tru64
buildbot. That could be because there's no such thing as
signal.SIGALARM. Changed to the idiotic (but standard)
signal.SIGALRM instead, and added some more debug output.
........
r51202 | neal.norwitz | 2006-08-11 08:09:41 +0200 (Fri, 11 Aug 2006) | 6 lines
Fix the failures on cygwin (2006-08-10 fixed the actual locking issue).
The first hunk changes the colon to an ! like other Windows variants.
We need to always wait on the child so the lock gets released and
no other tests fail. This is the try/finally in the second hunk.
........
r51205 | georg.brandl | 2006-08-11 09:15:38 +0200 (Fri, 11 Aug 2006) | 3 lines
Add Chris McDonough (latest cgi.py patch)
........
r51206 | georg.brandl | 2006-08-11 09:26:10 +0200 (Fri, 11 Aug 2006) | 3 lines
logging's atexit hook now runs even if the rest of the module has
already been cleaned up.
........
r51212 | thomas.wouters | 2006-08-11 17:02:39 +0200 (Fri, 11 Aug 2006) | 4 lines
Add ignore of *.pyc and *.pyo to Lib/xml/etree/.
........
r51215 | thomas.heller | 2006-08-11 21:55:35 +0200 (Fri, 11 Aug 2006) | 7 lines
When a ctypes C callback function is called, zero out the result
storage before converting the result to C data. See the comment in
the code for details.
Provide a better context for errors when the conversion of a callback
function's result cannot be converted.
........
r51218 | neal.norwitz | 2006-08-12 03:43:40 +0200 (Sat, 12 Aug 2006) | 6 lines
Klocwork made another run and found a bunch more problems.
This is the first batch of fixes that should be easy to verify based on context.
This fixes problem numbers: 220 (ast), 323-324 (symtable),
321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree).
........
r51219 | neal.norwitz | 2006-08-12 03:45:47 +0200 (Sat, 12 Aug 2006) | 9 lines
Even though _Py_Mangle() isn't truly public anyone can call it and
there was no verification that privateobj was a PyString. If it wasn't
a string, this could have allowed a NULL pointer to creep in below and crash.
I wonder if this should be PyString_CheckExact? Must identifiers be strings
or can they be subclasses?
Klocwork #275
........
r51220 | neal.norwitz | 2006-08-12 03:46:42 +0200 (Sat, 12 Aug 2006) | 5 lines
It's highly unlikely, though possible for PyEval_Get*() to return NULLs.
So be safe and do an XINCREF.
Klocwork # 221-222.
........
r51221 | neal.norwitz | 2006-08-12 03:47:59 +0200 (Sat, 12 Aug 2006) | 7 lines
This code is actually not used unless WITHOUT_COMPLEX is defined.
However, there was no error checking that PyFloat_FromDouble returned
a valid pointer. I believe this change is correct as it seemed
to follow other code in the area.
Klocwork # 292.
........
r51222 | neal.norwitz | 2006-08-12 03:49:12 +0200 (Sat, 12 Aug 2006) | 5 lines
Handle NULL nodes while parsing. I'm not entirely sure this is correct.
There might be something else that needs to be done to setup the error.
Klocwork #295.
........
r51223 | neal.norwitz | 2006-08-12 03:50:38 +0200 (Sat, 12 Aug 2006) | 6 lines
If _stat_float_times is false, we will try to INCREF ival which could be NULL.
Return early in that case. The caller checks for PyErr_Occurred so this
should be ok.
Klocwork #297
........
r51224 | neal.norwitz | 2006-08-12 03:51:12 +0200 (Sat, 12 Aug 2006) | 3 lines
Move the assert which checks for a NULL pointer first.
Klocwork #274.
........
r51225 | neal.norwitz | 2006-08-12 03:53:28 +0200 (Sat, 12 Aug 2006) | 5 lines
Try to handle a malloc failure. I'm not entirely sure this is correct.
There might be something else we need to do to handle the exception.
Klocwork # 212-213
........
r51226 | neal.norwitz | 2006-08-12 03:57:47 +0200 (Sat, 12 Aug 2006) | 6 lines
I'm not sure why this code allocates this string for the error message.
I think it would be better to always use snprintf and have the format
limit the size of the name appropriately (like %.200s).
Klocwork #340
........
r51227 | neal.norwitz | 2006-08-12 04:06:34 +0200 (Sat, 12 Aug 2006) | 3 lines
Check returned pointer is valid.
Klocwork #233
........
r51228 | neal.norwitz | 2006-08-12 04:12:30 +0200 (Sat, 12 Aug 2006) | 1 line
Whoops, how did that get in there. :-) Revert all the parts of 51227 that were not supposed to go it. Only Modules/_ctypes/cfields.c was supposed to be changed
........
r51229 | neal.norwitz | 2006-08-12 04:33:36 +0200 (Sat, 12 Aug 2006) | 4 lines
Don't deref v if it's NULL.
Klocwork #214
........
r51230 | neal.norwitz | 2006-08-12 05:16:54 +0200 (Sat, 12 Aug 2006) | 5 lines
Check return of PyMem_MALLOC (garbage) is non-NULL.
Check seq in both portions of if/else.
Klocwork #289-290.
........
r51231 | neal.norwitz | 2006-08-12 05:17:41 +0200 (Sat, 12 Aug 2006) | 4 lines
PyModule_GetDict() can fail, produce fatal errors if this happens on startup.
Klocwork #298-299.
........
r51232 | neal.norwitz | 2006-08-12 05:18:50 +0200 (Sat, 12 Aug 2006) | 5 lines
Verify verdat which is returned from malloc is not NULL.
Ensure we don't pass NULL to free.
Klocwork #306 (at least the first part, checking malloc)
........
r51233 | tim.peters | 2006-08-12 06:42:47 +0200 (Sat, 12 Aug 2006) | 35 lines
test_signal: Signal handling on the Tru64 buildbot
appears to be utterly insane. Plug some theoretical
insecurities in the test script:
- Verify that the SIGALRM handler was actually installed.
- Don't call alarm() before the handler is installed.
- Move everything that can fail inside the try/finally,
so the test cleans up after itself more often.
- Try sending all the expected signals in
force_test_exit(), not just SIGALRM. Since that was
fixed to actually send SIGALRM (instead of invisibly
dying with an AttributeError), we've seen that sending
SIGALRM alone does not stop this from hanging.
- Move the "kill the child" business into the finally
clause, so the child doesn't survive test failure
to send SIGALRM to other tests later (there are also
baffling SIGALRM-related failures in test_socket).
- Cancel the alarm in the finally clause -- if the
test dies early, we again don't want SIGALRM showing
up to confuse a later test.
Alas, this still relies on timing luck wrt the spawned
script that sends the test signals, but it's hard to see
how waiting for seconds can so often be so unlucky.
test_threadedsignals: curiously, this test never fails
on Tru64, but doesn't normally signal SIGALRM. Anyway,
fixed an obvious (but probably inconsequential) logic
error.
........
r51234 | tim.peters | 2006-08-12 07:17:41 +0200 (Sat, 12 Aug 2006) | 8 lines
Ah, fudge. One of the prints here actually "shouldn't be"
protected by "if verbose:", which caused the test to fail on
all non-Windows boxes.
Note that I deliberately didn't convert this to unittest yet,
because I expect it would be even harder to debug this on Tru64
after conversion.
........
r51235 | georg.brandl | 2006-08-12 10:32:02 +0200 (Sat, 12 Aug 2006) | 3 lines
Repair logging test spew caused by rev. 51206.
........
r51236 | neal.norwitz | 2006-08-12 19:03:09 +0200 (Sat, 12 Aug 2006) | 8 lines
Patch #1538606, Patch to fix __index__() clipping.
I modified this patch some by fixing style, some error checking, and adding
XXX comments. This patch requires review and some changes are to be expected.
I'm checking in now to get the greatest possible review and establish a
baseline for moving forward. I don't want this to hold up release if possible.
........
r51238 | neal.norwitz | 2006-08-12 20:44:06 +0200 (Sat, 12 Aug 2006) | 10 lines
Fix a couple of bugs exposed by the new __index__ code. The 64-bit buildbots
were failing due to inappropriate clipping of numbers larger than 2**31
with new-style classes. (typeobject.c) In reviewing the code for classic
classes, there were 2 problems. Any negative value return could be returned.
Always return -1 if there was an error. Also make the checks similar
with the new-style classes. I believe this is correct for 32 and 64 bit
boxes, including Windows64.
Add a test of classic classes too.
........
r51240 | neal.norwitz | 2006-08-13 02:20:49 +0200 (Sun, 13 Aug 2006) | 1 line
SF bug #1539336, distutils example code missing
........
r51245 | neal.norwitz | 2006-08-13 20:10:10 +0200 (Sun, 13 Aug 2006) | 6 lines
Move/copy assert for tstate != NULL before first use.
Verify that PyEval_Get{Globals,Locals} returned valid pointers.
Klocwork 231-232
........
r51246 | neal.norwitz | 2006-08-13 20:10:28 +0200 (Sun, 13 Aug 2006) | 5 lines
Handle a whole lot of failures from PyString_FromInternedString().
Should fix most of Klocwork 234-272.
........
r51247 | neal.norwitz | 2006-08-13 20:10:47 +0200 (Sun, 13 Aug 2006) | 8 lines
cpathname could be NULL if it was longer than MAXPATHLEN. Don't try
to write the .pyc to NULL.
Check results of PyList_GetItem() and PyModule_GetDict() are not NULL.
Klocwork 282, 283, 285
........
r51248 | neal.norwitz | 2006-08-13 20:11:08 +0200 (Sun, 13 Aug 2006) | 6 lines
Fix segfault when doing string formatting on subclasses of long if
__oct__, __hex__ don't return a string.
Klocwork 308
........
r51250 | neal.norwitz | 2006-08-13 20:11:27 +0200 (Sun, 13 Aug 2006) | 5 lines
Check return result of PyModule_GetDict().
Fix a bunch of refleaks in the init of the module. This would only be found
when running python -v.
........
r51251 | neal.norwitz | 2006-08-13 20:11:43 +0200 (Sun, 13 Aug 2006) | 5 lines
Handle malloc and fopen failures more gracefully.
Klocwork 180-181
........
r51252 | neal.norwitz | 2006-08-13 20:12:03 +0200 (Sun, 13 Aug 2006) | 7 lines
It's very unlikely, though possible that source is not a string. Verify
that PyString_AsString() returns a valid pointer. (The problem can
arise when zlib.decompress doesn't return a string.)
Klocwork 346
........
r51253 | neal.norwitz | 2006-08-13 20:12:26 +0200 (Sun, 13 Aug 2006) | 5 lines
Handle failures from lookup.
Klocwork 341-342
........
r51254 | neal.norwitz | 2006-08-13 20:12:45 +0200 (Sun, 13 Aug 2006) | 6 lines
Handle failure from PyModule_GetDict() (Klocwork 208).
Fix a bunch of refleaks in the init of the module. This would only be found
when running python -v.
........
r51255 | neal.norwitz | 2006-08-13 20:13:02 +0200 (Sun, 13 Aug 2006) | 4 lines
Really address the issue of where to place the assert for leftblock.
(Followup of Klocwork 274)
........
r51256 | neal.norwitz | 2006-08-13 20:13:36 +0200 (Sun, 13 Aug 2006) | 4 lines
Handle malloc failure.
Klocwork 281
........
r51258 | neal.norwitz | 2006-08-13 20:40:39 +0200 (Sun, 13 Aug 2006) | 4 lines
Handle alloca failures.
Klocwork 225-228
........
r51259 | neal.norwitz | 2006-08-13 20:41:15 +0200 (Sun, 13 Aug 2006) | 1 line
Get rid of compiler warning
........
r51261 | neal.norwitz | 2006-08-14 02:51:15 +0200 (Mon, 14 Aug 2006) | 1 line
Ignore pgen.exe and kill_python.exe for cygwin
........
r51262 | neal.norwitz | 2006-08-14 02:59:03 +0200 (Mon, 14 Aug 2006) | 4 lines
Can't return NULL from a void function. If there is a memory error,
about the best we can do is call PyErr_WriteUnraisable and go on.
We won't be able to do the call below either, so verify delstr is valid.
........
r51263 | neal.norwitz | 2006-08-14 03:49:54 +0200 (Mon, 14 Aug 2006) | 1 line
Update purify doc some.
........
r51264 | thomas.heller | 2006-08-14 09:13:05 +0200 (Mon, 14 Aug 2006) | 2 lines
Remove unused, buggy test function.
Fixes klockwork issue #207.
........
r51265 | thomas.heller | 2006-08-14 09:14:09 +0200 (Mon, 14 Aug 2006) | 2 lines
Check for NULL return value from new_CArgObject().
Fixes klockwork issues #183, #184, #185.
........
r51266 | thomas.heller | 2006-08-14 09:50:14 +0200 (Mon, 14 Aug 2006) | 2 lines
Check for NULL return value of GenericCData_new().
Fixes klockwork issues #188, #189.
........
r51274 | thomas.heller | 2006-08-14 12:02:24 +0200 (Mon, 14 Aug 2006) | 2 lines
Revert the change that tries to zero out a closure's result storage
area because the size if unknown in source/callproc.c.
........
r51276 | marc-andre.lemburg | 2006-08-14 12:55:19 +0200 (Mon, 14 Aug 2006) | 11 lines
Slightly revised version of patch #1538956:
Replace UnicodeDecodeErrors raised during == and !=
compares of Unicode and other objects with a new
UnicodeWarning.
All other comparisons continue to raise exceptions.
Exceptions other than UnicodeDecodeErrors are also left
untouched.
........
r51277 | thomas.heller | 2006-08-14 13:17:48 +0200 (Mon, 14 Aug 2006) | 13 lines
Apply the patch #1532975 plus ideas from the patch #1533481.
ctypes instances no longer have the internal and undocumented
'_as_parameter_' attribute which was used to adapt them to foreign
function calls; this mechanism is replaced by a function pointer in
the type's stgdict.
In the 'from_param' class methods, try the _as_parameter_ attribute if
other conversions are not possible.
This makes the documented _as_parameter_ mechanism work as intended.
Change the ctypes version number to 1.0.1.
........
r51278 | marc-andre.lemburg | 2006-08-14 13:44:34 +0200 (Mon, 14 Aug 2006) | 3 lines
Readd NEWS items that were accidentally removed by r51276.
........
r51279 | georg.brandl | 2006-08-14 14:36:06 +0200 (Mon, 14 Aug 2006) | 3 lines
Improve markup in PyUnicode_RichCompare.
........
r51280 | marc-andre.lemburg | 2006-08-14 14:57:27 +0200 (Mon, 14 Aug 2006) | 3 lines
Correct an accidentally removed previous patch.
........
r51281 | thomas.heller | 2006-08-14 18:17:41 +0200 (Mon, 14 Aug 2006) | 3 lines
Patch #1536908: Add support for AMD64 / OpenBSD.
Remove the -no-stack-protector compiler flag for OpenBSD
as it has been reported to be unneeded.
........
r51282 | thomas.heller | 2006-08-14 18:20:04 +0200 (Mon, 14 Aug 2006) | 1 line
News item for rev 51281.
........
r51283 | georg.brandl | 2006-08-14 22:25:39 +0200 (Mon, 14 Aug 2006) | 3 lines
Fix refleak introduced in rev. 51248.
........
r51284 | georg.brandl | 2006-08-14 23:34:08 +0200 (Mon, 14 Aug 2006) | 5 lines
Make tabnanny recognize IndentationErrors raised by tokenize.
Add a test to test_inspect to make sure indented source
is recognized correctly. (fixes #1224621)
........
r51285 | georg.brandl | 2006-08-14 23:42:55 +0200 (Mon, 14 Aug 2006) | 3 lines
Patch #1535500: fix segfault in BZ2File.writelines and make sure it
raises the correct exceptions.
........
r51287 | georg.brandl | 2006-08-14 23:45:32 +0200 (Mon, 14 Aug 2006) | 3 lines
Add an additional test: BZ2File write methods should raise IOError
when file is read-only.
........
r51289 | georg.brandl | 2006-08-14 23:55:28 +0200 (Mon, 14 Aug 2006) | 3 lines
Patch #1536071: trace.py should now find the full module name of a
file correctly even on Windows.
........
r51290 | georg.brandl | 2006-08-15 00:01:24 +0200 (Tue, 15 Aug 2006) | 3 lines
Cookie.py shouldn't "bogusly" use string._idmap.
........
r51291 | georg.brandl | 2006-08-15 00:10:24 +0200 (Tue, 15 Aug 2006) | 3 lines
Patch #1511317: don't crash on invalid hostname info
........
r51292 | tim.peters | 2006-08-15 02:25:04 +0200 (Tue, 15 Aug 2006) | 2 lines
Whitespace normalization.
........
r51293 | neal.norwitz | 2006-08-15 06:14:57 +0200 (Tue, 15 Aug 2006) | 3 lines
Georg fixed one of my bugs, so I'll repay him with 2 NEWS entries.
Now we're even. :-)
........
r51295 | neal.norwitz | 2006-08-15 06:58:28 +0200 (Tue, 15 Aug 2006) | 8 lines
Fix the test for SocketServer so it should pass on cygwin and not fail
sporadically on other platforms. This is really a band-aid that doesn't
fix the underlying issue in SocketServer. It's not clear if it's worth
it to fix SocketServer, however, I opened a bug to track it:
http://python.org/sf/1540386
........
r51296 | neal.norwitz | 2006-08-15 06:59:30 +0200 (Tue, 15 Aug 2006) | 3 lines
Update the docstring to use a version a little newer than 1999. This was
taken from a Debian patch. Should we update the version for each release?
........
r51298 | neal.norwitz | 2006-08-15 08:29:03 +0200 (Tue, 15 Aug 2006) | 2 lines
Subclasses of int/long are allowed to define an __index__.
........
r51300 | thomas.heller | 2006-08-15 15:07:21 +0200 (Tue, 15 Aug 2006) | 1 line
Check for NULL return value from new_CArgObject calls.
........
r51303 | kurt.kaiser | 2006-08-16 05:15:26 +0200 (Wed, 16 Aug 2006) | 2 lines
The 'with' statement is now a Code Context block opener
........
r51304 | anthony.baxter | 2006-08-16 05:42:26 +0200 (Wed, 16 Aug 2006) | 1 line
preparing for 2.5c1
........
r51305 | anthony.baxter | 2006-08-16 05:58:37 +0200 (Wed, 16 Aug 2006) | 1 line
preparing for 2.5c1 - no, really this time
........
r51306 | kurt.kaiser | 2006-08-16 07:01:42 +0200 (Wed, 16 Aug 2006) | 9 lines
Patch #1540892: site.py Quitter() class attempts to close sys.stdin
before raising SystemExit, allowing IDLE to honor quit() and exit().
M Lib/site.py
M Lib/idlelib/PyShell.py
M Lib/idlelib/CREDITS.txt
M Lib/idlelib/NEWS.txt
M Misc/NEWS
........
r51307 | ka-ping.yee | 2006-08-16 09:02:50 +0200 (Wed, 16 Aug 2006) | 6 lines
Update code and tests to support the 'bytes_le' attribute (for
little-endian byte order on Windows), and to work around clocks
with low resolution yielding duplicate UUIDs.
Anthony Baxter has approved this change.
........
r51308 | kurt.kaiser | 2006-08-16 09:04:17 +0200 (Wed, 16 Aug 2006) | 2 lines
Get quit() and exit() to work cleanly when not using subprocess.
........
r51309 | marc-andre.lemburg | 2006-08-16 10:13:26 +0200 (Wed, 16 Aug 2006) | 2 lines
Revert to having static version numbers again.
........
r51310 | martin.v.loewis | 2006-08-16 14:55:10 +0200 (Wed, 16 Aug 2006) | 2 lines
Build _hashlib on Windows. Build OpenSSL with masm assembler code.
Fixes #1535502.
........
r51311 | thomas.heller | 2006-08-16 15:03:11 +0200 (Wed, 16 Aug 2006) | 6 lines
Add commented assert statements to check that the result of
PyObject_stgdict() and PyType_stgdict() calls are non-NULL before
dereferencing the result. Hopefully this fixes what klocwork is
complaining about.
Fix a few other nits as well.
........
r51312 | anthony.baxter | 2006-08-16 15:08:25 +0200 (Wed, 16 Aug 2006) | 1 line
news entry for 51307
........
r51313 | andrew.kuchling | 2006-08-16 15:22:20 +0200 (Wed, 16 Aug 2006) | 1 line
Add UnicodeWarning
........
r51314 | andrew.kuchling | 2006-08-16 15:41:52 +0200 (Wed, 16 Aug 2006) | 1 line
Bump document version to 1.0; remove pystone paragraph
........
r51315 | andrew.kuchling | 2006-08-16 15:51:32 +0200 (Wed, 16 Aug 2006) | 1 line
Link to docs; remove an XXX comment
........
r51316 | martin.v.loewis | 2006-08-16 15:58:51 +0200 (Wed, 16 Aug 2006) | 1 line
Make cl build step compile-only (/c). Remove libs from source list.
........
r51317 | thomas.heller | 2006-08-16 16:07:44 +0200 (Wed, 16 Aug 2006) | 5 lines
The __repr__ method of a NULL py_object does no longer raise an
exception. Remove a stray '?' character from the exception text
when the value is retrieved of such an object.
Includes tests.
........
r51318 | andrew.kuchling | 2006-08-16 16:18:23 +0200 (Wed, 16 Aug 2006) | 1 line
Update bug/patch counts
........
r51319 | andrew.kuchling | 2006-08-16 16:21:14 +0200 (Wed, 16 Aug 2006) | 1 line
Wording/typo fixes
........
r51320 | thomas.heller | 2006-08-16 17:10:12 +0200 (Wed, 16 Aug 2006) | 9 lines
Remove the special casing of Py_None when converting the return value
of the Python part of a callback function to C. If it cannot be
converted, call PyErr_WriteUnraisable with the exception we got.
Before, arbitrary data has been passed to the calling C code in this
case.
(I'm not really sure the NEWS entry is understandable, but I cannot
find better words)
........
r51321 | marc-andre.lemburg | 2006-08-16 18:11:01 +0200 (Wed, 16 Aug 2006) | 2 lines
Add NEWS item mentioning the reverted distutils version number patch.
........
r51322 | fredrik.lundh | 2006-08-16 18:47:07 +0200 (Wed, 16 Aug 2006) | 5 lines
SF#1534630
ignore data that arrives before the opening start tag
........
r51324 | andrew.kuchling | 2006-08-16 19:11:18 +0200 (Wed, 16 Aug 2006) | 1 line
Grammar fix
........
r51328 | thomas.heller | 2006-08-16 20:02:11 +0200 (Wed, 16 Aug 2006) | 12 lines
Tutorial:
Clarify somewhat how parameters are passed to functions
(especially explain what integer means).
Correct the table - Python integers and longs can both be used.
Further clarification to the table comparing ctypes types, Python
types, and C types.
Reference:
Replace integer by C ``int`` where it makes sense.
........
r51329 | kurt.kaiser | 2006-08-16 23:45:59 +0200 (Wed, 16 Aug 2006) | 8 lines
File menu hotkeys: there were three 'p' assignments. Reassign the
'Save Copy As' and 'Print' hotkeys to 'y' and 't'. Change the
Shell menu hotkey from 's' to 'l'.
M Bindings.py
M PyShell.py
M NEWS.txt
........
r51330 | neil.schemenauer | 2006-08-17 01:38:05 +0200 (Thu, 17 Aug 2006) | 3 lines
Fix a bug in the ``compiler`` package that caused invalid code to be
generated for generator expressions.
........
r51342 | martin.v.loewis | 2006-08-17 21:19:32 +0200 (Thu, 17 Aug 2006) | 3 lines
Merge 51340 and 51341 from 2.5 branch:
Leave tk build directory to restore original path.
Invoke debug mk1mf.pl after running Configure.
........
r51354 | martin.v.loewis | 2006-08-18 05:47:18 +0200 (Fri, 18 Aug 2006) | 3 lines
Bug #1541863: uuid.uuid1 failed to generate unique identifiers
on systems with low clock resolution.
........
r51355 | neal.norwitz | 2006-08-18 05:57:54 +0200 (Fri, 18 Aug 2006) | 1 line
Add template for 2.6 on HEAD
........
r51356 | neal.norwitz | 2006-08-18 06:01:38 +0200 (Fri, 18 Aug 2006) | 1 line
More post-release wibble
........
r51357 | neal.norwitz | 2006-08-18 06:58:33 +0200 (Fri, 18 Aug 2006) | 1 line
Try to get Windows bots working again
........
r51358 | neal.norwitz | 2006-08-18 07:10:00 +0200 (Fri, 18 Aug 2006) | 1 line
Try to get Windows bots working again. Take 2
........
r51359 | neal.norwitz | 2006-08-18 07:39:20 +0200 (Fri, 18 Aug 2006) | 1 line
Try to get Unix bots install working again.
........
r51360 | neal.norwitz | 2006-08-18 07:41:46 +0200 (Fri, 18 Aug 2006) | 1 line
Set version to 2.6a0, seems more consistent.
........
r51362 | neal.norwitz | 2006-08-18 08:14:52 +0200 (Fri, 18 Aug 2006) | 1 line
More version wibble
........
r51364 | georg.brandl | 2006-08-18 09:27:59 +0200 (Fri, 18 Aug 2006) | 4 lines
Bug #1541682: Fix example in the "Refcount details" API docs.
Additionally, remove a faulty example showing PySequence_SetItem applied
to a newly created list object and add notes that this isn't a good idea.
........
r51366 | anthony.baxter | 2006-08-18 09:29:02 +0200 (Fri, 18 Aug 2006) | 3 lines
Updating IDLE's version number to match Python's (as per python-dev
discussion).
........
r51367 | anthony.baxter | 2006-08-18 09:30:07 +0200 (Fri, 18 Aug 2006) | 1 line
RPM specfile updates
........
r51368 | georg.brandl | 2006-08-18 09:35:47 +0200 (Fri, 18 Aug 2006) | 2 lines
Typo in tp_clear docs.
........
r51378 | andrew.kuchling | 2006-08-18 15:57:13 +0200 (Fri, 18 Aug 2006) | 1 line
Minor edits
........
r51379 | thomas.heller | 2006-08-18 16:38:46 +0200 (Fri, 18 Aug 2006) | 6 lines
Add asserts to check for 'impossible' NULL values, with comments.
In one place where I'n not 1000% sure about the non-NULL, raise
a RuntimeError for safety.
This should fix the klocwork issues that Neal sent me. If so,
it should be applied to the release25-maint branch also.
........
r51400 | neal.norwitz | 2006-08-19 06:22:33 +0200 (Sat, 19 Aug 2006) | 5 lines
Move initialization of interned strings to before allocating the
object so we don't leak op. (Fixes an earlier patch to this code)
Klockwork #350
........
r51401 | neal.norwitz | 2006-08-19 06:23:04 +0200 (Sat, 19 Aug 2006) | 4 lines
Move assert to after NULL check, otherwise we deref NULL in the assert.
Klocwork #307
........
r51402 | neal.norwitz | 2006-08-19 06:25:29 +0200 (Sat, 19 Aug 2006) | 2 lines
SF #1542693: Remove semi-colon at end of PyImport_ImportModuleEx macro
........
r51403 | neal.norwitz | 2006-08-19 06:28:55 +0200 (Sat, 19 Aug 2006) | 6 lines
Move initialization to after the asserts for non-NULL values.
Klocwork 286-287.
(I'm not backporting this, but if someone wants to, feel free.)
........
r51404 | neal.norwitz | 2006-08-19 06:52:03 +0200 (Sat, 19 Aug 2006) | 6 lines
Handle PyString_FromInternedString() failing (unlikely, but possible).
Klocwork #325
(I'm not backporting this, but if someone wants to, feel free.)
........
r51416 | georg.brandl | 2006-08-20 15:15:39 +0200 (Sun, 20 Aug 2006) | 2 lines
Patch #1542948: fix urllib2 header casing issue. With new test.
........
r51428 | jeremy.hylton | 2006-08-21 18:19:37 +0200 (Mon, 21 Aug 2006) | 3 lines
Move peephole optimizer to separate file.
........
r51429 | jeremy.hylton | 2006-08-21 18:20:29 +0200 (Mon, 21 Aug 2006) | 2 lines
Move peephole optimizer to separate file. (Forgot .h in previous checkin.)
........
r51432 | neal.norwitz | 2006-08-21 19:59:46 +0200 (Mon, 21 Aug 2006) | 5 lines
Fix bug #1543303, tarfile adds padding that breaks gunzip.
Patch # 1543897.
Will backport to 2.5
........
r51433 | neal.norwitz | 2006-08-21 20:01:30 +0200 (Mon, 21 Aug 2006) | 2 lines
Add assert to make Klocwork happy (#276)
........
2006-08-21 19:07:27 +00:00
|
|
|
static PyObject *
|
2006-03-07 18:50:55 +00:00
|
|
|
slot_nb_index(PyObject *self)
|
|
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *stack[1] = {self};
|
2022-02-08 13:39:07 -07:00
|
|
|
return vectorcall_method(&_Py_ID(__index__), stack, 1);
|
2006-03-07 18:50:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
SLOT0(slot_nb_invert, __invert__)
|
|
|
|
|
SLOT1BIN(slot_nb_lshift, nb_lshift, __lshift__, __rlshift__)
|
|
|
|
|
SLOT1BIN(slot_nb_rshift, nb_rshift, __rshift__, __rrshift__)
|
|
|
|
|
SLOT1BIN(slot_nb_and, nb_and, __and__, __rand__)
|
|
|
|
|
SLOT1BIN(slot_nb_xor, nb_xor, __xor__, __rxor__)
|
|
|
|
|
SLOT1BIN(slot_nb_or, nb_or, __or__, __ror__)
|
2001-09-27 20:30:07 +00:00
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
SLOT0(slot_nb_int, __int__)
|
|
|
|
|
SLOT0(slot_nb_float, __float__)
|
|
|
|
|
SLOT1(slot_nb_inplace_add, __iadd__, PyObject *)
|
|
|
|
|
SLOT1(slot_nb_inplace_subtract, __isub__, PyObject *)
|
|
|
|
|
SLOT1(slot_nb_inplace_multiply, __imul__, PyObject *)
|
|
|
|
|
SLOT1(slot_nb_inplace_matrix_multiply, __imatmul__, PyObject *)
|
|
|
|
|
SLOT1(slot_nb_inplace_remainder, __imod__, PyObject *)
|
Merged revisions 53623-53858 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r53624 | peter.astrand | 2007-02-02 20:06:36 +0100 (Fri, 02 Feb 2007) | 1 line
We had several if statements checking the value of a fd. This is unsafe, since valid fds might be zero. We should check for not None instead.
........
r53635 | kurt.kaiser | 2007-02-05 07:03:18 +0100 (Mon, 05 Feb 2007) | 2 lines
Add 'raw' support to configHandler. Patch 1650174 Tal Einat.
........
r53641 | kurt.kaiser | 2007-02-06 00:02:16 +0100 (Tue, 06 Feb 2007) | 5 lines
1. Calltips now 'handle' tuples in the argument list (display '<tuple>' :)
Suggested solution by Christos Georgiou, Bug 791968.
2. Clean up tests, were not failing when they should have been.
4. Remove some camelcase and an unneeded try/except block.
........
r53644 | kurt.kaiser | 2007-02-06 04:21:40 +0100 (Tue, 06 Feb 2007) | 2 lines
Clean up ModifiedInterpreter.runcode() structure
........
r53646 | peter.astrand | 2007-02-06 16:37:50 +0100 (Tue, 06 Feb 2007) | 1 line
Applied patch 1124861.3.patch to solve bug #1124861: Automatically create pipes on Windows, if GetStdHandle fails. Will backport.
........
r53648 | lars.gustaebel | 2007-02-06 19:38:13 +0100 (Tue, 06 Feb 2007) | 4 lines
Patch #1652681: create nonexistent files in append mode and
allow appending to empty files.
........
r53649 | kurt.kaiser | 2007-02-06 20:09:43 +0100 (Tue, 06 Feb 2007) | 4 lines
Updated patch (CodeContext.061217.patch) to
[ 1362975 ] CodeContext - Improved text indentation
Tal Einat 16Dec06
........
r53650 | kurt.kaiser | 2007-02-06 20:21:19 +0100 (Tue, 06 Feb 2007) | 2 lines
narrow exception per [ 1540849 ] except too broad
........
r53653 | kurt.kaiser | 2007-02-07 04:39:41 +0100 (Wed, 07 Feb 2007) | 4 lines
[ 1621265 ] Auto-completion list placement
Move AC window below input line unless not enough space, then put it above.
Patch: Tal Einat
........
r53654 | kurt.kaiser | 2007-02-07 09:07:13 +0100 (Wed, 07 Feb 2007) | 2 lines
Handle AttributeError during calltip lookup
........
r53656 | raymond.hettinger | 2007-02-07 21:08:22 +0100 (Wed, 07 Feb 2007) | 3 lines
SF #1615701: make d.update(m) honor __getitem__() and keys() in dict subclasses
........
r53658 | raymond.hettinger | 2007-02-07 22:04:20 +0100 (Wed, 07 Feb 2007) | 1 line
SF: 1397711 Set docs conflated immutable and hashable
........
r53660 | raymond.hettinger | 2007-02-07 22:42:17 +0100 (Wed, 07 Feb 2007) | 1 line
Check for a common user error with defaultdict().
........
r53662 | raymond.hettinger | 2007-02-07 23:24:07 +0100 (Wed, 07 Feb 2007) | 1 line
Bug #1575169: operator.isSequenceType() now returns False for subclasses of dict.
........
r53664 | raymond.hettinger | 2007-02-08 00:49:03 +0100 (Thu, 08 Feb 2007) | 1 line
Silence compiler warning
........
r53666 | raymond.hettinger | 2007-02-08 01:07:32 +0100 (Thu, 08 Feb 2007) | 1 line
Do not let overflows in enumerate() and count() pass silently.
........
r53668 | raymond.hettinger | 2007-02-08 01:50:39 +0100 (Thu, 08 Feb 2007) | 1 line
Bypass set specific optimizations for set and frozenset subclasses.
........
r53670 | raymond.hettinger | 2007-02-08 02:42:35 +0100 (Thu, 08 Feb 2007) | 1 line
Fix docstring bug
........
r53671 | martin.v.loewis | 2007-02-08 10:13:36 +0100 (Thu, 08 Feb 2007) | 3 lines
Bug #1653736: Complain about keyword arguments to time.isoformat.
Will backport to 2.5.
........
r53679 | kurt.kaiser | 2007-02-08 23:58:18 +0100 (Thu, 08 Feb 2007) | 6 lines
Corrected some bugs in AutoComplete. Also, Page Up/Down in ACW implemented;
mouse and cursor selection in ACWindow implemented; double Tab inserts current
selection and closes ACW (similar to double-click and Return); scroll wheel now
works in ACW. Added AutoComplete instructions to IDLE Help.
........
r53689 | martin.v.loewis | 2007-02-09 13:19:32 +0100 (Fri, 09 Feb 2007) | 3 lines
Bug #1653736: Properly discard third argument to slot_nb_inplace_power.
Will backport.
........
r53691 | martin.v.loewis | 2007-02-09 13:36:48 +0100 (Fri, 09 Feb 2007) | 4 lines
Bug #1600860: Search for shared python library in LIBDIR, not
lib/python/config, on "linux" and "gnu" systems.
Will backport.
........
r53693 | martin.v.loewis | 2007-02-09 13:58:49 +0100 (Fri, 09 Feb 2007) | 2 lines
Update broken link. Will backport to 2.5.
........
r53697 | georg.brandl | 2007-02-09 19:48:41 +0100 (Fri, 09 Feb 2007) | 2 lines
Bug #1656078: typo in in profile docs.
........
r53731 | brett.cannon | 2007-02-11 06:36:00 +0100 (Sun, 11 Feb 2007) | 3 lines
Change a very minor inconsistency (that is purely cosmetic) in the AST
definition.
........
r53735 | skip.montanaro | 2007-02-11 19:24:37 +0100 (Sun, 11 Feb 2007) | 1 line
fix trace.py --ignore-dir
........
r53741 | brett.cannon | 2007-02-11 20:44:41 +0100 (Sun, 11 Feb 2007) | 3 lines
Check in changed Python-ast.c from a cosmetic change to Python.asdl (in
r53731).
........
r53751 | brett.cannon | 2007-02-12 04:51:02 +0100 (Mon, 12 Feb 2007) | 5 lines
Modify Parser/asdl_c.py so that the __version__ number for Python/Python-ast.c
is specified at the top of the file. Also add a note that Python/Python-ast.c
needs to be committed separately after a change to the AST grammar to capture
the revision number of the change (which is what __version__ is set to).
........
r53752 | lars.gustaebel | 2007-02-12 10:25:53 +0100 (Mon, 12 Feb 2007) | 3 lines
Bug #1656581: Point out that external file objects are supposed to be
at position 0.
........
r53754 | martin.v.loewis | 2007-02-12 13:21:10 +0100 (Mon, 12 Feb 2007) | 3 lines
Patch 1463026: Support default namespace in XMLGenerator.
Fixes #847665. Will backport.
........
r53757 | armin.rigo | 2007-02-12 17:23:24 +0100 (Mon, 12 Feb 2007) | 4 lines
Fix the line to what is my guess at the original author's meaning.
(The line has no effect anyway, but is present because it's
customary call the base class __init__).
........
r53763 | martin.v.loewis | 2007-02-13 09:34:45 +0100 (Tue, 13 Feb 2007) | 3 lines
Patch #685268: Consider a package's __path__ in imputil.
Will backport.
........
r53765 | martin.v.loewis | 2007-02-13 10:49:38 +0100 (Tue, 13 Feb 2007) | 2 lines
Patch #698833: Support file decryption in zipfile.
........
r53766 | martin.v.loewis | 2007-02-13 11:10:39 +0100 (Tue, 13 Feb 2007) | 3 lines
Patch #1517891: Make 'a' create the file if it doesn't exist.
Fixes #1514451.
........
r53767 | martin.v.loewis | 2007-02-13 13:08:24 +0100 (Tue, 13 Feb 2007) | 3 lines
Bug #1658794: Remove extraneous 'this'.
Will backport to 2.5.
........
r53769 | martin.v.loewis | 2007-02-13 13:14:19 +0100 (Tue, 13 Feb 2007) | 3 lines
Patch #1657276: Make NETLINK_DNRTMSG conditional.
Will backport.
........
r53771 | lars.gustaebel | 2007-02-13 17:09:24 +0100 (Tue, 13 Feb 2007) | 4 lines
Patch #1647484: Renamed GzipFile's filename attribute to name. The
filename attribute is still accessible as a property that emits a
DeprecationWarning.
........
r53772 | lars.gustaebel | 2007-02-13 17:24:00 +0100 (Tue, 13 Feb 2007) | 3 lines
Strip the '.gz' extension from the filename that is written to the
gzip header.
........
r53774 | martin.v.loewis | 2007-02-14 11:07:37 +0100 (Wed, 14 Feb 2007) | 2 lines
Patch #1432399: Add HCI sockets.
........
r53775 | martin.v.loewis | 2007-02-14 12:30:07 +0100 (Wed, 14 Feb 2007) | 2 lines
Update 1432399 to removal of _BT_SOCKADDR_MEMB.
........
r53776 | martin.v.loewis | 2007-02-14 12:30:56 +0100 (Wed, 14 Feb 2007) | 3 lines
Ignore directory time stamps when considering
whether to rerun libffi configure.
........
r53778 | lars.gustaebel | 2007-02-14 15:45:12 +0100 (Wed, 14 Feb 2007) | 4 lines
A missing binary mode in AppendTest caused failures in Windows
Buildbot.
........
r53782 | martin.v.loewis | 2007-02-15 10:51:35 +0100 (Thu, 15 Feb 2007) | 2 lines
Patch #1397848: add the reasoning behind no-resize-on-shrinkage.
........
r53783 | georg.brandl | 2007-02-15 11:37:59 +0100 (Thu, 15 Feb 2007) | 2 lines
Make functools.wraps() docs a bit clearer.
........
r53785 | georg.brandl | 2007-02-15 12:29:04 +0100 (Thu, 15 Feb 2007) | 2 lines
Patch #1494140: Add documentation for the new struct.Struct object.
........
r53787 | georg.brandl | 2007-02-15 12:29:55 +0100 (Thu, 15 Feb 2007) | 2 lines
Add missing \versionadded.
........
r53800 | brett.cannon | 2007-02-15 23:54:39 +0100 (Thu, 15 Feb 2007) | 11 lines
Update the encoding package's search function to use absolute imports when
calling __import__. This helps make the expected search locations for encoding
modules be more explicit.
One could use an explicit value for __path__ when making the call to __import__
to force the exact location searched for encodings. This would give the most
strict search path possible if one is worried about malicious code being
imported. The unfortunate side-effect of that is that if __path__ was modified
on 'encodings' on purpose in a safe way it would not be picked up in future
__import__ calls.
........
r53801 | brett.cannon | 2007-02-16 20:33:01 +0100 (Fri, 16 Feb 2007) | 2 lines
Make the __import__ call in encodings.__init__ absolute with a level 0 call.
........
r53809 | vinay.sajip | 2007-02-16 23:36:24 +0100 (Fri, 16 Feb 2007) | 1 line
Minor fix for currentframe (SF #1652788).
........
r53818 | raymond.hettinger | 2007-02-19 03:03:19 +0100 (Mon, 19 Feb 2007) | 3 lines
Extend work on revision 52962: Eliminate redundant calls to PyObject_Hash().
........
r53820 | raymond.hettinger | 2007-02-19 05:08:43 +0100 (Mon, 19 Feb 2007) | 1 line
Add merge() function to heapq.
........
r53821 | raymond.hettinger | 2007-02-19 06:28:28 +0100 (Mon, 19 Feb 2007) | 1 line
Add tie-breaker count to preserve sort stability.
........
r53822 | raymond.hettinger | 2007-02-19 07:59:32 +0100 (Mon, 19 Feb 2007) | 1 line
Use C heapreplace() instead of slower _siftup() in pure python.
........
r53823 | raymond.hettinger | 2007-02-19 08:30:21 +0100 (Mon, 19 Feb 2007) | 1 line
Add test for merge stability
........
r53824 | raymond.hettinger | 2007-02-19 10:14:10 +0100 (Mon, 19 Feb 2007) | 1 line
Provide an example of defaultdict with non-zero constant factory function.
........
r53825 | lars.gustaebel | 2007-02-19 10:54:47 +0100 (Mon, 19 Feb 2007) | 2 lines
Moved misplaced news item.
........
r53826 | martin.v.loewis | 2007-02-19 11:55:19 +0100 (Mon, 19 Feb 2007) | 3 lines
Patch #1490190: posixmodule now includes os.chflags() and os.lchflags()
functions on platforms where the underlying system calls are available.
........
r53827 | raymond.hettinger | 2007-02-19 19:15:04 +0100 (Mon, 19 Feb 2007) | 1 line
Fixup docstrings for merge().
........
r53829 | raymond.hettinger | 2007-02-19 21:44:04 +0100 (Mon, 19 Feb 2007) | 1 line
Fixup set/dict interoperability.
........
r53837 | raymond.hettinger | 2007-02-21 06:20:38 +0100 (Wed, 21 Feb 2007) | 1 line
Add itertools.izip_longest().
........
r53838 | raymond.hettinger | 2007-02-21 18:22:05 +0100 (Wed, 21 Feb 2007) | 1 line
Remove filler struct item and fix leak.
........
2007-02-23 15:07:44 +00:00
|
|
|
/* Can't use SLOT1 here, because nb_inplace_power is ternary */
|
2010-05-09 15:52:27 +00:00
|
|
|
static PyObject *
|
|
|
|
|
slot_nb_inplace_power(PyObject *self, PyObject * arg1, PyObject *arg2)
|
|
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *stack[2] = {self, arg1};
|
2022-02-08 13:39:07 -07:00
|
|
|
return vectorcall_method(&_Py_ID(__ipow__), stack, 2);
|
|
|
|
|
}
|
|
|
|
|
SLOT1(slot_nb_inplace_lshift, __ilshift__, PyObject *)
|
|
|
|
|
SLOT1(slot_nb_inplace_rshift, __irshift__, PyObject *)
|
|
|
|
|
SLOT1(slot_nb_inplace_and, __iand__, PyObject *)
|
|
|
|
|
SLOT1(slot_nb_inplace_xor, __ixor__, PyObject *)
|
|
|
|
|
SLOT1(slot_nb_inplace_or, __ior__, PyObject *)
|
2001-08-08 22:26:22 +00:00
|
|
|
SLOT1BIN(slot_nb_floor_divide, nb_floor_divide,
|
2022-02-08 13:39:07 -07:00
|
|
|
__floordiv__, __rfloordiv__)
|
|
|
|
|
SLOT1BIN(slot_nb_true_divide, nb_true_divide, __truediv__, __rtruediv__)
|
|
|
|
|
SLOT1(slot_nb_inplace_floor_divide, __ifloordiv__, PyObject *)
|
|
|
|
|
SLOT1(slot_nb_inplace_true_divide, __itruediv__, PyObject *)
|
2001-08-02 04:15:00 +00:00
|
|
|
|
- Another big step in the right direction. All the overridable
operators for which a default implementation exist now work, both in
dynamic classes and in static classes, overridden or not. This
affects __repr__, __str__, __hash__, __contains__, __nonzero__,
__cmp__, and the rich comparisons (__lt__ etc.). For dynamic
classes, this meant copying a lot of code from classobject! (XXX
There are still some holes, because the comparison code in object.c
uses PyInstance_Check(), meaning new-style classes don't get the
same dispensation. This needs more thinking.)
- Add object.__hash__, object.__repr__, object.__str__. The __str__
dispatcher now calls the __repr__ dispatcher, as it should.
- For static classes, the tp_compare, tp_richcompare and tp_hash slots
are now inherited together, or not at all. (XXX I fear there are
still some situations where you can inherit __hash__ when you
shouldn't, but mostly it's OK now, and I think there's no way we can
get that 100% right.)
2001-08-15 23:57:02 +00:00
|
|
|
static PyObject *
|
|
|
|
|
slot_tp_repr(PyObject *self)
|
|
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
PyObject *res = _PyObject_MaybeCallSpecialNoArgs(self, &_Py_ID(__repr__));
|
|
|
|
|
if (res != NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return res;
|
|
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
else if (PyErr_Occurred()) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
return PyUnicode_FromFormat("<%s object at %p>",
|
2025-03-26 14:38:47 -04:00
|
|
|
Py_TYPE(self)->tp_name, self);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
SLOT0(slot_tp_str, __str__)
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2010-10-17 20:54:53 +00:00
|
|
|
static Py_hash_t
|
2001-08-02 04:15:00 +00:00
|
|
|
slot_tp_hash(PyObject *self)
|
|
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
PyObject *res;
|
|
|
|
|
int attr_is_none = 0;
|
|
|
|
|
res = maybe_call_special_no_args(self, &_Py_ID(__hash__), &attr_is_none);
|
|
|
|
|
if (attr_is_none || res == NULL) {
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
return PyObject_HashNotImplemented(self);
|
|
|
|
|
}
|
2010-05-23 13:33:13 +00:00
|
|
|
if (!PyLong_Check(res)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
|
"__hash__ method should return an integer");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2010-10-17 20:54:53 +00:00
|
|
|
/* Transform the PyLong `res` to a Py_hash_t `h`. For an existing
|
|
|
|
|
hashable Python object x, hash(x) will always lie within the range of
|
|
|
|
|
Py_hash_t. Therefore our transformation must preserve values that
|
|
|
|
|
already lie within this range, to ensure that if x.__hash__() returns
|
|
|
|
|
hash(y) then hash(x) == hash(y). */
|
2025-03-26 14:38:47 -04:00
|
|
|
Py_ssize_t h = PyLong_AsSsize_t(res);
|
2010-10-17 20:54:53 +00:00
|
|
|
if (h == -1 && PyErr_Occurred()) {
|
|
|
|
|
/* res was not within the range of a Py_hash_t, so we're free to
|
2010-05-23 13:33:13 +00:00
|
|
|
use any sufficiently bit-mixing transformation;
|
|
|
|
|
long.__hash__ will do nicely. */
|
2010-10-17 20:54:53 +00:00
|
|
|
PyErr_Clear();
|
2010-05-09 15:52:27 +00:00
|
|
|
h = PyLong_Type.tp_hash(res);
|
2010-10-17 20:54:53 +00:00
|
|
|
}
|
2010-10-17 21:27:01 +00:00
|
|
|
/* -1 is reserved for errors. */
|
|
|
|
|
if (h == -1)
|
|
|
|
|
h = -2;
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(res);
|
2010-05-23 13:33:13 +00:00
|
|
|
return h;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
slot_tp_call(PyObject *self, PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
return call_method(self, &_Py_ID(__call__), args, kwds);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-10-17 13:59:09 +00:00
|
|
|
/* There are two slot dispatch functions for tp_getattro.
|
|
|
|
|
|
2022-08-17 19:37:07 +08:00
|
|
|
- _Py_slot_tp_getattro() is used when __getattribute__ is overridden
|
2001-10-17 13:59:09 +00:00
|
|
|
but no __getattr__ hook is present;
|
|
|
|
|
|
2022-08-17 19:37:07 +08:00
|
|
|
- _Py_slot_tp_getattr_hook() is used when a __getattr__ hook is present.
|
2001-10-17 13:59:09 +00:00
|
|
|
|
2022-08-17 19:37:07 +08:00
|
|
|
The code in update_one_slot() always installs _Py_slot_tp_getattr_hook();
|
|
|
|
|
this detects the absence of __getattr__ and then installs the simpler
|
|
|
|
|
slot if necessary. */
|
2001-10-17 13:59:09 +00:00
|
|
|
|
2022-08-17 19:37:07 +08:00
|
|
|
PyObject *
|
|
|
|
|
_Py_slot_tp_getattro(PyObject *self, PyObject *name)
|
2001-08-02 04:15:00 +00:00
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *stack[2] = {self, name};
|
2022-02-08 13:39:07 -07:00
|
|
|
return vectorcall_method(&_Py_ID(__getattribute__), stack, 2);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-18 22:42:42 +08:00
|
|
|
static inline PyObject *
|
2008-11-17 22:45:50 +00:00
|
|
|
call_attribute(PyObject *self, PyObject *attr, PyObject *name)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *res, *descr = NULL;
|
2022-06-18 22:42:42 +08:00
|
|
|
|
|
|
|
|
if (_PyType_HasFeature(Py_TYPE(attr), Py_TPFLAGS_METHOD_DESCRIPTOR)) {
|
|
|
|
|
PyObject *args[] = { self, name };
|
|
|
|
|
res = PyObject_Vectorcall(attr, args, 2, NULL);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
descrgetfunc f = Py_TYPE(attr)->tp_descr_get;
|
2008-11-17 22:45:50 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (f != NULL) {
|
|
|
|
|
descr = f(attr, self, (PyObject *)(Py_TYPE(self)));
|
|
|
|
|
if (descr == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
attr = descr;
|
|
|
|
|
}
|
2020-02-11 17:46:57 +01:00
|
|
|
res = PyObject_CallOneArg(attr, name);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_XDECREF(descr);
|
|
|
|
|
return res;
|
2008-11-17 22:45:50 +00:00
|
|
|
}
|
|
|
|
|
|
2022-08-17 19:37:07 +08:00
|
|
|
PyObject *
|
|
|
|
|
_Py_slot_tp_getattr_hook(PyObject *self, PyObject *name)
|
2001-09-21 21:24:49 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *tp = Py_TYPE(self);
|
|
|
|
|
PyObject *getattr, *getattribute, *res;
|
|
|
|
|
|
|
|
|
|
/* speed hack: we could use lookup_maybe, but that would resolve the
|
|
|
|
|
method fully for each attribute lookup for classes with
|
|
|
|
|
__getattr__, even when the attribute is present. So we use
|
2024-05-06 10:50:35 -07:00
|
|
|
_PyType_LookupRef and create the method only when needed, with
|
2010-05-09 15:52:27 +00:00
|
|
|
call_attribute. */
|
2024-05-06 10:50:35 -07:00
|
|
|
getattr = _PyType_LookupRef(tp, &_Py_ID(__getattr__));
|
2010-05-09 15:52:27 +00:00
|
|
|
if (getattr == NULL) {
|
|
|
|
|
/* No __getattr__ hook: use a simpler dispatcher */
|
2022-08-17 19:37:07 +08:00
|
|
|
tp->tp_getattro = _Py_slot_tp_getattro;
|
|
|
|
|
return _Py_slot_tp_getattro(self, name);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
/* speed hack: we could use lookup_maybe, but that would resolve the
|
|
|
|
|
method fully for each attribute lookup for classes with
|
|
|
|
|
__getattr__, even when self has the default __getattribute__
|
2024-05-06 10:50:35 -07:00
|
|
|
method. So we use _PyType_LookupRef and create the method only when
|
2010-05-09 15:52:27 +00:00
|
|
|
needed, with call_attribute. */
|
2024-05-06 10:50:35 -07:00
|
|
|
getattribute = _PyType_LookupRef(tp, &_Py_ID(__getattribute__));
|
2010-05-09 15:52:27 +00:00
|
|
|
if (getattribute == NULL ||
|
2020-03-04 07:15:20 -06:00
|
|
|
(Py_IS_TYPE(getattribute, &PyWrapperDescr_Type) &&
|
2010-05-09 15:52:27 +00:00
|
|
|
((PyWrapperDescrObject *)getattribute)->d_wrapped ==
|
2023-05-01 18:10:35 +08:00
|
|
|
(void *)PyObject_GenericGetAttr)) {
|
2024-05-06 10:50:35 -07:00
|
|
|
Py_XDECREF(getattribute);
|
2023-05-01 18:10:35 +08:00
|
|
|
res = _PyObject_GenericGetAttrWithDict(self, name, NULL, 1);
|
|
|
|
|
/* if res == NULL with no exception set, then it must be an
|
|
|
|
|
AttributeError suppressed by us. */
|
|
|
|
|
if (res == NULL && !PyErr_Occurred()) {
|
|
|
|
|
res = call_attribute(self, getattr, name);
|
|
|
|
|
}
|
2024-05-06 10:50:35 -07:00
|
|
|
}
|
|
|
|
|
else {
|
2010-05-09 15:52:27 +00:00
|
|
|
res = call_attribute(self, getattribute, name);
|
|
|
|
|
Py_DECREF(getattribute);
|
2023-05-01 18:10:35 +08:00
|
|
|
if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) {
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
res = call_attribute(self, getattr, name);
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2023-05-01 18:10:35 +08:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(getattr);
|
|
|
|
|
return res;
|
2001-09-21 21:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-02 04:15:00 +00:00
|
|
|
static int
|
|
|
|
|
slot_tp_setattro(PyObject *self, PyObject *name, PyObject *value)
|
|
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *stack[3];
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *res;
|
2001-08-02 04:15:00 +00:00
|
|
|
|
2019-06-13 11:26:44 +02:00
|
|
|
stack[0] = self;
|
|
|
|
|
stack[1] = name;
|
2017-01-11 00:07:40 +01:00
|
|
|
if (value == NULL) {
|
2022-02-08 13:39:07 -07:00
|
|
|
res = vectorcall_method(&_Py_ID(__delattr__), stack, 2);
|
2017-01-11 00:07:40 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2019-06-13 11:26:44 +02:00
|
|
|
stack[2] = value;
|
2022-02-08 13:39:07 -07:00
|
|
|
res = vectorcall_method(&_Py_ID(__setattr__), stack, 3);
|
2017-01-11 00:07:40 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
if (res == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
Py_DECREF(res);
|
|
|
|
|
return 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
static PyObject *name_op[] = {
|
|
|
|
|
&_Py_ID(__lt__),
|
|
|
|
|
&_Py_ID(__le__),
|
|
|
|
|
&_Py_ID(__eq__),
|
|
|
|
|
&_Py_ID(__ne__),
|
|
|
|
|
&_Py_ID(__gt__),
|
|
|
|
|
&_Py_ID(__ge__),
|
2008-01-01 04:06:48 +00:00
|
|
|
};
|
|
|
|
|
|
- Another big step in the right direction. All the overridable
operators for which a default implementation exist now work, both in
dynamic classes and in static classes, overridden or not. This
affects __repr__, __str__, __hash__, __contains__, __nonzero__,
__cmp__, and the rich comparisons (__lt__ etc.). For dynamic
classes, this meant copying a lot of code from classobject! (XXX
There are still some holes, because the comparison code in object.c
uses PyInstance_Check(), meaning new-style classes don't get the
same dispensation. This needs more thinking.)
- Add object.__hash__, object.__repr__, object.__str__. The __str__
dispatcher now calls the __repr__ dispatcher, as it should.
- For static classes, the tp_compare, tp_richcompare and tp_hash slots
are now inherited together, or not at all. (XXX I fear there are
still some situations where you can inherit __hash__ when you
shouldn't, but mostly it's OK now, and I think there's no way we can
get that 100% right.)
2001-08-15 23:57:02 +00:00
|
|
|
static PyObject *
|
2009-11-15 13:58:49 +00:00
|
|
|
slot_tp_richcompare(PyObject *self, PyObject *other, int op)
|
- Another big step in the right direction. All the overridable
operators for which a default implementation exist now work, both in
dynamic classes and in static classes, overridden or not. This
affects __repr__, __str__, __hash__, __contains__, __nonzero__,
__cmp__, and the rich comparisons (__lt__ etc.). For dynamic
classes, this meant copying a lot of code from classobject! (XXX
There are still some holes, because the comparison code in object.c
uses PyInstance_Check(), meaning new-style classes don't get the
same dispensation. This needs more thinking.)
- Add object.__hash__, object.__repr__, object.__str__. The __str__
dispatcher now calls the __repr__ dispatcher, as it should.
- For static classes, the tp_compare, tp_richcompare and tp_hash slots
are now inherited together, or not at all. (XXX I fear there are
still some situations where you can inherit __hash__ when you
shouldn't, but mostly it's OK now, and I think there's no way we can
get that 100% right.)
2001-08-15 23:57:02 +00:00
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
PyObject *res = _PyObject_MaybeCallSpecialOneArg(self, name_op[op], other);
|
|
|
|
|
if (res == NULL) {
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2011-08-10 20:28:54 -05:00
|
|
|
Py_RETURN_NOTIMPLEMENTED;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
return res;
|
- Another big step in the right direction. All the overridable
operators for which a default implementation exist now work, both in
dynamic classes and in static classes, overridden or not. This
affects __repr__, __str__, __hash__, __contains__, __nonzero__,
__cmp__, and the rich comparisons (__lt__ etc.). For dynamic
classes, this meant copying a lot of code from classobject! (XXX
There are still some holes, because the comparison code in object.c
uses PyInstance_Check(), meaning new-style classes don't get the
same dispensation. This needs more thinking.)
- Add object.__hash__, object.__repr__, object.__str__. The __str__
dispatcher now calls the __repr__ dispatcher, as it should.
- For static classes, the tp_compare, tp_richcompare and tp_hash slots
are now inherited together, or not at all. (XXX I fear there are
still some situations where you can inherit __hash__ when you
shouldn't, but mostly it's OK now, and I think there's no way we can
get that 100% right.)
2001-08-15 23:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
static int
|
|
|
|
|
has_dunder_getitem(PyObject *self)
|
|
|
|
|
{
|
|
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
|
|
|
|
_PyCStackRef c_ref;
|
|
|
|
|
_PyThreadState_PushCStackRef(tstate, &c_ref);
|
|
|
|
|
lookup_maybe_method(self, &_Py_ID(__getitem__), &c_ref.ref);
|
|
|
|
|
int has_dunder_getitem = !PyStackRef_IsNull(c_ref.ref);
|
|
|
|
|
_PyThreadState_PopCStackRef(tstate, &c_ref);
|
|
|
|
|
return has_dunder_getitem;
|
|
|
|
|
}
|
|
|
|
|
|
- Another big step in the right direction. All the overridable
operators for which a default implementation exist now work, both in
dynamic classes and in static classes, overridden or not. This
affects __repr__, __str__, __hash__, __contains__, __nonzero__,
__cmp__, and the rich comparisons (__lt__ etc.). For dynamic
classes, this meant copying a lot of code from classobject! (XXX
There are still some holes, because the comparison code in object.c
uses PyInstance_Check(), meaning new-style classes don't get the
same dispensation. This needs more thinking.)
- Add object.__hash__, object.__repr__, object.__str__. The __str__
dispatcher now calls the __repr__ dispatcher, as it should.
- For static classes, the tp_compare, tp_richcompare and tp_hash slots
are now inherited together, or not at all. (XXX I fear there are
still some situations where you can inherit __hash__ when you
shouldn't, but mostly it's OK now, and I think there's no way we can
get that 100% right.)
2001-08-15 23:57:02 +00:00
|
|
|
static PyObject *
|
|
|
|
|
slot_tp_iter(PyObject *self)
|
|
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
int attr_is_none = 0;
|
|
|
|
|
PyObject *res = maybe_call_special_no_args(self, &_Py_ID(__iter__),
|
|
|
|
|
&attr_is_none);
|
|
|
|
|
if (res != NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return res;
|
|
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
else if (PyErr_Occurred()) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
else if (attr_is_none || !has_dunder_getitem(self)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
2025-03-26 14:38:47 -04:00
|
|
|
"'%.200s' object is not iterable",
|
|
|
|
|
Py_TYPE(self)->tp_name);
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return PySeqIter_New(self);
|
- Another big step in the right direction. All the overridable
operators for which a default implementation exist now work, both in
dynamic classes and in static classes, overridden or not. This
affects __repr__, __str__, __hash__, __contains__, __nonzero__,
__cmp__, and the rich comparisons (__lt__ etc.). For dynamic
classes, this meant copying a lot of code from classobject! (XXX
There are still some holes, because the comparison code in object.c
uses PyInstance_Check(), meaning new-style classes don't get the
same dispensation. This needs more thinking.)
- Add object.__hash__, object.__repr__, object.__str__. The __str__
dispatcher now calls the __repr__ dispatcher, as it should.
- For static classes, the tp_compare, tp_richcompare and tp_hash slots
are now inherited together, or not at all. (XXX I fear there are
still some situations where you can inherit __hash__ when you
shouldn't, but mostly it's OK now, and I think there's no way we can
get that 100% right.)
2001-08-15 23:57:02 +00:00
|
|
|
}
|
2001-08-02 04:15:00 +00:00
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
slot_tp_iternext(PyObject *self)
|
|
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject *stack[1] = {self};
|
2022-02-08 13:39:07 -07:00
|
|
|
return vectorcall_method(&_Py_ID(__next__), stack, 1);
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-17 16:47:50 +00:00
|
|
|
static PyObject *
|
|
|
|
|
slot_tp_descr_get(PyObject *self, PyObject *obj, PyObject *type)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *tp = Py_TYPE(self);
|
|
|
|
|
PyObject *get;
|
|
|
|
|
|
2024-05-06 10:50:35 -07:00
|
|
|
get = _PyType_LookupRef(tp, &_Py_ID(__get__));
|
2010-05-09 15:52:27 +00:00
|
|
|
if (get == NULL) {
|
|
|
|
|
/* Avoid further slowdowns */
|
|
|
|
|
if (tp->tp_descr_get == slot_tp_descr_get)
|
|
|
|
|
tp->tp_descr_get = NULL;
|
2022-11-10 23:40:31 +01:00
|
|
|
return Py_NewRef(self);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
if (obj == NULL)
|
|
|
|
|
obj = Py_None;
|
|
|
|
|
if (type == NULL)
|
|
|
|
|
type = Py_None;
|
2022-08-14 20:43:42 +05:30
|
|
|
PyObject *stack[3] = {self, obj, type};
|
2024-05-06 10:50:35 -07:00
|
|
|
PyObject *res = PyObject_Vectorcall(get, stack, 3, NULL);
|
|
|
|
|
Py_DECREF(get);
|
|
|
|
|
return res;
|
2001-08-17 16:47:50 +00:00
|
|
|
}
|
2001-08-02 04:15:00 +00:00
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
slot_tp_descr_set(PyObject *self, PyObject *target, PyObject *value)
|
|
|
|
|
{
|
2019-06-13 11:26:44 +02:00
|
|
|
PyObject* stack[3];
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *res;
|
2001-08-24 10:13:31 +00:00
|
|
|
|
2019-06-13 11:26:44 +02:00
|
|
|
stack[0] = self;
|
|
|
|
|
stack[1] = target;
|
2017-01-11 00:07:40 +01:00
|
|
|
if (value == NULL) {
|
2022-02-08 13:39:07 -07:00
|
|
|
res = vectorcall_method(&_Py_ID(__delete__), stack, 2);
|
2017-01-11 00:07:40 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2019-06-13 11:26:44 +02:00
|
|
|
stack[2] = value;
|
2022-02-08 13:39:07 -07:00
|
|
|
res = vectorcall_method(&_Py_ID(__set__), stack, 3);
|
2017-01-11 00:07:40 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
if (res == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
Py_DECREF(res);
|
|
|
|
|
return 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
slot_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
PyObject *res = call_method(self, &_Py_ID(__init__), args, kwds);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (res == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
if (res != Py_None) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"__init__() should return None, not '%.200s'",
|
|
|
|
|
Py_TYPE(res)->tp_name);
|
|
|
|
|
Py_DECREF(res);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(res);
|
|
|
|
|
return 0;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
2019-11-14 13:36:21 +01:00
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
2016-08-25 01:04:14 +02:00
|
|
|
PyObject *func, *result;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
func = PyObject_GetAttr((PyObject *)type, &_Py_ID(__new__));
|
2016-08-25 01:04:14 +02:00
|
|
|
if (func == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2016-08-25 01:04:14 +02:00
|
|
|
|
2019-11-14 13:36:21 +01:00
|
|
|
result = _PyObject_Call_Prepend(tstate, func, (PyObject *)type, args, kwds);
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(func);
|
2016-08-25 01:04:14 +02:00
|
|
|
return result;
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
|
|
|
|
|
2002-08-08 20:55:20 +00:00
|
|
|
static void
|
2013-07-30 19:59:21 +02:00
|
|
|
slot_tp_finalize(PyObject *self)
|
2002-08-08 20:55:20 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Save the current exception, if any. */
|
2025-03-26 14:38:47 -04:00
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
|
|
|
|
PyObject *exc = _PyErr_GetRaisedException(tstate);
|
|
|
|
|
|
|
|
|
|
_PyCStackRef cref;
|
|
|
|
|
_PyThreadState_PushCStackRef(tstate, &cref);
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
/* Execute __del__ method, if any. */
|
2025-03-26 14:38:47 -04:00
|
|
|
int unbound = lookup_maybe_method(self, &_Py_ID(__del__), &cref.ref);
|
|
|
|
|
if (unbound >= 0) {
|
|
|
|
|
PyObject *del = PyStackRef_AsPyObjectBorrow(cref.ref);
|
|
|
|
|
PyObject *res = call_unbound_noarg(unbound, del, self);
|
2025-02-05 11:31:59 +01:00
|
|
|
if (res == NULL) {
|
|
|
|
|
PyErr_FormatUnraisable("Exception ignored while "
|
|
|
|
|
"calling deallocator %R", del);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(res);
|
2025-02-05 11:31:59 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
_PyThreadState_PopCStackRef(tstate, &cref);
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Restore the saved exception. */
|
2025-03-26 14:38:47 -04:00
|
|
|
_PyErr_SetRaisedException(tstate, exc);
|
2002-08-08 20:55:20 +00:00
|
|
|
}
|
|
|
|
|
|
2023-05-04 07:59:46 -07:00
|
|
|
typedef struct _PyBufferWrapper {
|
|
|
|
|
PyObject_HEAD
|
|
|
|
|
PyObject *mv;
|
|
|
|
|
PyObject *obj;
|
|
|
|
|
} PyBufferWrapper;
|
|
|
|
|
|
2025-03-24 10:52:52 +01:00
|
|
|
#define PyBufferWrapper_CAST(op) ((PyBufferWrapper *)(op))
|
|
|
|
|
|
2023-05-04 07:59:46 -07:00
|
|
|
static int
|
2025-03-24 10:52:52 +01:00
|
|
|
bufferwrapper_traverse(PyObject *op, visitproc visit, void *arg)
|
2023-05-04 07:59:46 -07:00
|
|
|
{
|
2025-03-24 10:52:52 +01:00
|
|
|
PyBufferWrapper *self = PyBufferWrapper_CAST(op);
|
2023-05-04 07:59:46 -07:00
|
|
|
Py_VISIT(self->mv);
|
|
|
|
|
Py_VISIT(self->obj);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
bufferwrapper_dealloc(PyObject *self)
|
|
|
|
|
{
|
2025-03-24 10:52:52 +01:00
|
|
|
PyBufferWrapper *bw = PyBufferWrapper_CAST(self);
|
2023-05-04 07:59:46 -07:00
|
|
|
|
|
|
|
|
_PyObject_GC_UNTRACK(self);
|
|
|
|
|
Py_XDECREF(bw->mv);
|
|
|
|
|
Py_XDECREF(bw->obj);
|
|
|
|
|
Py_TYPE(self)->tp_free(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
bufferwrapper_releasebuf(PyObject *self, Py_buffer *view)
|
|
|
|
|
{
|
2025-03-24 10:52:52 +01:00
|
|
|
PyBufferWrapper *bw = PyBufferWrapper_CAST(self);
|
2023-05-04 07:59:46 -07:00
|
|
|
|
2023-05-08 09:52:41 -07:00
|
|
|
if (bw->mv == NULL || bw->obj == NULL) {
|
|
|
|
|
// Already released
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject *mv = bw->mv;
|
|
|
|
|
PyObject *obj = bw->obj;
|
|
|
|
|
|
|
|
|
|
assert(PyMemoryView_Check(mv));
|
|
|
|
|
Py_TYPE(mv)->tp_as_buffer->bf_releasebuffer(mv, view);
|
|
|
|
|
// We only need to call bf_releasebuffer if it's a Python function. If it's a C
|
|
|
|
|
// bf_releasebuf, it will be called when the memoryview is released.
|
|
|
|
|
if (((PyMemoryViewObject *)mv)->view.obj != obj
|
|
|
|
|
&& Py_TYPE(obj)->tp_as_buffer != NULL
|
|
|
|
|
&& Py_TYPE(obj)->tp_as_buffer->bf_releasebuffer == slot_bf_releasebuffer) {
|
|
|
|
|
releasebuffer_call_python(obj, view);
|
2023-05-04 07:59:46 -07:00
|
|
|
}
|
2023-05-08 09:52:41 -07:00
|
|
|
|
|
|
|
|
Py_CLEAR(bw->mv);
|
|
|
|
|
Py_CLEAR(bw->obj);
|
2023-05-04 07:59:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyBufferProcs bufferwrapper_as_buffer = {
|
|
|
|
|
.bf_releasebuffer = bufferwrapper_releasebuf,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PyTypeObject _PyBufferWrapper_Type = {
|
|
|
|
|
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
|
|
|
|
.tp_name = "_buffer_wrapper",
|
|
|
|
|
.tp_basicsize = sizeof(PyBufferWrapper),
|
|
|
|
|
.tp_alloc = PyType_GenericAlloc,
|
|
|
|
|
.tp_free = PyObject_GC_Del,
|
2025-03-24 10:52:52 +01:00
|
|
|
.tp_traverse = bufferwrapper_traverse,
|
2023-05-04 07:59:46 -07:00
|
|
|
.tp_dealloc = bufferwrapper_dealloc,
|
|
|
|
|
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
|
|
|
|
|
.tp_as_buffer = &bufferwrapper_as_buffer,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
slot_bf_getbuffer(PyObject *self, Py_buffer *buffer, int flags)
|
|
|
|
|
{
|
|
|
|
|
PyObject *flags_obj = PyLong_FromLong(flags);
|
|
|
|
|
if (flags_obj == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
PyBufferWrapper *wrapper = NULL;
|
|
|
|
|
PyObject *stack[2] = {self, flags_obj};
|
|
|
|
|
PyObject *ret = vectorcall_method(&_Py_ID(__buffer__), stack, 2);
|
|
|
|
|
if (ret == NULL) {
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
if (!PyMemoryView_Check(ret)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"__buffer__ returned non-memoryview object");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PyObject_GetBuffer(ret, buffer, flags) < 0) {
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
assert(buffer->obj == ret);
|
|
|
|
|
|
|
|
|
|
wrapper = PyObject_GC_New(PyBufferWrapper, &_PyBufferWrapper_Type);
|
|
|
|
|
if (wrapper == NULL) {
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
wrapper->mv = ret;
|
|
|
|
|
wrapper->obj = Py_NewRef(self);
|
|
|
|
|
_PyObject_GC_TRACK(wrapper);
|
|
|
|
|
|
|
|
|
|
buffer->obj = (PyObject *)wrapper;
|
|
|
|
|
Py_DECREF(ret);
|
|
|
|
|
Py_DECREF(flags_obj);
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
fail:
|
|
|
|
|
Py_XDECREF(wrapper);
|
|
|
|
|
Py_XDECREF(ret);
|
|
|
|
|
Py_DECREF(flags_obj);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
static releasebufferproc
|
|
|
|
|
releasebuffer_maybe_call_super_unlocked(PyObject *self, Py_buffer *buffer)
|
2023-05-08 09:52:41 -07:00
|
|
|
{
|
|
|
|
|
PyTypeObject *self_type = Py_TYPE(self);
|
|
|
|
|
PyObject *mro = lookup_tp_mro(self_type);
|
|
|
|
|
if (mro == NULL) {
|
2024-02-15 10:54:57 -08:00
|
|
|
return NULL;
|
2023-05-08 09:52:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(PyTuple_Check(mro));
|
|
|
|
|
Py_ssize_t n = PyTuple_GET_SIZE(mro);
|
|
|
|
|
Py_ssize_t i;
|
|
|
|
|
|
|
|
|
|
/* No need to check the last one: it's gonna be skipped anyway. */
|
|
|
|
|
for (i = 0; i < n -1; i++) {
|
|
|
|
|
if ((PyObject *)(self_type) == PyTuple_GET_ITEM(mro, i))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
i++; /* skip self_type */
|
|
|
|
|
if (i >= n)
|
2024-02-15 10:54:57 -08:00
|
|
|
return NULL;
|
2023-05-08 09:52:41 -07:00
|
|
|
|
|
|
|
|
for (; i < n; i++) {
|
|
|
|
|
PyObject *obj = PyTuple_GET_ITEM(mro, i);
|
|
|
|
|
if (!PyType_Check(obj)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
PyTypeObject *base_type = (PyTypeObject *)obj;
|
|
|
|
|
if (base_type->tp_as_buffer != NULL
|
|
|
|
|
&& base_type->tp_as_buffer->bf_releasebuffer != NULL
|
|
|
|
|
&& base_type->tp_as_buffer->bf_releasebuffer != slot_bf_releasebuffer) {
|
2024-02-15 10:54:57 -08:00
|
|
|
return base_type->tp_as_buffer->bf_releasebuffer;
|
2023-05-08 09:52:41 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
releasebuffer_maybe_call_super(PyObject *self, Py_buffer *buffer)
|
|
|
|
|
{
|
|
|
|
|
releasebufferproc base_releasebuffer;
|
|
|
|
|
|
|
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
base_releasebuffer = releasebuffer_maybe_call_super_unlocked(self, buffer);
|
|
|
|
|
END_TYPE_LOCK();
|
|
|
|
|
|
2023-05-08 09:52:41 -07:00
|
|
|
if (base_releasebuffer != NULL) {
|
|
|
|
|
base_releasebuffer(self, buffer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-04 07:59:46 -07:00
|
|
|
static void
|
2023-05-08 09:52:41 -07:00
|
|
|
releasebuffer_call_python(PyObject *self, Py_buffer *buffer)
|
2023-05-04 07:59:46 -07:00
|
|
|
{
|
2023-05-11 22:22:40 -07:00
|
|
|
// bf_releasebuffer may be called while an exception is already active.
|
|
|
|
|
// We have no way to report additional errors up the stack, because
|
|
|
|
|
// this slot returns void, so we simply stash away the active exception
|
|
|
|
|
// and restore it after the call to Python returns.
|
|
|
|
|
PyObject *exc = PyErr_GetRaisedException();
|
|
|
|
|
|
2023-05-04 07:59:46 -07:00
|
|
|
PyObject *mv;
|
2023-05-08 09:52:41 -07:00
|
|
|
bool is_buffer_wrapper = Py_TYPE(buffer->obj) == &_PyBufferWrapper_Type;
|
|
|
|
|
if (is_buffer_wrapper) {
|
2023-05-04 07:59:46 -07:00
|
|
|
// Make sure we pass the same memoryview to
|
|
|
|
|
// __release_buffer__() that __buffer__() returned.
|
2023-05-08 09:52:41 -07:00
|
|
|
PyBufferWrapper *bw = (PyBufferWrapper *)buffer->obj;
|
|
|
|
|
if (bw->mv == NULL) {
|
2023-05-11 22:22:40 -07:00
|
|
|
goto end;
|
2023-05-08 09:52:41 -07:00
|
|
|
}
|
|
|
|
|
mv = Py_NewRef(bw->mv);
|
2023-05-04 07:59:46 -07:00
|
|
|
}
|
|
|
|
|
else {
|
2023-05-08 09:52:41 -07:00
|
|
|
// This means we are not dealing with a memoryview returned
|
|
|
|
|
// from a Python __buffer__ function.
|
2023-05-04 07:59:46 -07:00
|
|
|
mv = PyMemoryView_FromBuffer(buffer);
|
|
|
|
|
if (mv == NULL) {
|
2023-11-02 11:16:34 +02:00
|
|
|
PyErr_FormatUnraisable("Exception ignored in bf_releasebuffer of %s", Py_TYPE(self)->tp_name);
|
2023-05-11 22:22:40 -07:00
|
|
|
goto end;
|
2023-05-04 07:59:46 -07:00
|
|
|
}
|
2023-05-08 09:52:41 -07:00
|
|
|
// Set the memoryview to restricted mode, which forbids
|
|
|
|
|
// users from saving any reference to the underlying buffer
|
|
|
|
|
// (e.g., by doing .cast()). This is necessary to ensure
|
|
|
|
|
// no Python code retains a reference to the to-be-released
|
|
|
|
|
// buffer.
|
|
|
|
|
((PyMemoryViewObject *)mv)->flags |= _Py_MEMORYVIEW_RESTRICTED;
|
2023-05-04 07:59:46 -07:00
|
|
|
}
|
|
|
|
|
PyObject *stack[2] = {self, mv};
|
|
|
|
|
PyObject *ret = vectorcall_method(&_Py_ID(__release_buffer__), stack, 2);
|
|
|
|
|
if (ret == NULL) {
|
2023-11-02 11:16:34 +02:00
|
|
|
PyErr_FormatUnraisable("Exception ignored in __release_buffer__ of %s", Py_TYPE(self)->tp_name);
|
2023-05-04 07:59:46 -07:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Py_DECREF(ret);
|
|
|
|
|
}
|
2023-05-08 09:52:41 -07:00
|
|
|
if (!is_buffer_wrapper) {
|
2023-05-12 18:27:06 +05:30
|
|
|
PyObject *res = PyObject_CallMethodNoArgs(mv, &_Py_ID(release));
|
|
|
|
|
if (res == NULL) {
|
2023-11-02 11:16:34 +02:00
|
|
|
PyErr_FormatUnraisable("Exception ignored in bf_releasebuffer of %s", Py_TYPE(self)->tp_name);
|
2023-05-12 18:27:06 +05:30
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Py_DECREF(res);
|
|
|
|
|
}
|
2023-05-08 09:52:41 -07:00
|
|
|
}
|
|
|
|
|
Py_DECREF(mv);
|
2023-05-11 22:22:40 -07:00
|
|
|
end:
|
|
|
|
|
assert(!PyErr_Occurred());
|
|
|
|
|
|
|
|
|
|
PyErr_SetRaisedException(exc);
|
2023-05-08 09:52:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* bf_releasebuffer is very delicate, because we need to ensure that
|
|
|
|
|
* C bf_releasebuffer slots are called correctly (or we'll leak memory),
|
|
|
|
|
* but we cannot trust any __release_buffer__ implemented in Python to
|
|
|
|
|
* do so correctly. Therefore, if a base class has a C bf_releasebuffer
|
|
|
|
|
* slot, we call it directly here. That is safe because this function
|
|
|
|
|
* only gets called from C callers of the bf_releasebuffer slot. Python
|
|
|
|
|
* code that calls __release_buffer__ directly instead goes through
|
|
|
|
|
* wrap_releasebuffer(), which doesn't call the bf_releasebuffer slot
|
|
|
|
|
* directly but instead simply releases the associated memoryview.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
slot_bf_releasebuffer(PyObject *self, Py_buffer *buffer)
|
|
|
|
|
{
|
|
|
|
|
releasebuffer_call_python(self, buffer);
|
2024-02-15 10:54:57 -08:00
|
|
|
releasebuffer_maybe_call_super(self, buffer);
|
2023-05-04 07:59:46 -07:00
|
|
|
}
|
|
|
|
|
|
2015-05-11 22:57:16 -04:00
|
|
|
static PyObject *
|
2025-03-26 14:38:47 -04:00
|
|
|
slot_am_generic(PyObject *self, PyObject *name)
|
2015-05-11 22:57:16 -04:00
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
PyObject *res = _PyObject_MaybeCallSpecialNoArgs(self, name);
|
|
|
|
|
if (res == NULL && !PyErr_Occurred()) {
|
|
|
|
|
PyErr_Format(PyExc_AttributeError,
|
|
|
|
|
"object %.50s does not have %U method",
|
|
|
|
|
Py_TYPE(self)->tp_name, name);
|
2015-05-11 22:57:16 -04:00
|
|
|
}
|
2025-03-26 14:38:47 -04:00
|
|
|
return res;
|
2015-05-11 22:57:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
2025-03-26 14:38:47 -04:00
|
|
|
slot_am_await(PyObject *self)
|
2015-05-11 22:57:16 -04:00
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
return slot_am_generic(self, &_Py_ID(__await__));
|
|
|
|
|
}
|
2015-05-11 22:57:16 -04:00
|
|
|
|
2025-03-26 14:38:47 -04:00
|
|
|
static PyObject *
|
|
|
|
|
slot_am_aiter(PyObject *self)
|
|
|
|
|
{
|
|
|
|
|
return slot_am_generic(self, &_Py_ID(__aiter__));
|
2015-05-11 22:57:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
slot_am_anext(PyObject *self)
|
|
|
|
|
{
|
2025-03-26 14:38:47 -04:00
|
|
|
return slot_am_generic(self, &_Py_ID(__anext__));
|
2015-05-11 22:57:16 -04:00
|
|
|
}
|
2001-08-07 16:40:56 +00:00
|
|
|
|
2013-04-01 17:41:41 -04:00
|
|
|
/*
|
|
|
|
|
Table mapping __foo__ names to tp_foo offsets and slot_tp_foo wrapper functions.
|
|
|
|
|
|
|
|
|
|
The table is ordered by offsets relative to the 'PyHeapTypeObject' structure,
|
|
|
|
|
which incorporates the additional structures used for numbers, sequences and
|
|
|
|
|
mappings. Note that multiple names may map to the same slot (e.g. __eq__,
|
|
|
|
|
__ne__ etc. all map to tp_richcompare) and one name may map to multiple slots
|
|
|
|
|
(e.g. __str__ affects tp_str as well as tp_repr). The table is terminated with
|
2022-09-08 03:32:08 +05:30
|
|
|
an all-zero entry.
|
2013-04-01 17:41:41 -04:00
|
|
|
*/
|
2001-10-09 19:39:46 +00:00
|
|
|
|
|
|
|
|
#undef TPSLOT
|
2001-10-22 00:43:43 +00:00
|
|
|
#undef FLSLOT
|
2023-05-04 07:59:46 -07:00
|
|
|
#undef BUFSLOT
|
2015-05-11 22:57:16 -04:00
|
|
|
#undef AMSLOT
|
2001-10-09 19:39:46 +00:00
|
|
|
#undef ETSLOT
|
|
|
|
|
#undef SQSLOT
|
|
|
|
|
#undef MPSLOT
|
|
|
|
|
#undef NBSLOT
|
2001-10-21 00:44:31 +00:00
|
|
|
#undef UNSLOT
|
|
|
|
|
#undef IBSLOT
|
2001-10-09 19:39:46 +00:00
|
|
|
#undef BINSLOT
|
|
|
|
|
#undef RBINSLOT
|
|
|
|
|
|
2001-10-21 00:44:31 +00:00
|
|
|
#define TPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
|
2022-09-08 03:32:08 +05:30
|
|
|
{#NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \
|
|
|
|
|
PyDoc_STR(DOC), .name_strobj = &_Py_ID(NAME)}
|
2001-10-22 00:43:43 +00:00
|
|
|
#define FLSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC, FLAGS) \
|
2022-09-08 03:32:08 +05:30
|
|
|
{#NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \
|
|
|
|
|
PyDoc_STR(DOC), FLAGS, .name_strobj = &_Py_ID(NAME) }
|
2001-10-21 00:44:31 +00:00
|
|
|
#define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
|
2022-09-08 03:32:08 +05:30
|
|
|
{#NAME, offsetof(PyHeapTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \
|
|
|
|
|
PyDoc_STR(DOC), .name_strobj = &_Py_ID(NAME) }
|
2023-05-04 07:59:46 -07:00
|
|
|
#define BUFSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
|
|
|
|
|
ETSLOT(NAME, as_buffer.SLOT, FUNCTION, WRAPPER, DOC)
|
2015-05-11 22:57:16 -04:00
|
|
|
#define AMSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
|
|
|
|
|
ETSLOT(NAME, as_async.SLOT, FUNCTION, WRAPPER, DOC)
|
2001-10-21 00:44:31 +00:00
|
|
|
#define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
|
2010-05-09 15:52:27 +00:00
|
|
|
ETSLOT(NAME, as_sequence.SLOT, FUNCTION, WRAPPER, DOC)
|
2001-10-21 00:44:31 +00:00
|
|
|
#define MPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
|
2010-05-09 15:52:27 +00:00
|
|
|
ETSLOT(NAME, as_mapping.SLOT, FUNCTION, WRAPPER, DOC)
|
2001-10-21 00:44:31 +00:00
|
|
|
#define NBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
|
2010-05-09 15:52:27 +00:00
|
|
|
ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, DOC)
|
2001-10-21 00:44:31 +00:00
|
|
|
#define UNSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
|
2010-05-09 15:52:27 +00:00
|
|
|
ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \
|
2022-09-08 03:32:08 +05:30
|
|
|
#NAME "($self, /)\n--\n\n" DOC)
|
2001-10-21 00:44:31 +00:00
|
|
|
#define IBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
|
2010-05-09 15:52:27 +00:00
|
|
|
ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \
|
2023-02-23 10:17:44 +00:00
|
|
|
#NAME "($self, value, /)\n--\n\nReturn self" DOC "value.")
|
2001-10-21 00:44:31 +00:00
|
|
|
#define BINSLOT(NAME, SLOT, FUNCTION, DOC) \
|
2010-05-09 15:52:27 +00:00
|
|
|
ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \
|
2022-09-08 03:32:08 +05:30
|
|
|
#NAME "($self, value, /)\n--\n\nReturn self" DOC "value.")
|
2001-10-21 00:44:31 +00:00
|
|
|
#define RBINSLOT(NAME, SLOT, FUNCTION, DOC) \
|
2010-05-09 15:52:27 +00:00
|
|
|
ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \
|
2022-09-08 03:32:08 +05:30
|
|
|
#NAME "($self, value, /)\n--\n\nReturn value" DOC "self.")
|
2005-06-03 14:12:21 +00:00
|
|
|
#define BINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \
|
2010-05-09 15:52:27 +00:00
|
|
|
ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \
|
2022-09-08 03:32:08 +05:30
|
|
|
#NAME "($self, value, /)\n--\n\n" DOC)
|
2005-06-03 14:12:21 +00:00
|
|
|
#define RBINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \
|
2010-05-09 15:52:27 +00:00
|
|
|
ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \
|
2022-09-08 03:32:08 +05:30
|
|
|
#NAME "($self, value, /)\n--\n\n" DOC)
|
2001-10-09 19:39:46 +00:00
|
|
|
|
2022-11-14 13:50:56 -07:00
|
|
|
static pytype_slotdef slotdefs[] = {
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__getattribute__, tp_getattr, NULL, NULL, ""),
|
|
|
|
|
TPSLOT(__getattr__, tp_getattr, NULL, NULL, ""),
|
|
|
|
|
TPSLOT(__setattr__, tp_setattr, NULL, NULL, ""),
|
|
|
|
|
TPSLOT(__delattr__, tp_setattr, NULL, NULL, ""),
|
|
|
|
|
TPSLOT(__repr__, tp_repr, slot_tp_repr, wrap_unaryfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__repr__($self, /)\n--\n\nReturn repr(self)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__hash__, tp_hash, slot_tp_hash, wrap_hashfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__hash__($self, /)\n--\n\nReturn hash(self)."),
|
2025-04-18 12:24:34 +02:00
|
|
|
FLSLOT(__call__, tp_call, slot_tp_call,
|
|
|
|
|
_Py_FUNC_CAST(wrapperfunc, wrap_call),
|
2014-02-09 22:22:38 -08:00
|
|
|
"__call__($self, /, *args, **kwargs)\n--\n\nCall self as a function.",
|
2014-01-24 06:17:25 -08:00
|
|
|
PyWrapperFlag_KEYWORDS),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__str__, tp_str, slot_tp_str, wrap_unaryfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__str__($self, /)\n--\n\nReturn str(self)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__getattribute__, tp_getattro, _Py_slot_tp_getattr_hook,
|
2014-01-24 06:17:25 -08:00
|
|
|
wrap_binaryfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__getattribute__($self, name, /)\n--\n\nReturn getattr(self, name)."),
|
2024-04-12 13:56:41 +03:00
|
|
|
TPSLOT(__getattr__, tp_getattro, _Py_slot_tp_getattr_hook, NULL,
|
|
|
|
|
"__getattr__($self, name, /)\n--\n\nImplement getattr(self, name)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__setattr__, tp_setattro, slot_tp_setattro, wrap_setattr,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__setattr__($self, name, value, /)\n--\n\nImplement setattr(self, name, value)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__delattr__, tp_setattro, slot_tp_setattro, wrap_delattr,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__delattr__($self, name, /)\n--\n\nImplement delattr(self, name)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__lt__, tp_richcompare, slot_tp_richcompare, richcmp_lt,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__lt__($self, value, /)\n--\n\nReturn self<value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__le__, tp_richcompare, slot_tp_richcompare, richcmp_le,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__le__($self, value, /)\n--\n\nReturn self<=value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__eq__, tp_richcompare, slot_tp_richcompare, richcmp_eq,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__eq__($self, value, /)\n--\n\nReturn self==value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__ne__, tp_richcompare, slot_tp_richcompare, richcmp_ne,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__ne__($self, value, /)\n--\n\nReturn self!=value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__gt__, tp_richcompare, slot_tp_richcompare, richcmp_gt,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__gt__($self, value, /)\n--\n\nReturn self>value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__ge__, tp_richcompare, slot_tp_richcompare, richcmp_ge,
|
2014-04-18 09:14:31 -05:00
|
|
|
"__ge__($self, value, /)\n--\n\nReturn self>=value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__iter__, tp_iter, slot_tp_iter, wrap_unaryfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__iter__($self, /)\n--\n\nImplement iter(self)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__next__, tp_iternext, slot_tp_iternext, wrap_next,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__next__($self, /)\n--\n\nImplement next(self)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__get__, tp_descr_get, slot_tp_descr_get, wrap_descr_get,
|
2022-06-21 12:45:38 -07:00
|
|
|
"__get__($self, instance, owner=None, /)\n--\n\nReturn an attribute of instance, which is of type owner."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__set__, tp_descr_set, slot_tp_descr_set, wrap_descr_set,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__set__($self, instance, value, /)\n--\n\nSet an attribute of instance to value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__delete__, tp_descr_set, slot_tp_descr_set,
|
2014-01-24 06:17:25 -08:00
|
|
|
wrap_descr_delete,
|
2014-03-02 12:25:27 -05:00
|
|
|
"__delete__($self, instance, /)\n--\n\nDelete an attribute of instance."),
|
2025-04-18 12:24:34 +02:00
|
|
|
FLSLOT(__init__, tp_init, slot_tp_init,
|
|
|
|
|
_Py_FUNC_CAST(wrapperfunc, wrap_init),
|
2014-02-09 22:22:38 -08:00
|
|
|
"__init__($self, /, *args, **kwargs)\n--\n\n"
|
2014-01-28 05:00:08 -08:00
|
|
|
"Initialize self. See help(type(self)) for accurate signature.",
|
2013-04-01 17:41:41 -04:00
|
|
|
PyWrapperFlag_KEYWORDS),
|
2022-09-08 03:32:08 +05:30
|
|
|
TPSLOT(__new__, tp_new, slot_tp_new, NULL,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__new__(type, /, *args, **kwargs)\n--\n\n"
|
2014-01-28 05:00:08 -08:00
|
|
|
"Create and return new object. See help(type) for accurate signature."),
|
2024-04-12 13:56:41 +03:00
|
|
|
TPSLOT(__del__, tp_finalize, slot_tp_finalize, (wrapperfunc)wrap_del,
|
|
|
|
|
"__del__($self, /)\n--\n\n"
|
|
|
|
|
"Called when the instance is about to be destroyed."),
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2023-05-04 07:59:46 -07:00
|
|
|
BUFSLOT(__buffer__, bf_getbuffer, slot_bf_getbuffer, wrap_buffer,
|
|
|
|
|
"__buffer__($self, flags, /)\n--\n\n"
|
|
|
|
|
"Return a buffer object that exposes the underlying memory of the object."),
|
|
|
|
|
BUFSLOT(__release_buffer__, bf_releasebuffer, slot_bf_releasebuffer, wrap_releasebuffer,
|
2023-05-26 05:44:23 -07:00
|
|
|
"__release_buffer__($self, buffer, /)\n--\n\n"
|
2023-05-04 07:59:46 -07:00
|
|
|
"Release the buffer object that exposes the underlying memory of the object."),
|
|
|
|
|
|
2022-09-08 03:32:08 +05:30
|
|
|
AMSLOT(__await__, am_await, slot_am_await, wrap_unaryfunc,
|
2015-05-11 22:57:16 -04:00
|
|
|
"__await__($self, /)\n--\n\nReturn an iterator to be used in await expression."),
|
2022-09-08 03:32:08 +05:30
|
|
|
AMSLOT(__aiter__, am_aiter, slot_am_aiter, wrap_unaryfunc,
|
2015-05-11 22:57:16 -04:00
|
|
|
"__aiter__($self, /)\n--\n\nReturn an awaitable, that resolves in asynchronous iterator."),
|
2022-09-08 03:32:08 +05:30
|
|
|
AMSLOT(__anext__, am_anext, slot_am_anext, wrap_unaryfunc,
|
2015-05-11 22:57:16 -04:00
|
|
|
"__anext__($self, /)\n--\n\nReturn a value or raise StopAsyncIteration."),
|
|
|
|
|
|
2022-09-08 03:32:08 +05:30
|
|
|
BINSLOT(__add__, nb_add, slot_nb_add,
|
2014-01-24 06:17:25 -08:00
|
|
|
"+"),
|
2022-09-08 03:32:08 +05:30
|
|
|
RBINSLOT(__radd__, nb_add, slot_nb_add,
|
2014-01-24 06:17:25 -08:00
|
|
|
"+"),
|
2022-09-08 03:32:08 +05:30
|
|
|
BINSLOT(__sub__, nb_subtract, slot_nb_subtract,
|
2014-01-24 06:17:25 -08:00
|
|
|
"-"),
|
2022-09-08 03:32:08 +05:30
|
|
|
RBINSLOT(__rsub__, nb_subtract, slot_nb_subtract,
|
2014-01-24 06:17:25 -08:00
|
|
|
"-"),
|
2022-09-08 03:32:08 +05:30
|
|
|
BINSLOT(__mul__, nb_multiply, slot_nb_multiply,
|
2014-01-24 06:17:25 -08:00
|
|
|
"*"),
|
2022-09-08 03:32:08 +05:30
|
|
|
RBINSLOT(__rmul__, nb_multiply, slot_nb_multiply,
|
2014-01-24 06:17:25 -08:00
|
|
|
"*"),
|
2022-09-08 03:32:08 +05:30
|
|
|
BINSLOT(__mod__, nb_remainder, slot_nb_remainder,
|
2014-01-24 06:17:25 -08:00
|
|
|
"%"),
|
2022-09-08 03:32:08 +05:30
|
|
|
RBINSLOT(__rmod__, nb_remainder, slot_nb_remainder,
|
2014-01-24 06:17:25 -08:00
|
|
|
"%"),
|
2022-09-08 03:32:08 +05:30
|
|
|
BINSLOTNOTINFIX(__divmod__, nb_divmod, slot_nb_divmod,
|
2014-01-28 05:00:08 -08:00
|
|
|
"Return divmod(self, value)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
RBINSLOTNOTINFIX(__rdivmod__, nb_divmod, slot_nb_divmod,
|
2014-01-28 05:00:08 -08:00
|
|
|
"Return divmod(value, self)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
NBSLOT(__pow__, nb_power, slot_nb_power, wrap_ternaryfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__pow__($self, value, mod=None, /)\n--\n\nReturn pow(self, value, mod)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
NBSLOT(__rpow__, nb_power, slot_nb_power, wrap_ternaryfunc_r,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__rpow__($self, value, mod=None, /)\n--\n\nReturn pow(value, self, mod)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
UNSLOT(__neg__, nb_negative, slot_nb_negative, wrap_unaryfunc, "-self"),
|
|
|
|
|
UNSLOT(__pos__, nb_positive, slot_nb_positive, wrap_unaryfunc, "+self"),
|
|
|
|
|
UNSLOT(__abs__, nb_absolute, slot_nb_absolute, wrap_unaryfunc,
|
2014-01-24 06:17:25 -08:00
|
|
|
"abs(self)"),
|
2022-09-08 03:32:08 +05:30
|
|
|
UNSLOT(__bool__, nb_bool, slot_nb_bool, wrap_inquirypred,
|
2022-02-21 07:42:27 -08:00
|
|
|
"True if self else False"),
|
2022-09-08 03:32:08 +05:30
|
|
|
UNSLOT(__invert__, nb_invert, slot_nb_invert, wrap_unaryfunc, "~self"),
|
|
|
|
|
BINSLOT(__lshift__, nb_lshift, slot_nb_lshift, "<<"),
|
|
|
|
|
RBINSLOT(__rlshift__, nb_lshift, slot_nb_lshift, "<<"),
|
|
|
|
|
BINSLOT(__rshift__, nb_rshift, slot_nb_rshift, ">>"),
|
|
|
|
|
RBINSLOT(__rrshift__, nb_rshift, slot_nb_rshift, ">>"),
|
|
|
|
|
BINSLOT(__and__, nb_and, slot_nb_and, "&"),
|
|
|
|
|
RBINSLOT(__rand__, nb_and, slot_nb_and, "&"),
|
|
|
|
|
BINSLOT(__xor__, nb_xor, slot_nb_xor, "^"),
|
|
|
|
|
RBINSLOT(__rxor__, nb_xor, slot_nb_xor, "^"),
|
|
|
|
|
BINSLOT(__or__, nb_or, slot_nb_or, "|"),
|
|
|
|
|
RBINSLOT(__ror__, nb_or, slot_nb_or, "|"),
|
|
|
|
|
UNSLOT(__int__, nb_int, slot_nb_int, wrap_unaryfunc,
|
2014-01-24 06:17:25 -08:00
|
|
|
"int(self)"),
|
2022-09-08 03:32:08 +05:30
|
|
|
UNSLOT(__float__, nb_float, slot_nb_float, wrap_unaryfunc,
|
2014-01-24 06:17:25 -08:00
|
|
|
"float(self)"),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__iadd__, nb_inplace_add, slot_nb_inplace_add,
|
2011-11-11 16:57:05 +02:00
|
|
|
wrap_binaryfunc, "+="),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__isub__, nb_inplace_subtract, slot_nb_inplace_subtract,
|
2011-11-11 16:57:05 +02:00
|
|
|
wrap_binaryfunc, "-="),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__imul__, nb_inplace_multiply, slot_nb_inplace_multiply,
|
2011-11-11 16:57:05 +02:00
|
|
|
wrap_binaryfunc, "*="),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__imod__, nb_inplace_remainder, slot_nb_inplace_remainder,
|
2011-11-11 16:57:05 +02:00
|
|
|
wrap_binaryfunc, "%="),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__ipow__, nb_inplace_power, slot_nb_inplace_power,
|
2019-05-31 03:46:36 -06:00
|
|
|
wrap_ternaryfunc, "**="),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__ilshift__, nb_inplace_lshift, slot_nb_inplace_lshift,
|
2011-11-11 16:57:05 +02:00
|
|
|
wrap_binaryfunc, "<<="),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__irshift__, nb_inplace_rshift, slot_nb_inplace_rshift,
|
2011-11-11 16:57:05 +02:00
|
|
|
wrap_binaryfunc, ">>="),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__iand__, nb_inplace_and, slot_nb_inplace_and,
|
2011-11-11 16:57:05 +02:00
|
|
|
wrap_binaryfunc, "&="),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__ixor__, nb_inplace_xor, slot_nb_inplace_xor,
|
2011-11-11 16:57:05 +02:00
|
|
|
wrap_binaryfunc, "^="),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__ior__, nb_inplace_or, slot_nb_inplace_or,
|
2011-11-11 16:57:05 +02:00
|
|
|
wrap_binaryfunc, "|="),
|
2022-09-08 03:32:08 +05:30
|
|
|
BINSLOT(__floordiv__, nb_floor_divide, slot_nb_floor_divide, "//"),
|
|
|
|
|
RBINSLOT(__rfloordiv__, nb_floor_divide, slot_nb_floor_divide, "//"),
|
|
|
|
|
BINSLOT(__truediv__, nb_true_divide, slot_nb_true_divide, "/"),
|
|
|
|
|
RBINSLOT(__rtruediv__, nb_true_divide, slot_nb_true_divide, "/"),
|
|
|
|
|
IBSLOT(__ifloordiv__, nb_inplace_floor_divide,
|
2014-10-31 13:12:57 +01:00
|
|
|
slot_nb_inplace_floor_divide, wrap_binaryfunc, "//="),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__itruediv__, nb_inplace_true_divide,
|
2014-10-31 13:12:57 +01:00
|
|
|
slot_nb_inplace_true_divide, wrap_binaryfunc, "/="),
|
2022-09-08 03:32:08 +05:30
|
|
|
NBSLOT(__index__, nb_index, slot_nb_index, wrap_unaryfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__index__($self, /)\n--\n\n"
|
2014-04-18 09:23:14 -05:00
|
|
|
"Return self converted to an integer, if self is suitable "
|
2014-01-24 06:17:25 -08:00
|
|
|
"for use as an index into a list."),
|
2022-09-08 03:32:08 +05:30
|
|
|
BINSLOT(__matmul__, nb_matrix_multiply, slot_nb_matrix_multiply,
|
2014-04-09 23:55:56 -04:00
|
|
|
"@"),
|
2022-09-08 03:32:08 +05:30
|
|
|
RBINSLOT(__rmatmul__, nb_matrix_multiply, slot_nb_matrix_multiply,
|
2014-04-09 23:55:56 -04:00
|
|
|
"@"),
|
2022-09-08 03:32:08 +05:30
|
|
|
IBSLOT(__imatmul__, nb_inplace_matrix_multiply, slot_nb_inplace_matrix_multiply,
|
2014-04-09 23:55:56 -04:00
|
|
|
wrap_binaryfunc, "@="),
|
2022-09-08 03:32:08 +05:30
|
|
|
MPSLOT(__len__, mp_length, slot_mp_length, wrap_lenfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__len__($self, /)\n--\n\nReturn len(self)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
MPSLOT(__getitem__, mp_subscript, slot_mp_subscript,
|
2013-04-01 17:41:41 -04:00
|
|
|
wrap_binaryfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__getitem__($self, key, /)\n--\n\nReturn self[key]."),
|
2022-09-08 03:32:08 +05:30
|
|
|
MPSLOT(__setitem__, mp_ass_subscript, slot_mp_ass_subscript,
|
2013-04-01 17:41:41 -04:00
|
|
|
wrap_objobjargproc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__setitem__($self, key, value, /)\n--\n\nSet self[key] to value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
MPSLOT(__delitem__, mp_ass_subscript, slot_mp_ass_subscript,
|
2013-04-01 17:41:41 -04:00
|
|
|
wrap_delitem,
|
2014-03-02 12:25:27 -05:00
|
|
|
"__delitem__($self, key, /)\n--\n\nDelete self[key]."),
|
2013-04-01 17:41:41 -04:00
|
|
|
|
2022-09-08 03:32:08 +05:30
|
|
|
SQSLOT(__len__, sq_length, slot_sq_length, wrap_lenfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__len__($self, /)\n--\n\nReturn len(self)."),
|
2013-04-01 17:41:41 -04:00
|
|
|
/* Heap types defining __add__/__mul__ have sq_concat/sq_repeat == NULL.
|
|
|
|
|
The logic in abstract.c always falls back to nb_add/nb_multiply in
|
|
|
|
|
this case. Defining both the nb_* and the sq_* slots to call the
|
|
|
|
|
user-defined methods has unexpected side-effects, as shown by
|
|
|
|
|
test_descr.notimplemented() */
|
2022-09-08 03:32:08 +05:30
|
|
|
SQSLOT(__add__, sq_concat, NULL, wrap_binaryfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__add__($self, value, /)\n--\n\nReturn self+value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
SQSLOT(__mul__, sq_repeat, NULL, wrap_indexargfunc,
|
2018-05-08 15:00:19 -07:00
|
|
|
"__mul__($self, value, /)\n--\n\nReturn self*value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
SQSLOT(__rmul__, sq_repeat, NULL, wrap_indexargfunc,
|
2018-05-08 15:00:19 -07:00
|
|
|
"__rmul__($self, value, /)\n--\n\nReturn value*self."),
|
2022-09-08 03:32:08 +05:30
|
|
|
SQSLOT(__getitem__, sq_item, slot_sq_item, wrap_sq_item,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__getitem__($self, key, /)\n--\n\nReturn self[key]."),
|
2022-09-08 03:32:08 +05:30
|
|
|
SQSLOT(__setitem__, sq_ass_item, slot_sq_ass_item, wrap_sq_setitem,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__setitem__($self, key, value, /)\n--\n\nSet self[key] to value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
SQSLOT(__delitem__, sq_ass_item, slot_sq_ass_item, wrap_sq_delitem,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__delitem__($self, key, /)\n--\n\nDelete self[key]."),
|
2022-09-08 03:32:08 +05:30
|
|
|
SQSLOT(__contains__, sq_contains, slot_sq_contains, wrap_objobjproc,
|
2022-11-26 17:24:04 -05:00
|
|
|
"__contains__($self, key, /)\n--\n\nReturn bool(key in self)."),
|
2022-09-08 03:32:08 +05:30
|
|
|
SQSLOT(__iadd__, sq_inplace_concat, NULL,
|
2014-01-24 06:17:25 -08:00
|
|
|
wrap_binaryfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__iadd__($self, value, /)\n--\n\nImplement self+=value."),
|
2022-09-08 03:32:08 +05:30
|
|
|
SQSLOT(__imul__, sq_inplace_repeat, NULL,
|
2014-01-24 06:17:25 -08:00
|
|
|
wrap_indexargfunc,
|
2014-02-09 22:22:38 -08:00
|
|
|
"__imul__($self, value, /)\n--\n\nImplement self*=value."),
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
{NULL}
|
2001-10-09 19:39:46 +00:00
|
|
|
};
|
|
|
|
|
|
2002-04-04 23:44:47 +00:00
|
|
|
/* Given a type pointer and an offset gotten from a slotdef entry, return a
|
2010-05-09 15:52:27 +00:00
|
|
|
pointer to the actual slot. This is not quite the same as simply adding
|
2002-04-04 23:44:47 +00:00
|
|
|
the offset to the type pointer, since it takes care to indirect through the
|
|
|
|
|
proper indirection pointer (as_buffer, etc.); it returns NULL if the
|
|
|
|
|
indirection pointer is NULL. */
|
2001-10-09 19:39:46 +00:00
|
|
|
static void **
|
2006-02-15 17:27:45 +00:00
|
|
|
slotptr(PyTypeObject *type, int ioffset)
|
2001-10-09 19:39:46 +00:00
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
char *ptr;
|
|
|
|
|
long offset = ioffset;
|
|
|
|
|
|
|
|
|
|
/* Note: this depends on the order of the members of PyHeapTypeObject! */
|
|
|
|
|
assert(offset >= 0);
|
2023-05-04 07:59:46 -07:00
|
|
|
assert((size_t)offset < offsetof(PyHeapTypeObject, ht_name));
|
|
|
|
|
if ((size_t)offset >= offsetof(PyHeapTypeObject, as_buffer)) {
|
|
|
|
|
ptr = (char *)type->tp_as_buffer;
|
|
|
|
|
offset -= offsetof(PyHeapTypeObject, as_buffer);
|
|
|
|
|
}
|
|
|
|
|
else if ((size_t)offset >= offsetof(PyHeapTypeObject, as_sequence)) {
|
2010-05-09 15:52:27 +00:00
|
|
|
ptr = (char *)type->tp_as_sequence;
|
|
|
|
|
offset -= offsetof(PyHeapTypeObject, as_sequence);
|
|
|
|
|
}
|
|
|
|
|
else if ((size_t)offset >= offsetof(PyHeapTypeObject, as_mapping)) {
|
|
|
|
|
ptr = (char *)type->tp_as_mapping;
|
|
|
|
|
offset -= offsetof(PyHeapTypeObject, as_mapping);
|
|
|
|
|
}
|
|
|
|
|
else if ((size_t)offset >= offsetof(PyHeapTypeObject, as_number)) {
|
|
|
|
|
ptr = (char *)type->tp_as_number;
|
|
|
|
|
offset -= offsetof(PyHeapTypeObject, as_number);
|
|
|
|
|
}
|
2015-05-11 22:57:16 -04:00
|
|
|
else if ((size_t)offset >= offsetof(PyHeapTypeObject, as_async)) {
|
|
|
|
|
ptr = (char *)type->tp_as_async;
|
|
|
|
|
offset -= offsetof(PyHeapTypeObject, as_async);
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
else {
|
|
|
|
|
ptr = (char *)type;
|
|
|
|
|
}
|
|
|
|
|
if (ptr != NULL)
|
|
|
|
|
ptr += offset;
|
|
|
|
|
return (void **)ptr;
|
2001-10-09 19:39:46 +00:00
|
|
|
}
|
|
|
|
|
|
2002-04-04 23:44:47 +00:00
|
|
|
/* Return a slot pointer for a given name, but ONLY if the attribute has
|
|
|
|
|
exactly one slot function. The name must be an interned string. */
|
|
|
|
|
static void **
|
|
|
|
|
resolve_slotdups(PyTypeObject *type, PyObject *name)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
/* XXX Maybe this could be optimized more -- but is it worth it? */
|
|
|
|
|
|
|
|
|
|
/* pname and ptrs act as a little cache */
|
2023-07-02 01:44:07 +02:00
|
|
|
PyInterpreterState *interp = _PyInterpreterState_GET();
|
2022-11-14 13:50:56 -07:00
|
|
|
#define pname _Py_INTERP_CACHED_OBJECT(interp, type_slots_pname)
|
|
|
|
|
#define ptrs _Py_INTERP_CACHED_OBJECT(interp, type_slots_ptrs)
|
|
|
|
|
pytype_slotdef *p, **pp;
|
2025-04-28 23:38:29 -07:00
|
|
|
void **res, **ptr;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
if (pname != name) {
|
|
|
|
|
/* Collect all slotdefs that match name into ptrs. */
|
|
|
|
|
pname = name;
|
|
|
|
|
pp = ptrs;
|
|
|
|
|
for (p = slotdefs; p->name_strobj; p++) {
|
|
|
|
|
if (p->name_strobj == name)
|
|
|
|
|
*pp++ = p;
|
|
|
|
|
}
|
|
|
|
|
*pp = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-10 11:22:05 +02:00
|
|
|
/* Look in all slots of the type matching the name. If exactly one of these
|
|
|
|
|
has a filled-in slot, return a pointer to that slot.
|
|
|
|
|
Otherwise, return NULL. */
|
2010-05-09 15:52:27 +00:00
|
|
|
res = NULL;
|
|
|
|
|
for (pp = ptrs; *pp; pp++) {
|
|
|
|
|
ptr = slotptr(type, (*pp)->offset);
|
|
|
|
|
if (ptr == NULL || *ptr == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
if (res != NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
res = ptr;
|
|
|
|
|
}
|
2025-04-28 23:38:29 -07:00
|
|
|
return res;
|
2022-11-14 13:50:56 -07:00
|
|
|
#undef pname
|
|
|
|
|
#undef ptrs
|
2002-04-04 23:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
2019-09-10 11:22:05 +02:00
|
|
|
|
|
|
|
|
/* Common code for update_slots_callback() and fixup_slot_dispatchers().
|
|
|
|
|
*
|
|
|
|
|
* This is meant to set a "slot" like type->tp_repr or
|
|
|
|
|
* type->tp_as_sequence->sq_concat by looking up special methods like
|
|
|
|
|
* __repr__ or __add__. The opposite (adding special methods from slots) is
|
|
|
|
|
* done by add_operators(), called from PyType_Ready(). Since update_one_slot()
|
|
|
|
|
* calls PyType_Ready() if needed, the special methods are already in place.
|
|
|
|
|
*
|
|
|
|
|
* The special methods corresponding to each slot are defined in the "slotdef"
|
|
|
|
|
* array. Note that one slot may correspond to multiple special methods and vice
|
|
|
|
|
* versa. For example, tp_richcompare uses 6 methods __lt__, ..., __ge__ and
|
|
|
|
|
* tp_as_number->nb_add uses __add__ and __radd__. In the other direction,
|
|
|
|
|
* __add__ is used by the number and sequence protocols and __getitem__ by the
|
|
|
|
|
* sequence and mapping protocols. This causes a lot of complications.
|
|
|
|
|
*
|
|
|
|
|
* In detail, update_one_slot() does the following:
|
|
|
|
|
*
|
|
|
|
|
* First of all, if the slot in question does not exist, return immediately.
|
|
|
|
|
* This can happen for example if it's tp_as_number->nb_add but tp_as_number
|
|
|
|
|
* is NULL.
|
|
|
|
|
*
|
|
|
|
|
* For the given slot, we loop over all the special methods with a name
|
|
|
|
|
* corresponding to that slot (for example, for tp_descr_set, this would be
|
|
|
|
|
* __set__ and __delete__) and we look up these names in the MRO of the type.
|
|
|
|
|
* If we don't find any special method, the slot is set to NULL (regardless of
|
|
|
|
|
* what was in the slot before).
|
|
|
|
|
*
|
|
|
|
|
* Suppose that we find exactly one special method. If it's a wrapper_descriptor
|
|
|
|
|
* (i.e. a special method calling a slot, for example str.__repr__ which calls
|
|
|
|
|
* the tp_repr for the 'str' class) with the correct name ("__repr__" for
|
|
|
|
|
* tp_repr), for the right class, calling the right wrapper C function (like
|
|
|
|
|
* wrap_unaryfunc for tp_repr), then the slot is set to the slot that the
|
|
|
|
|
* wrapper_descriptor originally wrapped. For example, a class inheriting
|
|
|
|
|
* from 'str' and not redefining __repr__ will have tp_repr set to the tp_repr
|
|
|
|
|
* of 'str'.
|
|
|
|
|
* In all other cases where the special method exists, the slot is set to a
|
|
|
|
|
* wrapper calling the special method. There is one exception: if the special
|
|
|
|
|
* method is a wrapper_descriptor with the correct name but the type has
|
|
|
|
|
* precisely one slot set for that name and that slot is not the one that we
|
|
|
|
|
* are updating, then NULL is put in the slot (this exception is the only place
|
|
|
|
|
* in update_one_slot() where the *existing* slots matter).
|
|
|
|
|
*
|
|
|
|
|
* When there are multiple special methods for the same slot, the above is
|
|
|
|
|
* applied for each special method. As long as the results agree, the common
|
|
|
|
|
* resulting slot is applied. If the results disagree, then a wrapper for
|
|
|
|
|
* the special methods is installed. This is always safe, but less efficient
|
|
|
|
|
* because it uses method lookup instead of direct C calls.
|
|
|
|
|
*
|
|
|
|
|
* There are some further special cases for specific slots, like supporting
|
|
|
|
|
* __hash__ = None for tp_hash and special code for tp_new.
|
|
|
|
|
*
|
|
|
|
|
* When done, return a pointer to the next slotdef with a different offset,
|
|
|
|
|
* because that's convenient for fixup_slot_dispatchers(). This function never
|
|
|
|
|
* sets an exception: if an internal error happens (unlikely), it's ignored. */
|
2022-11-14 13:50:56 -07:00
|
|
|
static pytype_slotdef *
|
|
|
|
|
update_one_slot(PyTypeObject *type, pytype_slotdef *p)
|
2002-04-04 23:44:47 +00:00
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
2024-02-15 10:54:57 -08:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *descr;
|
|
|
|
|
PyWrapperDescrObject *d;
|
2022-08-04 17:19:29 +02:00
|
|
|
|
|
|
|
|
// The correct specialized C function, like "tp_repr of str" in the
|
|
|
|
|
// example above
|
|
|
|
|
void *specific = NULL;
|
|
|
|
|
|
|
|
|
|
// A generic wrapper that uses method lookup (safe but slow)
|
|
|
|
|
void *generic = NULL;
|
|
|
|
|
|
|
|
|
|
// Set to 1 if the generic wrapper is necessary
|
2010-05-09 15:52:27 +00:00
|
|
|
int use_generic = 0;
|
2022-08-04 17:19:29 +02:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
int offset = p->offset;
|
2017-10-01 10:37:47 +02:00
|
|
|
int error;
|
2010-05-09 15:52:27 +00:00
|
|
|
void **ptr = slotptr(type, offset);
|
|
|
|
|
|
|
|
|
|
if (ptr == NULL) {
|
|
|
|
|
do {
|
|
|
|
|
++p;
|
|
|
|
|
} while (p->offset == offset);
|
|
|
|
|
return p;
|
|
|
|
|
}
|
2017-10-01 10:37:47 +02:00
|
|
|
/* We may end up clearing live exceptions below, so make sure it's ours. */
|
|
|
|
|
assert(!PyErr_Occurred());
|
2010-05-09 15:52:27 +00:00
|
|
|
do {
|
2017-10-01 10:37:47 +02:00
|
|
|
/* Use faster uncached lookup as we won't get any cache hits during type setup. */
|
|
|
|
|
descr = find_name_in_mro(type, p->name_strobj, &error);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (descr == NULL) {
|
2017-10-01 10:37:47 +02:00
|
|
|
if (error == -1) {
|
2019-09-10 11:22:05 +02:00
|
|
|
/* It is unlikely but not impossible that there has been an exception
|
2017-10-01 10:37:47 +02:00
|
|
|
during lookup. Since this function originally expected no errors,
|
|
|
|
|
we ignore them here in order to keep up the interface. */
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
if (ptr == (void**)&type->tp_iternext) {
|
2012-09-18 21:58:03 -04:00
|
|
|
specific = (void *)_PyObject_NextNotImplemented;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2020-03-04 07:15:20 -06:00
|
|
|
if (Py_IS_TYPE(descr, &PyWrapperDescr_Type) &&
|
2012-04-24 11:06:25 -04:00
|
|
|
((PyWrapperDescrObject *)descr)->d_base->name_strobj == p->name_strobj) {
|
2010-05-09 15:52:27 +00:00
|
|
|
void **tptr = resolve_slotdups(type, p->name_strobj);
|
|
|
|
|
if (tptr == NULL || tptr == ptr)
|
|
|
|
|
generic = p->function;
|
|
|
|
|
d = (PyWrapperDescrObject *)descr;
|
2019-09-10 13:21:57 +02:00
|
|
|
if ((specific == NULL || specific == d->d_wrapped) &&
|
|
|
|
|
d->d_base->wrapper == p->wrapper &&
|
2024-03-15 12:35:29 -04:00
|
|
|
is_subtype_with_mro(lookup_tp_mro(type), type, PyDescr_TYPE(d)))
|
2010-05-09 15:52:27 +00:00
|
|
|
{
|
2019-09-10 13:21:57 +02:00
|
|
|
specific = d->d_wrapped;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* We cannot use the specific slot function because either
|
|
|
|
|
- it is not unique: there are multiple methods for this
|
|
|
|
|
slot and they conflict
|
|
|
|
|
- the signature is wrong (as checked by the ->wrapper
|
|
|
|
|
comparison above)
|
|
|
|
|
- it's wrapping the wrong class
|
|
|
|
|
*/
|
|
|
|
|
use_generic = 1;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
2020-03-04 07:15:20 -06:00
|
|
|
else if (Py_IS_TYPE(descr, &PyCFunction_Type) &&
|
2010-05-09 15:52:27 +00:00
|
|
|
PyCFunction_GET_FUNCTION(descr) ==
|
2022-05-03 21:42:14 +02:00
|
|
|
_PyCFunction_CAST(tp_new_wrapper) &&
|
2010-05-09 15:52:27 +00:00
|
|
|
ptr == (void**)&type->tp_new)
|
|
|
|
|
{
|
|
|
|
|
/* The __new__ wrapper is not a wrapper descriptor,
|
|
|
|
|
so must be special-cased differently.
|
|
|
|
|
If we don't do this, creating an instance will
|
|
|
|
|
always use slot_tp_new which will look up
|
|
|
|
|
__new__ in the MRO which will call tp_new_wrapper
|
|
|
|
|
which will look through the base classes looking
|
|
|
|
|
for a static base and call its tp_new (usually
|
|
|
|
|
PyType_GenericNew), after performing various
|
|
|
|
|
sanity checks and constructing a new argument
|
|
|
|
|
list. Cut all that nonsense short -- this speeds
|
|
|
|
|
up instance creation tremendously. */
|
2016-12-14 19:52:17 +02:00
|
|
|
specific = (void *)type->tp_new;
|
2010-05-09 15:52:27 +00:00
|
|
|
/* XXX I'm not 100% sure that there isn't a hole
|
|
|
|
|
in this reasoning that requires additional
|
|
|
|
|
sanity checks. I'll buy the first person to
|
|
|
|
|
point out a bug in this reasoning a beer. */
|
|
|
|
|
}
|
|
|
|
|
else if (descr == Py_None &&
|
|
|
|
|
ptr == (void**)&type->tp_hash) {
|
|
|
|
|
/* We specifically allow __hash__ to be set to None
|
|
|
|
|
to prevent inheritance of the default
|
|
|
|
|
implementation from object.__hash__ */
|
2012-09-18 21:58:03 -04:00
|
|
|
specific = (void *)PyObject_HashNotImplemented;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
use_generic = 1;
|
2025-04-17 13:08:59 -04:00
|
|
|
if (generic == NULL && Py_IS_TYPE(descr, &PyMethodDescr_Type) &&
|
|
|
|
|
*ptr == ((PyMethodDescrObject *)descr)->d_method->ml_meth)
|
|
|
|
|
{
|
|
|
|
|
generic = *ptr;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
generic = p->function;
|
|
|
|
|
}
|
2022-08-04 17:19:29 +02:00
|
|
|
if (p->function == slot_tp_call) {
|
|
|
|
|
/* A generic __call__ is incompatible with vectorcall */
|
2025-02-25 21:24:20 -08:00
|
|
|
type_clear_flags(type, Py_TPFLAGS_HAVE_VECTORCALL);
|
2022-08-04 17:19:29 +02:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2024-05-06 10:50:35 -07:00
|
|
|
Py_DECREF(descr);
|
2010-05-09 15:52:27 +00:00
|
|
|
} while ((++p)->offset == offset);
|
|
|
|
|
if (specific && !use_generic)
|
|
|
|
|
*ptr = specific;
|
|
|
|
|
else
|
|
|
|
|
*ptr = generic;
|
|
|
|
|
return p;
|
2002-04-04 23:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
2003-03-24 23:49:49 +00:00
|
|
|
/* In the type, update the slots whose slotdefs are gathered in the pp array.
|
|
|
|
|
This is a callback for update_subclasses(). */
|
2001-10-11 18:33:53 +00:00
|
|
|
static int
|
2003-03-24 23:49:49 +00:00
|
|
|
update_slots_callback(PyTypeObject *type, void *data)
|
2001-10-11 18:33:53 +00:00
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
2024-02-15 10:54:57 -08:00
|
|
|
|
2022-11-14 13:50:56 -07:00
|
|
|
pytype_slotdef **pp = (pytype_slotdef **)data;
|
2022-01-22 18:56:11 +01:00
|
|
|
for (; *pp; pp++) {
|
2010-05-09 15:52:27 +00:00
|
|
|
update_one_slot(type, *pp);
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
2001-10-11 18:33:53 +00:00
|
|
|
}
|
|
|
|
|
|
2002-04-04 23:44:47 +00:00
|
|
|
/* Update the slots after assignment to a class (type) attribute. */
|
2001-10-11 18:33:53 +00:00
|
|
|
static int
|
|
|
|
|
update_slot(PyTypeObject *type, PyObject *name)
|
|
|
|
|
{
|
2022-11-14 13:50:56 -07:00
|
|
|
pytype_slotdef *ptrs[MAX_EQUIV];
|
|
|
|
|
pytype_slotdef *p;
|
|
|
|
|
pytype_slotdef **pp;
|
2010-05-09 15:52:27 +00:00
|
|
|
int offset;
|
|
|
|
|
|
2025-04-28 23:38:29 -07:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
2017-05-20 08:48:06 +03:00
|
|
|
assert(PyUnicode_CheckExact(name));
|
|
|
|
|
assert(PyUnicode_CHECK_INTERNED(name));
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
pp = ptrs;
|
|
|
|
|
for (p = slotdefs; p->name; p++) {
|
2020-05-20 01:57:17 +02:00
|
|
|
assert(PyUnicode_CheckExact(p->name_strobj));
|
2022-09-08 03:32:08 +05:30
|
|
|
assert(PyUnicode_CHECK_INTERNED(p->name_strobj));
|
2020-05-20 01:57:17 +02:00
|
|
|
assert(PyUnicode_CheckExact(name));
|
2022-05-27 17:38:01 -06:00
|
|
|
/* bpo-40521: Using interned strings. */
|
2020-05-20 01:57:17 +02:00
|
|
|
if (p->name_strobj == name) {
|
|
|
|
|
*pp++ = p;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
*pp = NULL;
|
|
|
|
|
for (pp = ptrs; *pp; pp++) {
|
|
|
|
|
p = *pp;
|
|
|
|
|
offset = p->offset;
|
|
|
|
|
while (p > slotdefs && (p-1)->offset == offset)
|
|
|
|
|
--p;
|
|
|
|
|
*pp = p;
|
|
|
|
|
}
|
|
|
|
|
if (ptrs[0] == NULL)
|
|
|
|
|
return 0; /* Not an attribute that affects any slots */
|
|
|
|
|
return update_subclasses(type, name,
|
|
|
|
|
update_slots_callback, (void *)ptrs);
|
2001-10-11 18:33:53 +00:00
|
|
|
}
|
|
|
|
|
|
2002-04-04 23:44:47 +00:00
|
|
|
/* Store the proper functions in the slot dispatches at class (type)
|
|
|
|
|
definition time, based upon which operations the class overrides in its
|
|
|
|
|
dict. */
|
2001-10-09 19:39:46 +00:00
|
|
|
static void
|
|
|
|
|
fixup_slot_dispatchers(PyTypeObject *type)
|
|
|
|
|
{
|
2025-04-28 23:38:29 -07:00
|
|
|
// This lock isn't strictly necessary because the type has not been
|
|
|
|
|
// exposed to anyone else yet, but update_ont_slot calls find_name_in_mro
|
|
|
|
|
// where we'd like to assert that the type is locked.
|
|
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
assert(!PyErr_Occurred());
|
2022-11-14 13:50:56 -07:00
|
|
|
for (pytype_slotdef *p = slotdefs; p->name; ) {
|
2010-05-09 15:52:27 +00:00
|
|
|
p = update_one_slot(type, p);
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
2025-04-28 23:38:29 -07:00
|
|
|
|
|
|
|
|
END_TYPE_LOCK();
|
2001-08-02 04:15:00 +00:00
|
|
|
}
|
2001-08-24 16:47:00 +00:00
|
|
|
|
2002-11-26 14:47:27 +00:00
|
|
|
static void
|
|
|
|
|
update_all_slots(PyTypeObject* type)
|
|
|
|
|
{
|
2022-11-14 13:50:56 -07:00
|
|
|
pytype_slotdef *p;
|
2002-11-26 14:47:27 +00:00
|
|
|
|
2025-04-28 23:38:29 -07:00
|
|
|
ASSERT_TYPE_LOCK_HELD();
|
|
|
|
|
|
|
|
|
|
/* Clear the VALID_VERSION flag of 'type' and all its subclasses. */
|
|
|
|
|
type_modified_unlocked(type);
|
2019-02-20 18:29:24 +01:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
for (p = slotdefs; p->name; p++) {
|
|
|
|
|
/* update_slot returns int but can't actually fail */
|
|
|
|
|
update_slot(type, p->name_strobj);
|
|
|
|
|
}
|
2002-11-26 14:47:27 +00:00
|
|
|
}
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
|
2024-08-12 13:19:33 -06:00
|
|
|
PyObject *
|
|
|
|
|
_PyType_GetSlotWrapperNames(void)
|
|
|
|
|
{
|
|
|
|
|
size_t len = Py_ARRAY_LENGTH(slotdefs) - 1;
|
|
|
|
|
PyObject *names = PyList_New(len);
|
|
|
|
|
if (names == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
assert(slotdefs[len].name == NULL);
|
|
|
|
|
for (size_t i = 0; i < len; i++) {
|
|
|
|
|
pytype_slotdef *slotdef = &slotdefs[i];
|
|
|
|
|
assert(slotdef->name != NULL);
|
|
|
|
|
PyList_SET_ITEM(names, i, Py_NewRef(slotdef->name_strobj));
|
|
|
|
|
}
|
|
|
|
|
return names;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-09-18 01:49:43 -05:00
|
|
|
/* Call __set_name__ on all attributes (including descriptors)
|
|
|
|
|
in a newly generated type */
|
2016-07-30 16:26:03 +10:00
|
|
|
static int
|
2021-04-10 23:15:32 +02:00
|
|
|
type_new_set_names(PyTypeObject *type)
|
2016-07-30 16:26:03 +10:00
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
|
|
|
|
PyObject *names_to_set = PyDict_Copy(dict);
|
2021-04-10 23:15:32 +02:00
|
|
|
if (names_to_set == NULL) {
|
2016-11-29 09:54:17 +02:00
|
|
|
return -1;
|
2021-04-10 23:15:32 +02:00
|
|
|
}
|
2016-11-29 09:54:17 +02:00
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
Py_ssize_t i = 0;
|
|
|
|
|
PyObject *key, *value;
|
2016-11-29 09:54:17 +02:00
|
|
|
while (PyDict_Next(names_to_set, &i, &key, &value)) {
|
2022-02-08 13:39:07 -07:00
|
|
|
PyObject *set_name = _PyObject_LookupSpecial(value,
|
|
|
|
|
&_Py_ID(__set_name__));
|
2021-04-10 23:15:32 +02:00
|
|
|
if (set_name == NULL) {
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
goto error;
|
2016-10-21 17:13:31 +03:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
continue;
|
2016-07-30 16:26:03 +10:00
|
|
|
}
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
PyObject *res = PyObject_CallFunctionObjArgs(set_name, type, key, NULL);
|
|
|
|
|
Py_DECREF(set_name);
|
|
|
|
|
|
|
|
|
|
if (res == NULL) {
|
2023-04-11 11:53:06 +01:00
|
|
|
_PyErr_FormatNote(
|
2021-04-10 23:15:32 +02:00
|
|
|
"Error calling __set_name__ on '%.100s' instance %R "
|
|
|
|
|
"in '%.100s'",
|
|
|
|
|
Py_TYPE(value)->tp_name, key, type->tp_name);
|
|
|
|
|
goto error;
|
2016-11-29 09:54:17 +02:00
|
|
|
}
|
2023-04-11 11:53:06 +01:00
|
|
|
else {
|
|
|
|
|
Py_DECREF(res);
|
|
|
|
|
}
|
2016-07-30 16:26:03 +10:00
|
|
|
}
|
|
|
|
|
|
2016-11-29 09:54:17 +02:00
|
|
|
Py_DECREF(names_to_set);
|
2016-07-30 16:26:03 +10:00
|
|
|
return 0;
|
2021-04-10 23:15:32 +02:00
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
Py_DECREF(names_to_set);
|
|
|
|
|
return -1;
|
2016-07-30 16:26:03 +10:00
|
|
|
}
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
|
2016-07-30 16:26:03 +10:00
|
|
|
/* Call __init_subclass__ on the parent of a newly generated type */
|
|
|
|
|
static int
|
2021-04-10 23:15:32 +02:00
|
|
|
type_new_init_subclass(PyTypeObject *type, PyObject *kwds)
|
2016-07-30 16:26:03 +10:00
|
|
|
{
|
2016-08-22 23:33:13 +02:00
|
|
|
PyObject *args[2] = {(PyObject *)type, (PyObject *)type};
|
2023-06-30 03:05:01 +02:00
|
|
|
PyObject *super = PyObject_Vectorcall((PyObject *)&PySuper_Type,
|
|
|
|
|
args, 2, NULL);
|
2016-08-22 23:33:13 +02:00
|
|
|
if (super == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2016-07-30 16:26:03 +10:00
|
|
|
|
2022-02-08 13:39:07 -07:00
|
|
|
PyObject *func = PyObject_GetAttr(super, &_Py_ID(__init_subclass__));
|
2016-07-30 16:26:03 +10:00
|
|
|
Py_DECREF(super);
|
2016-08-22 23:33:13 +02:00
|
|
|
if (func == NULL) {
|
2016-07-30 16:26:03 +10:00
|
|
|
return -1;
|
2016-08-20 02:37:41 +02:00
|
|
|
}
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
PyObject *result = PyObject_VectorcallDict(func, NULL, 0, kwds);
|
2016-08-22 23:33:13 +02:00
|
|
|
Py_DECREF(func);
|
|
|
|
|
if (result == NULL) {
|
2016-07-30 16:26:03 +10:00
|
|
|
return -1;
|
2016-08-22 23:33:13 +02:00
|
|
|
}
|
2016-07-30 16:26:03 +10:00
|
|
|
|
2016-08-22 23:33:13 +02:00
|
|
|
Py_DECREF(result);
|
2016-07-30 16:26:03 +10:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-10 23:15:32 +02:00
|
|
|
|
2003-03-24 23:49:49 +00:00
|
|
|
/* recurse_down_subclasses() and update_subclasses() are mutually
|
|
|
|
|
recursive functions to call a callback for all subclasses,
|
2022-01-22 18:56:11 +01:00
|
|
|
but refraining from recursing into subclasses that define 'attr_name'. */
|
2003-03-24 23:49:49 +00:00
|
|
|
|
|
|
|
|
static int
|
2022-01-22 18:56:11 +01:00
|
|
|
update_subclasses(PyTypeObject *type, PyObject *attr_name,
|
2010-05-09 15:52:27 +00:00
|
|
|
update_callback callback, void *data)
|
2003-03-24 23:49:49 +00:00
|
|
|
{
|
2022-01-22 18:56:11 +01:00
|
|
|
if (callback(type, data) < 0) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
|
|
|
|
return recurse_down_subclasses(type, attr_name, callback, data);
|
2003-03-24 23:49:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2022-01-22 18:56:11 +01:00
|
|
|
recurse_down_subclasses(PyTypeObject *type, PyObject *attr_name,
|
2010-05-09 15:52:27 +00:00
|
|
|
update_callback callback, void *data)
|
|
|
|
|
{
|
2022-01-22 18:56:11 +01:00
|
|
|
// It is safe to use a borrowed reference because update_subclasses() is
|
|
|
|
|
// only used with update_slots_callback() which doesn't modify
|
|
|
|
|
// tp_subclasses.
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *subclasses = lookup_tp_subclasses(type); // borrowed ref
|
2022-01-22 18:56:11 +01:00
|
|
|
if (subclasses == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
2013-10-29 21:31:25 +01:00
|
|
|
assert(PyDict_CheckExact(subclasses));
|
2022-01-22 18:56:11 +01:00
|
|
|
|
|
|
|
|
Py_ssize_t i = 0;
|
|
|
|
|
PyObject *ref;
|
2013-10-29 21:31:25 +01:00
|
|
|
while (PyDict_Next(subclasses, &i, NULL, &ref)) {
|
2023-06-21 16:35:58 +02:00
|
|
|
PyTypeObject *subclass = type_from_ref(ref);
|
gh-94673: Always Finalize Static Builtin Types (#95153)
Static builtin types are finalized by calling _PyStaticType_Dealloc(). Before this change, we were skipping finalizing such a type if it still had subtypes (i.e. its tp_subclasses hadn't been cleared yet). The problem is that types hold several heap objects, which leak if we skip the type's finalization. This change addresses that.
For context, there's an old comment (from e9e3eab0b86) that says the following:
// If a type still has subtypes, it cannot be deallocated.
// A subtype can inherit attributes and methods of its parent type,
// and a type must no longer be used once it's deallocated.
However, it isn't clear that is actually still true. Clearing tp_dict should mean it isn't a problem.
Furthermore, the only subtypes that might still be around come from extension modules that didn't clean them up when unloaded (i.e. extensions that do not implement multi-phase initialization, AKA PEP 489). Those objects are already leaking, so this change doesn't change anything in that regard. Instead, this change means more objects gets cleaned up that before.
2022-07-25 14:23:41 -06:00
|
|
|
if (subclass == NULL) {
|
2010-05-09 15:52:27 +00:00
|
|
|
continue;
|
2022-01-21 21:39:01 +01:00
|
|
|
}
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Avoid recursing down into unaffected classes */
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(subclass);
|
2019-02-25 17:59:46 +02:00
|
|
|
if (dict != NULL && PyDict_Check(dict)) {
|
2022-01-22 18:56:11 +01:00
|
|
|
int r = PyDict_Contains(dict, attr_name);
|
2020-10-26 12:47:57 +02:00
|
|
|
if (r < 0) {
|
2023-06-21 16:35:58 +02:00
|
|
|
Py_DECREF(subclass);
|
2019-02-25 17:59:46 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
if (r > 0) {
|
2023-06-21 16:35:58 +02:00
|
|
|
Py_DECREF(subclass);
|
2022-01-22 18:56:11 +01:00
|
|
|
continue;
|
|
|
|
|
}
|
2019-02-25 17:59:46 +02:00
|
|
|
}
|
2022-01-22 18:56:11 +01:00
|
|
|
|
|
|
|
|
if (update_subclasses(subclass, attr_name, callback, data) < 0) {
|
2023-06-21 16:35:58 +02:00
|
|
|
Py_DECREF(subclass);
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2022-01-22 18:56:11 +01:00
|
|
|
}
|
2023-06-21 16:35:58 +02:00
|
|
|
Py_DECREF(subclass);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
return 0;
|
2003-03-24 23:49:49 +00:00
|
|
|
}
|
|
|
|
|
|
2024-09-09 08:04:58 -06:00
|
|
|
static int
|
|
|
|
|
slot_inherited(PyTypeObject *type, pytype_slotdef *slotdef, void **slot)
|
|
|
|
|
{
|
|
|
|
|
void **slot_base = slotptr(type->tp_base, slotdef->offset);
|
|
|
|
|
if (slot_base == NULL || *slot != *slot_base) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Some slots are inherited in pairs. */
|
|
|
|
|
if (slot == (void *)&type->tp_hash) {
|
|
|
|
|
return (type->tp_richcompare == type->tp_base->tp_richcompare);
|
|
|
|
|
}
|
|
|
|
|
else if (slot == (void *)&type->tp_richcompare) {
|
|
|
|
|
return (type->tp_hash == type->tp_base->tp_hash);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* It must be inherited (see type_ready_inherit()). */
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-21 00:44:31 +00:00
|
|
|
/* This function is called by PyType_Ready() to populate the type's
|
|
|
|
|
dictionary with method descriptors for function slots. For each
|
2002-06-13 19:17:46 +00:00
|
|
|
function slot (like tp_repr) that's defined in the type, one or more
|
|
|
|
|
corresponding descriptors are added in the type's tp_dict dictionary
|
2010-05-09 15:52:27 +00:00
|
|
|
under the appropriate name (like __repr__). Some function slots
|
2002-06-13 19:17:46 +00:00
|
|
|
cause more than one descriptor to be added (for example, the nb_add
|
|
|
|
|
slot adds both __add__ and __radd__ descriptors) and some function
|
|
|
|
|
slots compete for the same descriptor (for example both sq_item and
|
|
|
|
|
mp_subscript generate a __getitem__ descriptor).
|
|
|
|
|
|
2011-03-16 11:05:33 +02:00
|
|
|
In the latter case, the first slotdef entry encountered wins. Since
|
2003-03-23 05:35:36 +00:00
|
|
|
slotdef entries are sorted by the offset of the slot in the
|
2003-03-07 15:13:17 +00:00
|
|
|
PyHeapTypeObject, this gives us some control over disambiguating
|
2003-03-24 23:49:49 +00:00
|
|
|
between competing slots: the members of PyHeapTypeObject are listed
|
|
|
|
|
from most general to least general, so the most general slot is
|
|
|
|
|
preferred. In particular, because as_mapping comes before as_sequence,
|
|
|
|
|
for a type that defines both mp_subscript and sq_item, mp_subscript
|
|
|
|
|
wins.
|
2002-06-13 19:17:46 +00:00
|
|
|
|
|
|
|
|
This only adds new descriptors and doesn't overwrite entries in
|
|
|
|
|
tp_dict that were previously defined. The descriptors contain a
|
|
|
|
|
reference to the C function they must call, so that it's safe if they
|
|
|
|
|
are copied into a subtype's __dict__ and the subtype has a different
|
|
|
|
|
C function in its slot -- calling the method defined by the
|
|
|
|
|
descriptor will call the C function that was used to create it,
|
|
|
|
|
rather than the C function present in the slot when it is called.
|
|
|
|
|
(This is important because a subtype may have a C function in the
|
|
|
|
|
slot that calls the method from the dictionary, and we want to avoid
|
|
|
|
|
infinite recursion here.) */
|
2001-10-21 00:44:31 +00:00
|
|
|
|
|
|
|
|
static int
|
2024-09-09 08:04:58 -06:00
|
|
|
add_operators(PyTypeObject *type)
|
2001-10-21 00:44:31 +00:00
|
|
|
{
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(type);
|
2022-11-14 13:50:56 -07:00
|
|
|
pytype_slotdef *p;
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject *descr;
|
|
|
|
|
void **ptr;
|
|
|
|
|
|
|
|
|
|
for (p = slotdefs; p->name; p++) {
|
|
|
|
|
if (p->wrapper == NULL)
|
|
|
|
|
continue;
|
2024-09-09 08:04:58 -06:00
|
|
|
ptr = slotptr(type, p->offset);
|
2010-05-09 15:52:27 +00:00
|
|
|
if (!ptr || !*ptr)
|
|
|
|
|
continue;
|
2024-09-09 08:04:58 -06:00
|
|
|
/* Also ignore when the type slot has been inherited. */
|
|
|
|
|
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN
|
|
|
|
|
&& type->tp_base != NULL
|
|
|
|
|
&& slot_inherited(type, p, ptr))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2020-10-26 12:47:57 +02:00
|
|
|
int r = PyDict_Contains(dict, p->name_strobj);
|
|
|
|
|
if (r > 0)
|
2010-05-09 15:52:27 +00:00
|
|
|
continue;
|
2020-10-26 12:47:57 +02:00
|
|
|
if (r < 0) {
|
2019-02-25 17:59:46 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2012-09-18 21:58:03 -04:00
|
|
|
if (*ptr == (void *)PyObject_HashNotImplemented) {
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Classes may prevent the inheritance of the tp_hash
|
|
|
|
|
slot by storing PyObject_HashNotImplemented in it. Make it
|
|
|
|
|
visible as a None value for the __hash__ attribute. */
|
|
|
|
|
if (PyDict_SetItem(dict, p->name_strobj, Py_None) < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
descr = PyDescr_NewWrapper(type, p, *ptr);
|
|
|
|
|
if (descr == NULL)
|
|
|
|
|
return -1;
|
2016-07-06 23:26:32 -07:00
|
|
|
if (PyDict_SetItem(dict, p->name_strobj, descr) < 0) {
|
|
|
|
|
Py_DECREF(descr);
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2016-07-06 23:26:32 -07:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_DECREF(descr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2001-10-21 00:44:31 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-24 16:47:00 +00:00
|
|
|
|
2024-10-25 11:12:48 +02:00
|
|
|
int
|
|
|
|
|
PyType_Freeze(PyTypeObject *type)
|
|
|
|
|
{
|
|
|
|
|
// gh-121654: Check the __mro__ instead of __bases__
|
2025-02-25 11:44:59 +01:00
|
|
|
PyObject *mro = type_get_mro((PyObject *)type, NULL);
|
2024-10-25 11:12:48 +02:00
|
|
|
if (!PyTuple_Check(mro)) {
|
|
|
|
|
Py_DECREF(mro);
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "unable to get the type MRO");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int check = check_immutable_bases(type->tp_name, mro, 1);
|
|
|
|
|
Py_DECREF(mro);
|
|
|
|
|
if (check < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-25 21:24:20 -08:00
|
|
|
BEGIN_TYPE_LOCK();
|
|
|
|
|
type_add_flags(type, Py_TPFLAGS_IMMUTABLETYPE);
|
|
|
|
|
type_modified_unlocked(type);
|
|
|
|
|
END_TYPE_LOCK();
|
2024-10-25 11:12:48 +02:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-08-24 16:47:00 +00:00
|
|
|
/* Cooperative 'super' */
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyObject_HEAD
|
|
|
|
|
PyTypeObject *type;
|
|
|
|
|
PyObject *obj;
|
|
|
|
|
PyTypeObject *obj_type;
|
2001-08-24 16:47:00 +00:00
|
|
|
} superobject;
|
|
|
|
|
|
2025-02-25 11:44:59 +01:00
|
|
|
#define superobject_CAST(op) ((superobject *)(op))
|
|
|
|
|
|
2001-09-20 20:46:19 +00:00
|
|
|
static PyMemberDef super_members[] = {
|
2023-07-25 15:28:30 +02:00
|
|
|
{"__thisclass__", _Py_T_OBJECT, offsetof(superobject, type), Py_READONLY,
|
2010-05-09 15:52:27 +00:00
|
|
|
"the class invoking super()"},
|
2023-07-25 15:28:30 +02:00
|
|
|
{"__self__", _Py_T_OBJECT, offsetof(superobject, obj), Py_READONLY,
|
2010-05-09 15:52:27 +00:00
|
|
|
"the instance invoking super(); may be None"},
|
2023-07-25 15:28:30 +02:00
|
|
|
{"__self_class__", _Py_T_OBJECT, offsetof(superobject, obj_type), Py_READONLY,
|
2010-05-09 15:52:27 +00:00
|
|
|
"the type of the instance invoking super(); may be None"},
|
|
|
|
|
{0}
|
2001-08-30 23:13:11 +00:00
|
|
|
};
|
|
|
|
|
|
2001-08-24 16:47:00 +00:00
|
|
|
static void
|
|
|
|
|
super_dealloc(PyObject *self)
|
|
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
superobject *su = superobject_CAST(self);
|
2001-08-24 16:47:00 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
_PyObject_GC_UNTRACK(self);
|
|
|
|
|
Py_XDECREF(su->obj);
|
|
|
|
|
Py_XDECREF(su->type);
|
|
|
|
|
Py_XDECREF(su->obj_type);
|
|
|
|
|
Py_TYPE(self)->tp_free(self);
|
2001-08-24 16:47:00 +00:00
|
|
|
}
|
|
|
|
|
|
2001-08-30 23:13:11 +00:00
|
|
|
static PyObject *
|
|
|
|
|
super_repr(PyObject *self)
|
|
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
superobject *su = superobject_CAST(self);
|
2001-08-30 23:13:11 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
if (su->obj_type)
|
|
|
|
|
return PyUnicode_FromFormat(
|
|
|
|
|
"<super: <class '%s'>, <%s object>>",
|
|
|
|
|
su->type ? su->type->tp_name : "NULL",
|
|
|
|
|
su->obj_type->tp_name);
|
|
|
|
|
else
|
|
|
|
|
return PyUnicode_FromFormat(
|
|
|
|
|
"<super: <class '%s'>, NULL>",
|
|
|
|
|
su->type ? su->type->tp_name : "NULL");
|
2001-08-30 23:13:11 +00:00
|
|
|
}
|
|
|
|
|
|
2023-04-25 11:45:51 -06:00
|
|
|
/* Do a super lookup without executing descriptors or falling back to getattr
|
|
|
|
|
on the super object itself.
|
|
|
|
|
|
|
|
|
|
May return NULL with or without an exception set, like PyDict_GetItemWithError. */
|
2001-08-24 16:47:00 +00:00
|
|
|
static PyObject *
|
2023-04-25 11:45:51 -06:00
|
|
|
_super_lookup_descr(PyTypeObject *su_type, PyTypeObject *su_obj_type, PyObject *name)
|
2001-08-24 16:47:00 +00:00
|
|
|
{
|
2023-04-24 16:22:14 -06:00
|
|
|
PyObject *mro, *res;
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_ssize_t i, n;
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2024-02-15 10:54:57 -08:00
|
|
|
BEGIN_TYPE_LOCK();
|
2023-05-01 20:34:43 -06:00
|
|
|
mro = lookup_tp_mro(su_obj_type);
|
2024-02-15 10:54:57 -08:00
|
|
|
/* keep a strong reference to mro because su_obj_type->tp_mro can be
|
|
|
|
|
replaced during PyDict_GetItemRef(dict, name, &res) and because
|
|
|
|
|
another thread can modify it after we end the critical section
|
|
|
|
|
below */
|
|
|
|
|
Py_XINCREF(mro);
|
2024-06-21 15:50:18 -04:00
|
|
|
END_TYPE_LOCK();
|
2024-02-15 10:54:57 -08:00
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
if (mro == NULL)
|
2023-04-25 11:45:51 -06:00
|
|
|
return NULL;
|
2015-02-05 22:29:14 -05:00
|
|
|
|
|
|
|
|
assert(PyTuple_Check(mro));
|
|
|
|
|
n = PyTuple_GET_SIZE(mro);
|
|
|
|
|
|
|
|
|
|
/* No need to check the last one: it's gonna be skipped anyway. */
|
|
|
|
|
for (i = 0; i+1 < n; i++) {
|
2023-04-24 16:22:14 -06:00
|
|
|
if ((PyObject *)(su_type) == PyTuple_GET_ITEM(mro, i))
|
2015-02-05 22:29:14 -05:00
|
|
|
break;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
i++; /* skip su->type (if any) */
|
2024-02-15 10:54:57 -08:00
|
|
|
if (i >= n) {
|
|
|
|
|
Py_DECREF(mro);
|
2023-04-25 11:45:51 -06:00
|
|
|
return NULL;
|
2024-02-15 10:54:57 -08:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2015-02-05 22:29:14 -05:00
|
|
|
do {
|
2022-01-21 21:39:01 +01:00
|
|
|
PyObject *obj = PyTuple_GET_ITEM(mro, i);
|
2023-05-01 20:34:43 -06:00
|
|
|
PyObject *dict = lookup_tp_dict(_PyType_CAST(obj));
|
2015-02-05 22:29:14 -05:00
|
|
|
assert(dict != NULL && PyDict_Check(dict));
|
|
|
|
|
|
2023-11-14 11:25:39 +02:00
|
|
|
if (PyDict_GetItemRef(dict, name, &res) != 0) {
|
|
|
|
|
// found or error
|
2015-02-05 22:29:14 -05:00
|
|
|
Py_DECREF(mro);
|
|
|
|
|
return res;
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
} while (i < n);
|
|
|
|
|
Py_DECREF(mro);
|
2023-04-25 11:45:51 -06:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if `method` is non-NULL, we are looking for a method descriptor,
|
|
|
|
|
// and setting `*method = 1` means we found one.
|
|
|
|
|
static PyObject *
|
|
|
|
|
do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj,
|
|
|
|
|
PyTypeObject *su_obj_type, PyObject *name, int *method)
|
|
|
|
|
{
|
|
|
|
|
PyObject *res;
|
|
|
|
|
int temp_su = 0;
|
|
|
|
|
|
|
|
|
|
if (su_obj_type == NULL) {
|
|
|
|
|
goto skip;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res = _super_lookup_descr(su_type, su_obj_type, name);
|
|
|
|
|
if (res != NULL) {
|
|
|
|
|
if (method && _PyType_HasFeature(Py_TYPE(res), Py_TPFLAGS_METHOD_DESCRIPTOR)) {
|
|
|
|
|
*method = 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
descrgetfunc f = Py_TYPE(res)->tp_descr_get;
|
|
|
|
|
if (f != NULL) {
|
|
|
|
|
PyObject *res2;
|
|
|
|
|
res2 = f(res,
|
|
|
|
|
/* Only pass 'obj' param if this is instance-mode super
|
|
|
|
|
(See SF ID #743627) */
|
|
|
|
|
(su_obj == (PyObject *)su_obj_type) ? NULL : su_obj,
|
|
|
|
|
(PyObject *)su_obj_type);
|
|
|
|
|
Py_SETREF(res, res2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
else if (PyErr_Occurred()) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2015-02-05 22:29:14 -05:00
|
|
|
|
|
|
|
|
skip:
|
2023-04-24 16:22:14 -06:00
|
|
|
if (su == NULL) {
|
|
|
|
|
PyObject *args[] = {(PyObject *)su_type, su_obj};
|
|
|
|
|
su = (superobject *)PyObject_Vectorcall((PyObject *)&PySuper_Type, args, 2, NULL);
|
|
|
|
|
if (su == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
temp_su = 1;
|
|
|
|
|
}
|
|
|
|
|
res = PyObject_GenericGetAttr((PyObject *)su, name);
|
|
|
|
|
if (temp_su) {
|
|
|
|
|
Py_DECREF(su);
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
|
super_getattro(PyObject *self, PyObject *name)
|
|
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
superobject *su = superobject_CAST(self);
|
2023-04-24 16:22:14 -06:00
|
|
|
|
|
|
|
|
/* We want __class__ to return the class of the super object
|
|
|
|
|
(i.e. super, or a subclass), not the class of su->obj. */
|
|
|
|
|
if (PyUnicode_Check(name) &&
|
|
|
|
|
PyUnicode_GET_LENGTH(name) == 9 &&
|
|
|
|
|
_PyUnicode_Equal(name, &_Py_ID(__class__)))
|
|
|
|
|
return PyObject_GenericGetAttr(self, name);
|
|
|
|
|
|
|
|
|
|
return do_super_lookup(su, su->type, su->obj, su->obj_type, name, NULL);
|
2001-08-24 16:47:00 +00:00
|
|
|
}
|
|
|
|
|
|
2003-02-12 03:58:38 +00:00
|
|
|
static PyTypeObject *
|
2001-12-03 15:38:28 +00:00
|
|
|
supercheck(PyTypeObject *type, PyObject *obj)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
/* Check that a super() call makes sense. Return a type object.
|
|
|
|
|
|
2011-12-12 18:54:29 +01:00
|
|
|
obj can be a class, or an instance of one:
|
2010-05-09 15:52:27 +00:00
|
|
|
|
|
|
|
|
- If it is a class, it must be a subclass of 'type'. This case is
|
|
|
|
|
used for class methods; the return value is obj.
|
|
|
|
|
|
|
|
|
|
- If it is an instance, it must be an instance of 'type'. This is
|
|
|
|
|
the normal case; the return value is obj.__class__.
|
|
|
|
|
|
|
|
|
|
But... when obj is an instance, we want to allow for the case where
|
|
|
|
|
Py_TYPE(obj) is not a subclass of type, but obj.__class__ is!
|
|
|
|
|
This will allow using super() with a proxy for obj.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Check for first bullet above (special case) */
|
|
|
|
|
if (PyType_Check(obj) && PyType_IsSubtype((PyTypeObject *)obj, type)) {
|
2022-11-10 23:40:31 +01:00
|
|
|
return (PyTypeObject *)Py_NewRef(obj);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Normal case */
|
|
|
|
|
if (PyType_IsSubtype(Py_TYPE(obj), type)) {
|
2022-11-10 23:40:31 +01:00
|
|
|
return (PyTypeObject*)Py_NewRef(Py_TYPE(obj));
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Try the slow way */
|
|
|
|
|
PyObject *class_attr;
|
|
|
|
|
|
2023-07-12 08:57:10 +03:00
|
|
|
if (PyObject_GetOptionalAttr(obj, &_Py_ID(__class__), &class_attr) < 0) {
|
2019-09-01 12:03:39 +03:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
if (class_attr != NULL &&
|
|
|
|
|
PyType_Check(class_attr) &&
|
|
|
|
|
(PyTypeObject *)class_attr != Py_TYPE(obj))
|
|
|
|
|
{
|
|
|
|
|
int ok = PyType_IsSubtype(
|
|
|
|
|
(PyTypeObject *)class_attr, type);
|
2022-01-21 21:39:01 +01:00
|
|
|
if (ok) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return (PyTypeObject *)class_attr;
|
2022-01-21 21:39:01 +01:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2019-09-01 12:03:39 +03:00
|
|
|
Py_XDECREF(class_attr);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
|
|
|
|
|
2023-12-22 16:12:08 +01:00
|
|
|
const char *type_or_instance, *obj_str;
|
|
|
|
|
|
|
|
|
|
if (PyType_Check(obj)) {
|
|
|
|
|
type_or_instance = "type";
|
|
|
|
|
obj_str = ((PyTypeObject*)obj)->tp_name;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
type_or_instance = "instance of";
|
|
|
|
|
obj_str = Py_TYPE(obj)->tp_name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"super(type, obj): obj (%s %.200s) is not "
|
|
|
|
|
"an instance or subtype of type (%.200s).",
|
|
|
|
|
type_or_instance, obj_str, type->tp_name);
|
|
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
2001-12-03 15:38:28 +00:00
|
|
|
}
|
|
|
|
|
|
2023-04-24 16:22:14 -06:00
|
|
|
PyObject *
|
|
|
|
|
_PySuper_Lookup(PyTypeObject *su_type, PyObject *su_obj, PyObject *name, int *method)
|
|
|
|
|
{
|
|
|
|
|
PyTypeObject *su_obj_type = supercheck(su_type, su_obj);
|
|
|
|
|
if (su_obj_type == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
PyObject *res = do_super_lookup(NULL, su_type, su_obj, su_obj_type, name, method);
|
|
|
|
|
Py_DECREF(su_obj_type);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-24 16:47:00 +00:00
|
|
|
static PyObject *
|
|
|
|
|
super_descr_get(PyObject *self, PyObject *obj, PyObject *type)
|
|
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
superobject *su = superobject_CAST(self);
|
2010-05-09 15:52:27 +00:00
|
|
|
superobject *newobj;
|
|
|
|
|
|
|
|
|
|
if (obj == NULL || obj == Py_None || su->obj != NULL) {
|
|
|
|
|
/* Not binding to an object, or already bound */
|
2022-11-10 23:40:31 +01:00
|
|
|
return Py_NewRef(self);
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2020-03-06 16:53:17 -06:00
|
|
|
if (!Py_IS_TYPE(su, &PySuper_Type))
|
2010-05-09 15:52:27 +00:00
|
|
|
/* If su is an instance of a (strict) subclass of super,
|
|
|
|
|
call its type */
|
|
|
|
|
return PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(su),
|
|
|
|
|
su->type, obj, NULL);
|
|
|
|
|
else {
|
|
|
|
|
/* Inline the common case */
|
|
|
|
|
PyTypeObject *obj_type = supercheck(su->type, obj);
|
|
|
|
|
if (obj_type == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
newobj = (superobject *)PySuper_Type.tp_new(&PySuper_Type,
|
|
|
|
|
NULL, NULL);
|
2023-05-12 00:11:27 -07:00
|
|
|
if (newobj == NULL) {
|
|
|
|
|
Py_DECREF(obj_type);
|
2010-05-09 15:52:27 +00:00
|
|
|
return NULL;
|
2023-05-12 00:11:27 -07:00
|
|
|
}
|
2022-11-10 23:40:31 +01:00
|
|
|
newobj->type = (PyTypeObject*)Py_NewRef(su->type);
|
|
|
|
|
newobj->obj = Py_NewRef(obj);
|
2010-05-09 15:52:27 +00:00
|
|
|
newobj->obj_type = obj_type;
|
|
|
|
|
return (PyObject *)newobj;
|
|
|
|
|
}
|
2001-08-24 16:47:00 +00:00
|
|
|
}
|
|
|
|
|
|
2020-04-29 02:28:23 +02:00
|
|
|
static int
|
2024-11-04 11:13:32 -08:00
|
|
|
super_init_without_args(_PyInterpreterFrame *cframe, PyTypeObject **type_p,
|
|
|
|
|
PyObject **obj_p)
|
2020-04-29 02:28:23 +02:00
|
|
|
{
|
2024-11-04 11:13:32 -08:00
|
|
|
PyCodeObject *co = _PyFrame_GetCode(cframe);
|
2020-04-29 02:28:23 +02:00
|
|
|
if (co->co_argcount == 0) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
|
|
|
|
"super(): no arguments");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-14 13:46:37 +01:00
|
|
|
assert(_PyFrame_GetCode(cframe)->co_nlocalsplus > 0);
|
2024-06-27 03:10:43 +08:00
|
|
|
PyObject *firstarg = PyStackRef_AsPyObjectBorrow(_PyFrame_GetLocalsArray(cframe)[0]);
|
2024-12-03 10:33:06 -08:00
|
|
|
if (firstarg == NULL) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError, "super(): arg[0] deleted");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2021-06-15 16:35:25 -06:00
|
|
|
// The first argument might be a cell.
|
2024-12-03 10:33:06 -08:00
|
|
|
// "firstarg" is a cell here unless (very unlikely) super()
|
|
|
|
|
// was called from the C-API before the first MAKE_CELL op.
|
|
|
|
|
if ((_PyLocals_GetKind(co->co_localspluskinds, 0) & CO_FAST_CELL) &&
|
|
|
|
|
(_PyInterpreterFrame_LASTI(cframe) >= 0)) {
|
|
|
|
|
// MAKE_CELL and COPY_FREE_VARS have no quickened forms, so no need
|
|
|
|
|
// to use _PyOpcode_Deopt here:
|
|
|
|
|
assert(_PyCode_CODE(co)[0].op.code == MAKE_CELL ||
|
|
|
|
|
_PyCode_CODE(co)[0].op.code == COPY_FREE_VARS);
|
|
|
|
|
assert(PyCell_Check(firstarg));
|
|
|
|
|
firstarg = PyCell_GetRef((PyCellObject *)firstarg);
|
|
|
|
|
if (firstarg == NULL) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError, "super(): arg[0] deleted");
|
|
|
|
|
return -1;
|
2020-04-29 02:28:23 +02:00
|
|
|
}
|
|
|
|
|
}
|
2024-12-03 10:33:06 -08:00
|
|
|
else {
|
|
|
|
|
Py_INCREF(firstarg);
|
2020-04-29 02:28:23 +02:00
|
|
|
}
|
|
|
|
|
|
2021-06-07 12:22:26 -06:00
|
|
|
// Look for __class__ in the free vars.
|
2020-04-29 02:28:23 +02:00
|
|
|
PyTypeObject *type = NULL;
|
2024-03-19 12:20:38 +03:00
|
|
|
int i = PyUnstable_Code_GetFirstFree(co);
|
2021-06-07 12:22:26 -06:00
|
|
|
for (; i < co->co_nlocalsplus; i++) {
|
2021-06-21 13:53:04 -07:00
|
|
|
assert((_PyLocals_GetKind(co->co_localspluskinds, i) & CO_FAST_FREE) != 0);
|
2021-06-07 12:22:26 -06:00
|
|
|
PyObject *name = PyTuple_GET_ITEM(co->co_localsplusnames, i);
|
2020-04-29 02:28:23 +02:00
|
|
|
assert(PyUnicode_Check(name));
|
2022-02-08 13:39:07 -07:00
|
|
|
if (_PyUnicode_Equal(name, &_Py_ID(__class__))) {
|
2024-06-27 03:10:43 +08:00
|
|
|
PyObject *cell = PyStackRef_AsPyObjectBorrow(_PyFrame_GetLocalsArray(cframe)[i]);
|
2020-04-29 02:28:23 +02:00
|
|
|
if (cell == NULL || !PyCell_Check(cell)) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
|
|
|
|
"super(): bad __class__ cell");
|
2024-12-03 10:33:06 -08:00
|
|
|
Py_DECREF(firstarg);
|
2020-04-29 02:28:23 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
2024-12-03 10:33:06 -08:00
|
|
|
type = (PyTypeObject *) PyCell_GetRef((PyCellObject *)cell);
|
2020-04-29 02:28:23 +02:00
|
|
|
if (type == NULL) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
|
|
|
|
"super(): empty __class__ cell");
|
2024-12-03 10:33:06 -08:00
|
|
|
Py_DECREF(firstarg);
|
2020-04-29 02:28:23 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!PyType_Check(type)) {
|
|
|
|
|
PyErr_Format(PyExc_RuntimeError,
|
|
|
|
|
"super(): __class__ is not a type (%s)",
|
|
|
|
|
Py_TYPE(type)->tp_name);
|
2024-12-03 10:33:06 -08:00
|
|
|
Py_DECREF(type);
|
|
|
|
|
Py_DECREF(firstarg);
|
2020-04-29 02:28:23 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (type == NULL) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
|
|
|
|
"super(): __class__ cell not found");
|
2024-12-03 10:33:06 -08:00
|
|
|
Py_DECREF(firstarg);
|
2020-04-29 02:28:23 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*type_p = type;
|
2021-06-15 16:35:25 -06:00
|
|
|
*obj_p = firstarg;
|
2020-04-29 02:28:23 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-06 14:21:28 +08:00
|
|
|
static int super_init_impl(PyObject *self, PyTypeObject *type, PyObject *obj);
|
|
|
|
|
|
2001-08-24 16:47:00 +00:00
|
|
|
static int
|
|
|
|
|
super_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|
|
|
|
{
|
2010-05-09 15:52:27 +00:00
|
|
|
PyTypeObject *type = NULL;
|
|
|
|
|
PyObject *obj = NULL;
|
|
|
|
|
|
|
|
|
|
if (!_PyArg_NoKeywords("super", kwds))
|
|
|
|
|
return -1;
|
|
|
|
|
if (!PyArg_ParseTuple(args, "|O!O:super", &PyType_Type, &type, &obj))
|
|
|
|
|
return -1;
|
2022-03-06 14:21:28 +08:00
|
|
|
if (super_init_impl(self, type, obj) < 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2022-03-06 14:21:28 +08:00
|
|
|
static inline int
|
|
|
|
|
super_init_impl(PyObject *self, PyTypeObject *type, PyObject *obj) {
|
2025-02-25 11:44:59 +01:00
|
|
|
superobject *su = superobject_CAST(self);
|
2022-03-06 14:21:28 +08:00
|
|
|
PyTypeObject *obj_type = NULL;
|
2010-05-09 15:52:27 +00:00
|
|
|
if (type == NULL) {
|
|
|
|
|
/* Call super(), without args -- fill in from __class__
|
|
|
|
|
and first local variable on the stack. */
|
2020-04-29 02:28:23 +02:00
|
|
|
PyThreadState *tstate = _PyThreadState_GET();
|
2023-01-09 12:20:04 -08:00
|
|
|
_PyInterpreterFrame *frame = _PyThreadState_GetFrame(tstate);
|
|
|
|
|
if (frame == NULL) {
|
2014-05-13 01:32:36 +02:00
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
|
|
|
|
"super(): no current frame");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2024-11-04 11:13:32 -08:00
|
|
|
int res = super_init_without_args(frame, &type, &obj);
|
2020-04-29 02:28:23 +02:00
|
|
|
|
|
|
|
|
if (res < 0) {
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
Merged revisions 55817-55961 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55837 | guido.van.rossum | 2007-06-08 16:04:42 -0700 (Fri, 08 Jun 2007) | 2 lines
PEP 3119 -- the abc module.
................
r55838 | guido.van.rossum | 2007-06-08 17:38:55 -0700 (Fri, 08 Jun 2007) | 2 lines
Implement part of PEP 3119 -- One Trick Ponies.
................
r55847 | guido.van.rossum | 2007-06-09 08:28:06 -0700 (Sat, 09 Jun 2007) | 2 lines
Different way to do one trick ponies, allowing registration (per PEP strawman).
................
r55849 | guido.van.rossum | 2007-06-09 18:06:38 -0700 (Sat, 09 Jun 2007) | 3 lines
Make sure that the magic looking for __hash__ (etc.) doesn't apply to
real subclasses of Hashable.
................
r55852 | guido.van.rossum | 2007-06-10 08:29:51 -0700 (Sun, 10 Jun 2007) | 2 lines
Add some more examples, e.g. generators and dict views.
................
r55853 | guido.van.rossum | 2007-06-10 08:31:59 -0700 (Sun, 10 Jun 2007) | 2 lines
keys() and items() *are* containers -- just values() isn't.
................
r55864 | georg.brandl | 2007-06-10 15:29:40 -0700 (Sun, 10 Jun 2007) | 2 lines
PEP 3127: new octal literals, binary literals.
................
r55865 | georg.brandl | 2007-06-10 15:31:37 -0700 (Sun, 10 Jun 2007) | 2 lines
Some octal literal fixes in Tools.
................
r55866 | georg.brandl | 2007-06-10 15:37:43 -0700 (Sun, 10 Jun 2007) | 2 lines
Tokenizer changes for PEP 3127.
................
r55867 | georg.brandl | 2007-06-10 15:37:55 -0700 (Sun, 10 Jun 2007) | 2 lines
Some docs for PEP 3127.
................
r55868 | georg.brandl | 2007-06-10 15:44:39 -0700 (Sun, 10 Jun 2007) | 2 lines
Missed a place in intobject.c. Is that used anymore anyway?
................
r55871 | neal.norwitz | 2007-06-10 18:31:49 -0700 (Sun, 10 Jun 2007) | 182 lines
Merged revisions 55729-55868 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55731 | neal.norwitz | 2007-06-01 00:29:12 -0700 (Fri, 01 Jun 2007) | 7 lines
SF 1668596/1720897: distutils now copies data files
even if package_dir is empty.
This needs to be backported. I'm too tired tonight. It would be great
if someone backports this if the buildbots are ok with it. Otherwise,
I will try to get to it tomorrow.
........
r55732 | georg.brandl | 2007-06-01 04:33:33 -0700 (Fri, 01 Jun 2007) | 2 lines
Bug #1722484: remove docstrings again when running with -OO.
........
r55735 | georg.brandl | 2007-06-01 12:20:27 -0700 (Fri, 01 Jun 2007) | 2 lines
Fix wrong issue number.
........
r55739 | brett.cannon | 2007-06-01 20:02:29 -0700 (Fri, 01 Jun 2007) | 3 lines
Have configure raise an error when building on AtheOS. Code specific to AtheOS
will be removed in Python 2.7.
........
r55746 | neal.norwitz | 2007-06-02 11:33:53 -0700 (Sat, 02 Jun 2007) | 1 line
Update expected birthday of 2.6
........
r55751 | neal.norwitz | 2007-06-03 13:32:50 -0700 (Sun, 03 Jun 2007) | 10 lines
Backout the original 'fix' to 1721309 which had no effect.
Different versions of Berkeley DB handle this differently.
The comments and bug report should have the details. Memory is allocated
in 4.4 (and presumably earlier), but not in 4.5. Thus
4.5 has the free error, but not earlier versions.
Mostly update comments, plus make the free conditional.
This fix was already applied to the 2.5 branch.
........
r55752 | brett.cannon | 2007-06-03 16:13:41 -0700 (Sun, 03 Jun 2007) | 6 lines
Make _strptime.TimeRE().pattern() use ``\s+`` for matching whitespace instead
of ``\s*``. This prevents patterns from "stealing" bits from other patterns in
order to make a match work.
Closes bug #1730389. Will be backported.
........
r55766 | hyeshik.chang | 2007-06-05 11:16:52 -0700 (Tue, 05 Jun 2007) | 4 lines
Fix build on FreeBSD. Bluetooth HCI API in FreeBSD is quite different
from Linux's. Just fix the build for now but the code doesn't
support the complete capability of HCI on FreeBSD yet.
........
r55770 | hyeshik.chang | 2007-06-05 11:58:51 -0700 (Tue, 05 Jun 2007) | 4 lines
Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it
reads a file that ends with incomplete sequence and sizehint argument
for .read() is specified.
........
r55775 | hyeshik.chang | 2007-06-05 12:28:15 -0700 (Tue, 05 Jun 2007) | 2 lines
Fix for Windows: close a temporary file before trying to delete it.
........
r55783 | guido.van.rossum | 2007-06-05 14:24:47 -0700 (Tue, 05 Jun 2007) | 2 lines
Patch by Tim Delany (missing DECREF). SF #1731330.
........
r55785 | collin.winter | 2007-06-05 17:17:35 -0700 (Tue, 05 Jun 2007) | 3 lines
Patch #1731049: make threading.py use a proper "raise" when checking internal state, rather than assert statements (which get stripped out by -O).
........
r55786 | facundo.batista | 2007-06-06 08:13:37 -0700 (Wed, 06 Jun 2007) | 4 lines
FTP.ntransfercmd method now uses create_connection when passive,
using the timeout received in connection time.
........
r55792 | facundo.batista | 2007-06-06 10:15:23 -0700 (Wed, 06 Jun 2007) | 7 lines
Added an optional timeout parameter to function urllib2.urlopen,
with tests in test_urllib2net.py (must have network resource
enabled to execute them). Also modified test_urllib2.py because
testing mock classes must take it into acount. Docs are also
updated.
........
r55793 | thomas.heller | 2007-06-06 13:19:19 -0700 (Wed, 06 Jun 2007) | 1 line
Build _ctypes and _ctypes_test in the ReleaseAMD64 configuration.
........
r55802 | georg.brandl | 2007-06-07 06:23:24 -0700 (Thu, 07 Jun 2007) | 3 lines
Disallow function calls like foo(None=1).
Backport from py3k rev. 55708 by Guido.
........
r55804 | georg.brandl | 2007-06-07 06:30:24 -0700 (Thu, 07 Jun 2007) | 2 lines
Make reindent.py executable.
........
r55805 | georg.brandl | 2007-06-07 06:34:10 -0700 (Thu, 07 Jun 2007) | 2 lines
Patch #1667860: Fix UnboundLocalError in urllib2.
........
r55821 | kristjan.jonsson | 2007-06-07 16:53:49 -0700 (Thu, 07 Jun 2007) | 1 line
Fixing changes to getbuildinfo.c that broke linux builds
........
r55828 | thomas.heller | 2007-06-08 09:10:27 -0700 (Fri, 08 Jun 2007) | 1 line
Make this test work with older Python releases where struct has no 't' format character.
........
r55829 | martin.v.loewis | 2007-06-08 10:29:20 -0700 (Fri, 08 Jun 2007) | 3 lines
Bug #1733488: Fix compilation of bufferobject.c on AIX.
Will backport to 2.5.
........
r55831 | thomas.heller | 2007-06-08 11:20:09 -0700 (Fri, 08 Jun 2007) | 2 lines
[ 1715718 ] x64 clean compile patch for _ctypes, by Kristj?n Valur
with small modifications.
........
r55832 | thomas.heller | 2007-06-08 12:01:06 -0700 (Fri, 08 Jun 2007) | 1 line
Fix gcc warnings intruduced by passing Py_ssize_t to PyErr_Format calls.
........
r55833 | thomas.heller | 2007-06-08 12:08:31 -0700 (Fri, 08 Jun 2007) | 2 lines
Fix wrong documentation, and correct the punktuation.
Closes [1700455].
........
r55834 | thomas.heller | 2007-06-08 12:14:23 -0700 (Fri, 08 Jun 2007) | 1 line
Fix warnings by using proper function prototype.
........
r55839 | neal.norwitz | 2007-06-08 20:36:34 -0700 (Fri, 08 Jun 2007) | 7 lines
Prevent expandtabs() on string and unicode objects from causing a segfault when
a large width is passed on 32-bit platforms. Found by Google.
It would be good for people to review this especially carefully and verify
I don't have an off by one error and there is no other way to cause overflow.
........
r55841 | neal.norwitz | 2007-06-08 21:48:22 -0700 (Fri, 08 Jun 2007) | 1 line
Use macro version of GET_SIZE to avoid Coverity warning (#150) about a possible error.
........
r55842 | martin.v.loewis | 2007-06-09 00:42:52 -0700 (Sat, 09 Jun 2007) | 3 lines
Patch #1733960: Allow T_LONGLONG to accept ints.
Will backport to 2.5.
........
r55843 | martin.v.loewis | 2007-06-09 00:58:05 -0700 (Sat, 09 Jun 2007) | 2 lines
Fix Windows build.
........
r55845 | martin.v.loewis | 2007-06-09 03:10:26 -0700 (Sat, 09 Jun 2007) | 2 lines
Provide LLONG_MAX for S390.
........
r55854 | thomas.heller | 2007-06-10 08:59:17 -0700 (Sun, 10 Jun 2007) | 4 lines
First version of build scripts for Windows/AMD64 (no external
components are built yet, and 'kill_python' is disabled).
........
r55855 | thomas.heller | 2007-06-10 10:55:51 -0700 (Sun, 10 Jun 2007) | 3 lines
For now, disable the _bsddb, _sqlite3, _ssl, _testcapi, _tkinter
modules in the ReleaseAMD64 configuration because they do not compile.
........
r55856 | thomas.heller | 2007-06-10 11:27:54 -0700 (Sun, 10 Jun 2007) | 1 line
Need to set the environment variables, otherwise devenv.com is not found.
........
r55860 | thomas.heller | 2007-06-10 14:01:17 -0700 (Sun, 10 Jun 2007) | 1 line
Revert commit 55855.
........
................
r55880 | neal.norwitz | 2007-06-10 22:07:36 -0700 (Sun, 10 Jun 2007) | 5 lines
Fix the refleak counter on test_collections. The ABC metaclass creates
a registry which must be cleared on each run. Otherwise, there *seem*
to be refleaks when there really aren't any. (The class is held within
the registry even though it's no longer needed.)
................
r55884 | neal.norwitz | 2007-06-10 22:46:33 -0700 (Sun, 10 Jun 2007) | 1 line
These tests have been removed, so they are no longer needed here
................
r55886 | georg.brandl | 2007-06-11 00:26:37 -0700 (Mon, 11 Jun 2007) | 3 lines
Optimize access to True and False in the compiler (if True)
and the peepholer (LOAD_NAME True).
................
r55905 | georg.brandl | 2007-06-11 10:02:26 -0700 (Mon, 11 Jun 2007) | 5 lines
Remove __oct__ and __hex__ and use __index__ for converting
non-ints before formatting in a base.
Add a bin() builtin.
................
r55906 | georg.brandl | 2007-06-11 10:04:44 -0700 (Mon, 11 Jun 2007) | 2 lines
int(x, 0) does not "guess".
................
r55907 | georg.brandl | 2007-06-11 10:05:47 -0700 (Mon, 11 Jun 2007) | 2 lines
Add a comment to explain that nb_oct and nb_hex are nonfunctional.
................
r55908 | guido.van.rossum | 2007-06-11 10:49:18 -0700 (Mon, 11 Jun 2007) | 2 lines
Get rid of unused imports and comment.
................
r55910 | guido.van.rossum | 2007-06-11 13:05:17 -0700 (Mon, 11 Jun 2007) | 2 lines
_Abstract.__new__ now requires either no arguments or __init__ overridden.
................
r55911 | guido.van.rossum | 2007-06-11 13:07:49 -0700 (Mon, 11 Jun 2007) | 7 lines
Move the collections ABCs to a separate file, _abcoll.py, in order to avoid
needing to import _collections.so during the bootstrap (this will become
apparent in the next submit of os.py).
Add (plain and mutable) ABCs for Set, Mapping, Sequence.
................
r55912 | guido.van.rossum | 2007-06-11 13:09:31 -0700 (Mon, 11 Jun 2007) | 2 lines
Rewrite the _Environ class to use the new collections ABCs.
................
r55913 | guido.van.rossum | 2007-06-11 13:59:45 -0700 (Mon, 11 Jun 2007) | 72 lines
Merged revisions 55869-55912 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55869 | neal.norwitz | 2007-06-10 17:42:11 -0700 (Sun, 10 Jun 2007) | 1 line
Add Atul Varma for patch # 1667860
........
r55870 | neal.norwitz | 2007-06-10 18:22:03 -0700 (Sun, 10 Jun 2007) | 1 line
Ignore valgrind problems on Ubuntu from ld
........
r55872 | neal.norwitz | 2007-06-10 18:48:46 -0700 (Sun, 10 Jun 2007) | 2 lines
Ignore config.status.lineno which seems new (new autoconf?)
........
r55873 | neal.norwitz | 2007-06-10 19:14:39 -0700 (Sun, 10 Jun 2007) | 1 line
Prevent these tests from running on Win64 since they don\'t apply there either
........
r55874 | neal.norwitz | 2007-06-10 19:16:10 -0700 (Sun, 10 Jun 2007) | 5 lines
Fix a bug when there was a newline in the string expandtabs was called on.
This also catches another condition that can overflow.
Will backport.
........
r55879 | neal.norwitz | 2007-06-10 21:52:37 -0700 (Sun, 10 Jun 2007) | 1 line
Prevent hang if the port cannot be opened.
........
r55881 | neal.norwitz | 2007-06-10 22:28:45 -0700 (Sun, 10 Jun 2007) | 4 lines
Add all of the distuils modules that don't seem to have explicit tests. :-(
Move an import in mworkscompiler so that this module can be imported on
any platform. Hopefully this works on all platforms.
........
r55882 | neal.norwitz | 2007-06-10 22:35:10 -0700 (Sun, 10 Jun 2007) | 4 lines
SF #1734732, lower case the module names per PEP 8.
Will backport.
........
r55885 | neal.norwitz | 2007-06-10 23:16:48 -0700 (Sun, 10 Jun 2007) | 4 lines
Not sure why this only fails sometimes on Unix machines. Better
to disable it and only import msvccompiler on Windows since that's
the only place it can work anyways.
........
r55887 | neal.norwitz | 2007-06-11 00:29:43 -0700 (Mon, 11 Jun 2007) | 4 lines
Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple attribute.
Will backport
........
r55889 | neal.norwitz | 2007-06-11 00:36:24 -0700 (Mon, 11 Jun 2007) | 1 line
Reflow long line
........
r55896 | thomas.heller | 2007-06-11 08:58:33 -0700 (Mon, 11 Jun 2007) | 3 lines
Use "O&" in calls to PyArg_Parse when we need a 'void*' instead of "k"
or "K" codes.
........
r55901 | facundo.batista | 2007-06-11 09:27:08 -0700 (Mon, 11 Jun 2007) | 5 lines
Added versionchanged flag to all the methods which received
a new optional timeout parameter, and a versionadded flag to
the socket.create_connection function.
........
................
r55914 | guido.van.rossum | 2007-06-11 14:19:50 -0700 (Mon, 11 Jun 2007) | 3 lines
New super() implementation, for PEP 3135 (though the PEP is not yet updated
to this design, and small tweaks may still be made later).
................
r55923 | guido.van.rossum | 2007-06-11 21:15:24 -0700 (Mon, 11 Jun 2007) | 4 lines
I'm guessing this module broke when Neal ripped out the types module --
it used 'list' both as a local variable and as the built-in list type.
Renamed the local variable since that was easier.
................
r55924 | guido.van.rossum | 2007-06-11 21:20:05 -0700 (Mon, 11 Jun 2007) | 5 lines
Change all occurrences of super(<thisclass>, <firstarg>) to super().
Seems to have worked, all the tests still pass.
Exception: test_descr and test_descrtut, which have tons of these
and are there to test the various usages.
................
r55939 | collin.winter | 2007-06-12 13:57:33 -0700 (Tue, 12 Jun 2007) | 1 line
Patch #1735485: remove StandardError from the exception hierarchy.
................
r55954 | neal.norwitz | 2007-06-12 21:56:32 -0700 (Tue, 12 Jun 2007) | 51 lines
Merged revisions 55913-55950 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55926 | marc-andre.lemburg | 2007-06-12 02:09:58 -0700 (Tue, 12 Jun 2007) | 3 lines
Apply patch #1734945 to support TurboLinux as distribution.
........
r55927 | marc-andre.lemburg | 2007-06-12 02:26:49 -0700 (Tue, 12 Jun 2007) | 3 lines
Add patch #1726668: Windows Vista support.
........
r55929 | thomas.heller | 2007-06-12 08:36:22 -0700 (Tue, 12 Jun 2007) | 1 line
Checkout, but do not yet try to build, exernal sources.
........
r55930 | thomas.heller | 2007-06-12 09:08:27 -0700 (Tue, 12 Jun 2007) | 6 lines
Add bufferoverflowU.lib to the libraries needed by _ssl (is this the
right thing to do?).
Set the /XP64 /RETAIL build enviroment in the makefile when building
ReleaseAMD64.
........
r55931 | thomas.heller | 2007-06-12 09:23:19 -0700 (Tue, 12 Jun 2007) | 5 lines
Revert this change, since it breaks the win32 build:
Add bufferoverflowU.lib to the libraries needed by _ssl (is this the
right thing to do?).
........
r55934 | thomas.heller | 2007-06-12 10:28:31 -0700 (Tue, 12 Jun 2007) | 3 lines
Specify the bufferoverflowU.lib to the makefile on the command line
(for ReleaseAMD64 builds).
........
r55937 | thomas.heller | 2007-06-12 12:02:59 -0700 (Tue, 12 Jun 2007) | 3 lines
Add bufferoverflowU.lib to PCBuild\_bsddb.vcproj.
Build sqlite3.dll and bsddb.
........
r55938 | thomas.heller | 2007-06-12 12:56:12 -0700 (Tue, 12 Jun 2007) | 2 lines
Don't rebuild Berkeley DB if not needed (this was committed by accident).
........
r55948 | martin.v.loewis | 2007-06-12 20:42:19 -0700 (Tue, 12 Jun 2007) | 3 lines
Provide PY_LLONG_MAX on all systems having long long.
Will backport to 2.5.
........
................
r55959 | guido.van.rossum | 2007-06-13 09:22:41 -0700 (Wed, 13 Jun 2007) | 2 lines
Fix a compilation warning.
................
2007-06-13 18:07:49 +00:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2024-12-03 10:33:06 -08:00
|
|
|
else {
|
|
|
|
|
Py_INCREF(type);
|
|
|
|
|
Py_XINCREF(obj);
|
|
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
|
2024-12-03 10:33:06 -08:00
|
|
|
if (obj == Py_None) {
|
|
|
|
|
Py_DECREF(obj);
|
2010-05-09 15:52:27 +00:00
|
|
|
obj = NULL;
|
2024-12-03 10:33:06 -08:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
if (obj != NULL) {
|
|
|
|
|
obj_type = supercheck(type, obj);
|
2024-12-03 10:33:06 -08:00
|
|
|
if (obj_type == NULL) {
|
|
|
|
|
Py_DECREF(type);
|
|
|
|
|
Py_DECREF(obj);
|
2010-05-09 15:52:27 +00:00
|
|
|
return -1;
|
2024-12-03 10:33:06 -08:00
|
|
|
}
|
2010-05-09 15:52:27 +00:00
|
|
|
}
|
2024-12-03 10:33:06 -08:00
|
|
|
Py_XSETREF(su->type, (PyTypeObject*)type);
|
2016-04-13 15:27:33 +03:00
|
|
|
Py_XSETREF(su->obj, obj);
|
|
|
|
|
Py_XSETREF(su->obj_type, obj_type);
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
2001-08-24 16:47:00 +00:00
|
|
|
}
|
|
|
|
|
|
2002-06-13 20:33:02 +00:00
|
|
|
PyDoc_STRVAR(super_doc,
|
Merged revisions 55817-55961 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55837 | guido.van.rossum | 2007-06-08 16:04:42 -0700 (Fri, 08 Jun 2007) | 2 lines
PEP 3119 -- the abc module.
................
r55838 | guido.van.rossum | 2007-06-08 17:38:55 -0700 (Fri, 08 Jun 2007) | 2 lines
Implement part of PEP 3119 -- One Trick Ponies.
................
r55847 | guido.van.rossum | 2007-06-09 08:28:06 -0700 (Sat, 09 Jun 2007) | 2 lines
Different way to do one trick ponies, allowing registration (per PEP strawman).
................
r55849 | guido.van.rossum | 2007-06-09 18:06:38 -0700 (Sat, 09 Jun 2007) | 3 lines
Make sure that the magic looking for __hash__ (etc.) doesn't apply to
real subclasses of Hashable.
................
r55852 | guido.van.rossum | 2007-06-10 08:29:51 -0700 (Sun, 10 Jun 2007) | 2 lines
Add some more examples, e.g. generators and dict views.
................
r55853 | guido.van.rossum | 2007-06-10 08:31:59 -0700 (Sun, 10 Jun 2007) | 2 lines
keys() and items() *are* containers -- just values() isn't.
................
r55864 | georg.brandl | 2007-06-10 15:29:40 -0700 (Sun, 10 Jun 2007) | 2 lines
PEP 3127: new octal literals, binary literals.
................
r55865 | georg.brandl | 2007-06-10 15:31:37 -0700 (Sun, 10 Jun 2007) | 2 lines
Some octal literal fixes in Tools.
................
r55866 | georg.brandl | 2007-06-10 15:37:43 -0700 (Sun, 10 Jun 2007) | 2 lines
Tokenizer changes for PEP 3127.
................
r55867 | georg.brandl | 2007-06-10 15:37:55 -0700 (Sun, 10 Jun 2007) | 2 lines
Some docs for PEP 3127.
................
r55868 | georg.brandl | 2007-06-10 15:44:39 -0700 (Sun, 10 Jun 2007) | 2 lines
Missed a place in intobject.c. Is that used anymore anyway?
................
r55871 | neal.norwitz | 2007-06-10 18:31:49 -0700 (Sun, 10 Jun 2007) | 182 lines
Merged revisions 55729-55868 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55731 | neal.norwitz | 2007-06-01 00:29:12 -0700 (Fri, 01 Jun 2007) | 7 lines
SF 1668596/1720897: distutils now copies data files
even if package_dir is empty.
This needs to be backported. I'm too tired tonight. It would be great
if someone backports this if the buildbots are ok with it. Otherwise,
I will try to get to it tomorrow.
........
r55732 | georg.brandl | 2007-06-01 04:33:33 -0700 (Fri, 01 Jun 2007) | 2 lines
Bug #1722484: remove docstrings again when running with -OO.
........
r55735 | georg.brandl | 2007-06-01 12:20:27 -0700 (Fri, 01 Jun 2007) | 2 lines
Fix wrong issue number.
........
r55739 | brett.cannon | 2007-06-01 20:02:29 -0700 (Fri, 01 Jun 2007) | 3 lines
Have configure raise an error when building on AtheOS. Code specific to AtheOS
will be removed in Python 2.7.
........
r55746 | neal.norwitz | 2007-06-02 11:33:53 -0700 (Sat, 02 Jun 2007) | 1 line
Update expected birthday of 2.6
........
r55751 | neal.norwitz | 2007-06-03 13:32:50 -0700 (Sun, 03 Jun 2007) | 10 lines
Backout the original 'fix' to 1721309 which had no effect.
Different versions of Berkeley DB handle this differently.
The comments and bug report should have the details. Memory is allocated
in 4.4 (and presumably earlier), but not in 4.5. Thus
4.5 has the free error, but not earlier versions.
Mostly update comments, plus make the free conditional.
This fix was already applied to the 2.5 branch.
........
r55752 | brett.cannon | 2007-06-03 16:13:41 -0700 (Sun, 03 Jun 2007) | 6 lines
Make _strptime.TimeRE().pattern() use ``\s+`` for matching whitespace instead
of ``\s*``. This prevents patterns from "stealing" bits from other patterns in
order to make a match work.
Closes bug #1730389. Will be backported.
........
r55766 | hyeshik.chang | 2007-06-05 11:16:52 -0700 (Tue, 05 Jun 2007) | 4 lines
Fix build on FreeBSD. Bluetooth HCI API in FreeBSD is quite different
from Linux's. Just fix the build for now but the code doesn't
support the complete capability of HCI on FreeBSD yet.
........
r55770 | hyeshik.chang | 2007-06-05 11:58:51 -0700 (Tue, 05 Jun 2007) | 4 lines
Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it
reads a file that ends with incomplete sequence and sizehint argument
for .read() is specified.
........
r55775 | hyeshik.chang | 2007-06-05 12:28:15 -0700 (Tue, 05 Jun 2007) | 2 lines
Fix for Windows: close a temporary file before trying to delete it.
........
r55783 | guido.van.rossum | 2007-06-05 14:24:47 -0700 (Tue, 05 Jun 2007) | 2 lines
Patch by Tim Delany (missing DECREF). SF #1731330.
........
r55785 | collin.winter | 2007-06-05 17:17:35 -0700 (Tue, 05 Jun 2007) | 3 lines
Patch #1731049: make threading.py use a proper "raise" when checking internal state, rather than assert statements (which get stripped out by -O).
........
r55786 | facundo.batista | 2007-06-06 08:13:37 -0700 (Wed, 06 Jun 2007) | 4 lines
FTP.ntransfercmd method now uses create_connection when passive,
using the timeout received in connection time.
........
r55792 | facundo.batista | 2007-06-06 10:15:23 -0700 (Wed, 06 Jun 2007) | 7 lines
Added an optional timeout parameter to function urllib2.urlopen,
with tests in test_urllib2net.py (must have network resource
enabled to execute them). Also modified test_urllib2.py because
testing mock classes must take it into acount. Docs are also
updated.
........
r55793 | thomas.heller | 2007-06-06 13:19:19 -0700 (Wed, 06 Jun 2007) | 1 line
Build _ctypes and _ctypes_test in the ReleaseAMD64 configuration.
........
r55802 | georg.brandl | 2007-06-07 06:23:24 -0700 (Thu, 07 Jun 2007) | 3 lines
Disallow function calls like foo(None=1).
Backport from py3k rev. 55708 by Guido.
........
r55804 | georg.brandl | 2007-06-07 06:30:24 -0700 (Thu, 07 Jun 2007) | 2 lines
Make reindent.py executable.
........
r55805 | georg.brandl | 2007-06-07 06:34:10 -0700 (Thu, 07 Jun 2007) | 2 lines
Patch #1667860: Fix UnboundLocalError in urllib2.
........
r55821 | kristjan.jonsson | 2007-06-07 16:53:49 -0700 (Thu, 07 Jun 2007) | 1 line
Fixing changes to getbuildinfo.c that broke linux builds
........
r55828 | thomas.heller | 2007-06-08 09:10:27 -0700 (Fri, 08 Jun 2007) | 1 line
Make this test work with older Python releases where struct has no 't' format character.
........
r55829 | martin.v.loewis | 2007-06-08 10:29:20 -0700 (Fri, 08 Jun 2007) | 3 lines
Bug #1733488: Fix compilation of bufferobject.c on AIX.
Will backport to 2.5.
........
r55831 | thomas.heller | 2007-06-08 11:20:09 -0700 (Fri, 08 Jun 2007) | 2 lines
[ 1715718 ] x64 clean compile patch for _ctypes, by Kristj?n Valur
with small modifications.
........
r55832 | thomas.heller | 2007-06-08 12:01:06 -0700 (Fri, 08 Jun 2007) | 1 line
Fix gcc warnings intruduced by passing Py_ssize_t to PyErr_Format calls.
........
r55833 | thomas.heller | 2007-06-08 12:08:31 -0700 (Fri, 08 Jun 2007) | 2 lines
Fix wrong documentation, and correct the punktuation.
Closes [1700455].
........
r55834 | thomas.heller | 2007-06-08 12:14:23 -0700 (Fri, 08 Jun 2007) | 1 line
Fix warnings by using proper function prototype.
........
r55839 | neal.norwitz | 2007-06-08 20:36:34 -0700 (Fri, 08 Jun 2007) | 7 lines
Prevent expandtabs() on string and unicode objects from causing a segfault when
a large width is passed on 32-bit platforms. Found by Google.
It would be good for people to review this especially carefully and verify
I don't have an off by one error and there is no other way to cause overflow.
........
r55841 | neal.norwitz | 2007-06-08 21:48:22 -0700 (Fri, 08 Jun 2007) | 1 line
Use macro version of GET_SIZE to avoid Coverity warning (#150) about a possible error.
........
r55842 | martin.v.loewis | 2007-06-09 00:42:52 -0700 (Sat, 09 Jun 2007) | 3 lines
Patch #1733960: Allow T_LONGLONG to accept ints.
Will backport to 2.5.
........
r55843 | martin.v.loewis | 2007-06-09 00:58:05 -0700 (Sat, 09 Jun 2007) | 2 lines
Fix Windows build.
........
r55845 | martin.v.loewis | 2007-06-09 03:10:26 -0700 (Sat, 09 Jun 2007) | 2 lines
Provide LLONG_MAX for S390.
........
r55854 | thomas.heller | 2007-06-10 08:59:17 -0700 (Sun, 10 Jun 2007) | 4 lines
First version of build scripts for Windows/AMD64 (no external
components are built yet, and 'kill_python' is disabled).
........
r55855 | thomas.heller | 2007-06-10 10:55:51 -0700 (Sun, 10 Jun 2007) | 3 lines
For now, disable the _bsddb, _sqlite3, _ssl, _testcapi, _tkinter
modules in the ReleaseAMD64 configuration because they do not compile.
........
r55856 | thomas.heller | 2007-06-10 11:27:54 -0700 (Sun, 10 Jun 2007) | 1 line
Need to set the environment variables, otherwise devenv.com is not found.
........
r55860 | thomas.heller | 2007-06-10 14:01:17 -0700 (Sun, 10 Jun 2007) | 1 line
Revert commit 55855.
........
................
r55880 | neal.norwitz | 2007-06-10 22:07:36 -0700 (Sun, 10 Jun 2007) | 5 lines
Fix the refleak counter on test_collections. The ABC metaclass creates
a registry which must be cleared on each run. Otherwise, there *seem*
to be refleaks when there really aren't any. (The class is held within
the registry even though it's no longer needed.)
................
r55884 | neal.norwitz | 2007-06-10 22:46:33 -0700 (Sun, 10 Jun 2007) | 1 line
These tests have been removed, so they are no longer needed here
................
r55886 | georg.brandl | 2007-06-11 00:26:37 -0700 (Mon, 11 Jun 2007) | 3 lines
Optimize access to True and False in the compiler (if True)
and the peepholer (LOAD_NAME True).
................
r55905 | georg.brandl | 2007-06-11 10:02:26 -0700 (Mon, 11 Jun 2007) | 5 lines
Remove __oct__ and __hex__ and use __index__ for converting
non-ints before formatting in a base.
Add a bin() builtin.
................
r55906 | georg.brandl | 2007-06-11 10:04:44 -0700 (Mon, 11 Jun 2007) | 2 lines
int(x, 0) does not "guess".
................
r55907 | georg.brandl | 2007-06-11 10:05:47 -0700 (Mon, 11 Jun 2007) | 2 lines
Add a comment to explain that nb_oct and nb_hex are nonfunctional.
................
r55908 | guido.van.rossum | 2007-06-11 10:49:18 -0700 (Mon, 11 Jun 2007) | 2 lines
Get rid of unused imports and comment.
................
r55910 | guido.van.rossum | 2007-06-11 13:05:17 -0700 (Mon, 11 Jun 2007) | 2 lines
_Abstract.__new__ now requires either no arguments or __init__ overridden.
................
r55911 | guido.van.rossum | 2007-06-11 13:07:49 -0700 (Mon, 11 Jun 2007) | 7 lines
Move the collections ABCs to a separate file, _abcoll.py, in order to avoid
needing to import _collections.so during the bootstrap (this will become
apparent in the next submit of os.py).
Add (plain and mutable) ABCs for Set, Mapping, Sequence.
................
r55912 | guido.van.rossum | 2007-06-11 13:09:31 -0700 (Mon, 11 Jun 2007) | 2 lines
Rewrite the _Environ class to use the new collections ABCs.
................
r55913 | guido.van.rossum | 2007-06-11 13:59:45 -0700 (Mon, 11 Jun 2007) | 72 lines
Merged revisions 55869-55912 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55869 | neal.norwitz | 2007-06-10 17:42:11 -0700 (Sun, 10 Jun 2007) | 1 line
Add Atul Varma for patch # 1667860
........
r55870 | neal.norwitz | 2007-06-10 18:22:03 -0700 (Sun, 10 Jun 2007) | 1 line
Ignore valgrind problems on Ubuntu from ld
........
r55872 | neal.norwitz | 2007-06-10 18:48:46 -0700 (Sun, 10 Jun 2007) | 2 lines
Ignore config.status.lineno which seems new (new autoconf?)
........
r55873 | neal.norwitz | 2007-06-10 19:14:39 -0700 (Sun, 10 Jun 2007) | 1 line
Prevent these tests from running on Win64 since they don\'t apply there either
........
r55874 | neal.norwitz | 2007-06-10 19:16:10 -0700 (Sun, 10 Jun 2007) | 5 lines
Fix a bug when there was a newline in the string expandtabs was called on.
This also catches another condition that can overflow.
Will backport.
........
r55879 | neal.norwitz | 2007-06-10 21:52:37 -0700 (Sun, 10 Jun 2007) | 1 line
Prevent hang if the port cannot be opened.
........
r55881 | neal.norwitz | 2007-06-10 22:28:45 -0700 (Sun, 10 Jun 2007) | 4 lines
Add all of the distuils modules that don't seem to have explicit tests. :-(
Move an import in mworkscompiler so that this module can be imported on
any platform. Hopefully this works on all platforms.
........
r55882 | neal.norwitz | 2007-06-10 22:35:10 -0700 (Sun, 10 Jun 2007) | 4 lines
SF #1734732, lower case the module names per PEP 8.
Will backport.
........
r55885 | neal.norwitz | 2007-06-10 23:16:48 -0700 (Sun, 10 Jun 2007) | 4 lines
Not sure why this only fails sometimes on Unix machines. Better
to disable it and only import msvccompiler on Windows since that's
the only place it can work anyways.
........
r55887 | neal.norwitz | 2007-06-11 00:29:43 -0700 (Mon, 11 Jun 2007) | 4 lines
Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple attribute.
Will backport
........
r55889 | neal.norwitz | 2007-06-11 00:36:24 -0700 (Mon, 11 Jun 2007) | 1 line
Reflow long line
........
r55896 | thomas.heller | 2007-06-11 08:58:33 -0700 (Mon, 11 Jun 2007) | 3 lines
Use "O&" in calls to PyArg_Parse when we need a 'void*' instead of "k"
or "K" codes.
........
r55901 | facundo.batista | 2007-06-11 09:27:08 -0700 (Mon, 11 Jun 2007) | 5 lines
Added versionchanged flag to all the methods which received
a new optional timeout parameter, and a versionadded flag to
the socket.create_connection function.
........
................
r55914 | guido.van.rossum | 2007-06-11 14:19:50 -0700 (Mon, 11 Jun 2007) | 3 lines
New super() implementation, for PEP 3135 (though the PEP is not yet updated
to this design, and small tweaks may still be made later).
................
r55923 | guido.van.rossum | 2007-06-11 21:15:24 -0700 (Mon, 11 Jun 2007) | 4 lines
I'm guessing this module broke when Neal ripped out the types module --
it used 'list' both as a local variable and as the built-in list type.
Renamed the local variable since that was easier.
................
r55924 | guido.van.rossum | 2007-06-11 21:20:05 -0700 (Mon, 11 Jun 2007) | 5 lines
Change all occurrences of super(<thisclass>, <firstarg>) to super().
Seems to have worked, all the tests still pass.
Exception: test_descr and test_descrtut, which have tons of these
and are there to test the various usages.
................
r55939 | collin.winter | 2007-06-12 13:57:33 -0700 (Tue, 12 Jun 2007) | 1 line
Patch #1735485: remove StandardError from the exception hierarchy.
................
r55954 | neal.norwitz | 2007-06-12 21:56:32 -0700 (Tue, 12 Jun 2007) | 51 lines
Merged revisions 55913-55950 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55926 | marc-andre.lemburg | 2007-06-12 02:09:58 -0700 (Tue, 12 Jun 2007) | 3 lines
Apply patch #1734945 to support TurboLinux as distribution.
........
r55927 | marc-andre.lemburg | 2007-06-12 02:26:49 -0700 (Tue, 12 Jun 2007) | 3 lines
Add patch #1726668: Windows Vista support.
........
r55929 | thomas.heller | 2007-06-12 08:36:22 -0700 (Tue, 12 Jun 2007) | 1 line
Checkout, but do not yet try to build, exernal sources.
........
r55930 | thomas.heller | 2007-06-12 09:08:27 -0700 (Tue, 12 Jun 2007) | 6 lines
Add bufferoverflowU.lib to the libraries needed by _ssl (is this the
right thing to do?).
Set the /XP64 /RETAIL build enviroment in the makefile when building
ReleaseAMD64.
........
r55931 | thomas.heller | 2007-06-12 09:23:19 -0700 (Tue, 12 Jun 2007) | 5 lines
Revert this change, since it breaks the win32 build:
Add bufferoverflowU.lib to the libraries needed by _ssl (is this the
right thing to do?).
........
r55934 | thomas.heller | 2007-06-12 10:28:31 -0700 (Tue, 12 Jun 2007) | 3 lines
Specify the bufferoverflowU.lib to the makefile on the command line
(for ReleaseAMD64 builds).
........
r55937 | thomas.heller | 2007-06-12 12:02:59 -0700 (Tue, 12 Jun 2007) | 3 lines
Add bufferoverflowU.lib to PCBuild\_bsddb.vcproj.
Build sqlite3.dll and bsddb.
........
r55938 | thomas.heller | 2007-06-12 12:56:12 -0700 (Tue, 12 Jun 2007) | 2 lines
Don't rebuild Berkeley DB if not needed (this was committed by accident).
........
r55948 | martin.v.loewis | 2007-06-12 20:42:19 -0700 (Tue, 12 Jun 2007) | 3 lines
Provide PY_LLONG_MAX on all systems having long long.
Will backport to 2.5.
........
................
r55959 | guido.van.rossum | 2007-06-13 09:22:41 -0700 (Wed, 13 Jun 2007) | 2 lines
Fix a compilation warning.
................
2007-06-13 18:07:49 +00:00
|
|
|
"super() -> same as super(__class__, <first argument>)\n"
|
2001-08-24 16:47:00 +00:00
|
|
|
"super(type) -> unbound super object\n"
|
|
|
|
|
"super(type, obj) -> bound super object; requires isinstance(obj, type)\n"
|
2001-08-29 15:47:06 +00:00
|
|
|
"super(type, type2) -> bound super object; requires issubclass(type2, type)\n"
|
2001-08-24 16:47:00 +00:00
|
|
|
"Typical use to call a cooperative superclass method:\n"
|
|
|
|
|
"class C(B):\n"
|
|
|
|
|
" def meth(self, arg):\n"
|
2010-05-09 15:52:27 +00:00
|
|
|
" super().meth(arg)\n"
|
Merged revisions 55817-55961 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55837 | guido.van.rossum | 2007-06-08 16:04:42 -0700 (Fri, 08 Jun 2007) | 2 lines
PEP 3119 -- the abc module.
................
r55838 | guido.van.rossum | 2007-06-08 17:38:55 -0700 (Fri, 08 Jun 2007) | 2 lines
Implement part of PEP 3119 -- One Trick Ponies.
................
r55847 | guido.van.rossum | 2007-06-09 08:28:06 -0700 (Sat, 09 Jun 2007) | 2 lines
Different way to do one trick ponies, allowing registration (per PEP strawman).
................
r55849 | guido.van.rossum | 2007-06-09 18:06:38 -0700 (Sat, 09 Jun 2007) | 3 lines
Make sure that the magic looking for __hash__ (etc.) doesn't apply to
real subclasses of Hashable.
................
r55852 | guido.van.rossum | 2007-06-10 08:29:51 -0700 (Sun, 10 Jun 2007) | 2 lines
Add some more examples, e.g. generators and dict views.
................
r55853 | guido.van.rossum | 2007-06-10 08:31:59 -0700 (Sun, 10 Jun 2007) | 2 lines
keys() and items() *are* containers -- just values() isn't.
................
r55864 | georg.brandl | 2007-06-10 15:29:40 -0700 (Sun, 10 Jun 2007) | 2 lines
PEP 3127: new octal literals, binary literals.
................
r55865 | georg.brandl | 2007-06-10 15:31:37 -0700 (Sun, 10 Jun 2007) | 2 lines
Some octal literal fixes in Tools.
................
r55866 | georg.brandl | 2007-06-10 15:37:43 -0700 (Sun, 10 Jun 2007) | 2 lines
Tokenizer changes for PEP 3127.
................
r55867 | georg.brandl | 2007-06-10 15:37:55 -0700 (Sun, 10 Jun 2007) | 2 lines
Some docs for PEP 3127.
................
r55868 | georg.brandl | 2007-06-10 15:44:39 -0700 (Sun, 10 Jun 2007) | 2 lines
Missed a place in intobject.c. Is that used anymore anyway?
................
r55871 | neal.norwitz | 2007-06-10 18:31:49 -0700 (Sun, 10 Jun 2007) | 182 lines
Merged revisions 55729-55868 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55731 | neal.norwitz | 2007-06-01 00:29:12 -0700 (Fri, 01 Jun 2007) | 7 lines
SF 1668596/1720897: distutils now copies data files
even if package_dir is empty.
This needs to be backported. I'm too tired tonight. It would be great
if someone backports this if the buildbots are ok with it. Otherwise,
I will try to get to it tomorrow.
........
r55732 | georg.brandl | 2007-06-01 04:33:33 -0700 (Fri, 01 Jun 2007) | 2 lines
Bug #1722484: remove docstrings again when running with -OO.
........
r55735 | georg.brandl | 2007-06-01 12:20:27 -0700 (Fri, 01 Jun 2007) | 2 lines
Fix wrong issue number.
........
r55739 | brett.cannon | 2007-06-01 20:02:29 -0700 (Fri, 01 Jun 2007) | 3 lines
Have configure raise an error when building on AtheOS. Code specific to AtheOS
will be removed in Python 2.7.
........
r55746 | neal.norwitz | 2007-06-02 11:33:53 -0700 (Sat, 02 Jun 2007) | 1 line
Update expected birthday of 2.6
........
r55751 | neal.norwitz | 2007-06-03 13:32:50 -0700 (Sun, 03 Jun 2007) | 10 lines
Backout the original 'fix' to 1721309 which had no effect.
Different versions of Berkeley DB handle this differently.
The comments and bug report should have the details. Memory is allocated
in 4.4 (and presumably earlier), but not in 4.5. Thus
4.5 has the free error, but not earlier versions.
Mostly update comments, plus make the free conditional.
This fix was already applied to the 2.5 branch.
........
r55752 | brett.cannon | 2007-06-03 16:13:41 -0700 (Sun, 03 Jun 2007) | 6 lines
Make _strptime.TimeRE().pattern() use ``\s+`` for matching whitespace instead
of ``\s*``. This prevents patterns from "stealing" bits from other patterns in
order to make a match work.
Closes bug #1730389. Will be backported.
........
r55766 | hyeshik.chang | 2007-06-05 11:16:52 -0700 (Tue, 05 Jun 2007) | 4 lines
Fix build on FreeBSD. Bluetooth HCI API in FreeBSD is quite different
from Linux's. Just fix the build for now but the code doesn't
support the complete capability of HCI on FreeBSD yet.
........
r55770 | hyeshik.chang | 2007-06-05 11:58:51 -0700 (Tue, 05 Jun 2007) | 4 lines
Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it
reads a file that ends with incomplete sequence and sizehint argument
for .read() is specified.
........
r55775 | hyeshik.chang | 2007-06-05 12:28:15 -0700 (Tue, 05 Jun 2007) | 2 lines
Fix for Windows: close a temporary file before trying to delete it.
........
r55783 | guido.van.rossum | 2007-06-05 14:24:47 -0700 (Tue, 05 Jun 2007) | 2 lines
Patch by Tim Delany (missing DECREF). SF #1731330.
........
r55785 | collin.winter | 2007-06-05 17:17:35 -0700 (Tue, 05 Jun 2007) | 3 lines
Patch #1731049: make threading.py use a proper "raise" when checking internal state, rather than assert statements (which get stripped out by -O).
........
r55786 | facundo.batista | 2007-06-06 08:13:37 -0700 (Wed, 06 Jun 2007) | 4 lines
FTP.ntransfercmd method now uses create_connection when passive,
using the timeout received in connection time.
........
r55792 | facundo.batista | 2007-06-06 10:15:23 -0700 (Wed, 06 Jun 2007) | 7 lines
Added an optional timeout parameter to function urllib2.urlopen,
with tests in test_urllib2net.py (must have network resource
enabled to execute them). Also modified test_urllib2.py because
testing mock classes must take it into acount. Docs are also
updated.
........
r55793 | thomas.heller | 2007-06-06 13:19:19 -0700 (Wed, 06 Jun 2007) | 1 line
Build _ctypes and _ctypes_test in the ReleaseAMD64 configuration.
........
r55802 | georg.brandl | 2007-06-07 06:23:24 -0700 (Thu, 07 Jun 2007) | 3 lines
Disallow function calls like foo(None=1).
Backport from py3k rev. 55708 by Guido.
........
r55804 | georg.brandl | 2007-06-07 06:30:24 -0700 (Thu, 07 Jun 2007) | 2 lines
Make reindent.py executable.
........
r55805 | georg.brandl | 2007-06-07 06:34:10 -0700 (Thu, 07 Jun 2007) | 2 lines
Patch #1667860: Fix UnboundLocalError in urllib2.
........
r55821 | kristjan.jonsson | 2007-06-07 16:53:49 -0700 (Thu, 07 Jun 2007) | 1 line
Fixing changes to getbuildinfo.c that broke linux builds
........
r55828 | thomas.heller | 2007-06-08 09:10:27 -0700 (Fri, 08 Jun 2007) | 1 line
Make this test work with older Python releases where struct has no 't' format character.
........
r55829 | martin.v.loewis | 2007-06-08 10:29:20 -0700 (Fri, 08 Jun 2007) | 3 lines
Bug #1733488: Fix compilation of bufferobject.c on AIX.
Will backport to 2.5.
........
r55831 | thomas.heller | 2007-06-08 11:20:09 -0700 (Fri, 08 Jun 2007) | 2 lines
[ 1715718 ] x64 clean compile patch for _ctypes, by Kristj?n Valur
with small modifications.
........
r55832 | thomas.heller | 2007-06-08 12:01:06 -0700 (Fri, 08 Jun 2007) | 1 line
Fix gcc warnings intruduced by passing Py_ssize_t to PyErr_Format calls.
........
r55833 | thomas.heller | 2007-06-08 12:08:31 -0700 (Fri, 08 Jun 2007) | 2 lines
Fix wrong documentation, and correct the punktuation.
Closes [1700455].
........
r55834 | thomas.heller | 2007-06-08 12:14:23 -0700 (Fri, 08 Jun 2007) | 1 line
Fix warnings by using proper function prototype.
........
r55839 | neal.norwitz | 2007-06-08 20:36:34 -0700 (Fri, 08 Jun 2007) | 7 lines
Prevent expandtabs() on string and unicode objects from causing a segfault when
a large width is passed on 32-bit platforms. Found by Google.
It would be good for people to review this especially carefully and verify
I don't have an off by one error and there is no other way to cause overflow.
........
r55841 | neal.norwitz | 2007-06-08 21:48:22 -0700 (Fri, 08 Jun 2007) | 1 line
Use macro version of GET_SIZE to avoid Coverity warning (#150) about a possible error.
........
r55842 | martin.v.loewis | 2007-06-09 00:42:52 -0700 (Sat, 09 Jun 2007) | 3 lines
Patch #1733960: Allow T_LONGLONG to accept ints.
Will backport to 2.5.
........
r55843 | martin.v.loewis | 2007-06-09 00:58:05 -0700 (Sat, 09 Jun 2007) | 2 lines
Fix Windows build.
........
r55845 | martin.v.loewis | 2007-06-09 03:10:26 -0700 (Sat, 09 Jun 2007) | 2 lines
Provide LLONG_MAX for S390.
........
r55854 | thomas.heller | 2007-06-10 08:59:17 -0700 (Sun, 10 Jun 2007) | 4 lines
First version of build scripts for Windows/AMD64 (no external
components are built yet, and 'kill_python' is disabled).
........
r55855 | thomas.heller | 2007-06-10 10:55:51 -0700 (Sun, 10 Jun 2007) | 3 lines
For now, disable the _bsddb, _sqlite3, _ssl, _testcapi, _tkinter
modules in the ReleaseAMD64 configuration because they do not compile.
........
r55856 | thomas.heller | 2007-06-10 11:27:54 -0700 (Sun, 10 Jun 2007) | 1 line
Need to set the environment variables, otherwise devenv.com is not found.
........
r55860 | thomas.heller | 2007-06-10 14:01:17 -0700 (Sun, 10 Jun 2007) | 1 line
Revert commit 55855.
........
................
r55880 | neal.norwitz | 2007-06-10 22:07:36 -0700 (Sun, 10 Jun 2007) | 5 lines
Fix the refleak counter on test_collections. The ABC metaclass creates
a registry which must be cleared on each run. Otherwise, there *seem*
to be refleaks when there really aren't any. (The class is held within
the registry even though it's no longer needed.)
................
r55884 | neal.norwitz | 2007-06-10 22:46:33 -0700 (Sun, 10 Jun 2007) | 1 line
These tests have been removed, so they are no longer needed here
................
r55886 | georg.brandl | 2007-06-11 00:26:37 -0700 (Mon, 11 Jun 2007) | 3 lines
Optimize access to True and False in the compiler (if True)
and the peepholer (LOAD_NAME True).
................
r55905 | georg.brandl | 2007-06-11 10:02:26 -0700 (Mon, 11 Jun 2007) | 5 lines
Remove __oct__ and __hex__ and use __index__ for converting
non-ints before formatting in a base.
Add a bin() builtin.
................
r55906 | georg.brandl | 2007-06-11 10:04:44 -0700 (Mon, 11 Jun 2007) | 2 lines
int(x, 0) does not "guess".
................
r55907 | georg.brandl | 2007-06-11 10:05:47 -0700 (Mon, 11 Jun 2007) | 2 lines
Add a comment to explain that nb_oct and nb_hex are nonfunctional.
................
r55908 | guido.van.rossum | 2007-06-11 10:49:18 -0700 (Mon, 11 Jun 2007) | 2 lines
Get rid of unused imports and comment.
................
r55910 | guido.van.rossum | 2007-06-11 13:05:17 -0700 (Mon, 11 Jun 2007) | 2 lines
_Abstract.__new__ now requires either no arguments or __init__ overridden.
................
r55911 | guido.van.rossum | 2007-06-11 13:07:49 -0700 (Mon, 11 Jun 2007) | 7 lines
Move the collections ABCs to a separate file, _abcoll.py, in order to avoid
needing to import _collections.so during the bootstrap (this will become
apparent in the next submit of os.py).
Add (plain and mutable) ABCs for Set, Mapping, Sequence.
................
r55912 | guido.van.rossum | 2007-06-11 13:09:31 -0700 (Mon, 11 Jun 2007) | 2 lines
Rewrite the _Environ class to use the new collections ABCs.
................
r55913 | guido.van.rossum | 2007-06-11 13:59:45 -0700 (Mon, 11 Jun 2007) | 72 lines
Merged revisions 55869-55912 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55869 | neal.norwitz | 2007-06-10 17:42:11 -0700 (Sun, 10 Jun 2007) | 1 line
Add Atul Varma for patch # 1667860
........
r55870 | neal.norwitz | 2007-06-10 18:22:03 -0700 (Sun, 10 Jun 2007) | 1 line
Ignore valgrind problems on Ubuntu from ld
........
r55872 | neal.norwitz | 2007-06-10 18:48:46 -0700 (Sun, 10 Jun 2007) | 2 lines
Ignore config.status.lineno which seems new (new autoconf?)
........
r55873 | neal.norwitz | 2007-06-10 19:14:39 -0700 (Sun, 10 Jun 2007) | 1 line
Prevent these tests from running on Win64 since they don\'t apply there either
........
r55874 | neal.norwitz | 2007-06-10 19:16:10 -0700 (Sun, 10 Jun 2007) | 5 lines
Fix a bug when there was a newline in the string expandtabs was called on.
This also catches another condition that can overflow.
Will backport.
........
r55879 | neal.norwitz | 2007-06-10 21:52:37 -0700 (Sun, 10 Jun 2007) | 1 line
Prevent hang if the port cannot be opened.
........
r55881 | neal.norwitz | 2007-06-10 22:28:45 -0700 (Sun, 10 Jun 2007) | 4 lines
Add all of the distuils modules that don't seem to have explicit tests. :-(
Move an import in mworkscompiler so that this module can be imported on
any platform. Hopefully this works on all platforms.
........
r55882 | neal.norwitz | 2007-06-10 22:35:10 -0700 (Sun, 10 Jun 2007) | 4 lines
SF #1734732, lower case the module names per PEP 8.
Will backport.
........
r55885 | neal.norwitz | 2007-06-10 23:16:48 -0700 (Sun, 10 Jun 2007) | 4 lines
Not sure why this only fails sometimes on Unix machines. Better
to disable it and only import msvccompiler on Windows since that's
the only place it can work anyways.
........
r55887 | neal.norwitz | 2007-06-11 00:29:43 -0700 (Mon, 11 Jun 2007) | 4 lines
Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple attribute.
Will backport
........
r55889 | neal.norwitz | 2007-06-11 00:36:24 -0700 (Mon, 11 Jun 2007) | 1 line
Reflow long line
........
r55896 | thomas.heller | 2007-06-11 08:58:33 -0700 (Mon, 11 Jun 2007) | 3 lines
Use "O&" in calls to PyArg_Parse when we need a 'void*' instead of "k"
or "K" codes.
........
r55901 | facundo.batista | 2007-06-11 09:27:08 -0700 (Mon, 11 Jun 2007) | 5 lines
Added versionchanged flag to all the methods which received
a new optional timeout parameter, and a versionadded flag to
the socket.create_connection function.
........
................
r55914 | guido.van.rossum | 2007-06-11 14:19:50 -0700 (Mon, 11 Jun 2007) | 3 lines
New super() implementation, for PEP 3135 (though the PEP is not yet updated
to this design, and small tweaks may still be made later).
................
r55923 | guido.van.rossum | 2007-06-11 21:15:24 -0700 (Mon, 11 Jun 2007) | 4 lines
I'm guessing this module broke when Neal ripped out the types module --
it used 'list' both as a local variable and as the built-in list type.
Renamed the local variable since that was easier.
................
r55924 | guido.van.rossum | 2007-06-11 21:20:05 -0700 (Mon, 11 Jun 2007) | 5 lines
Change all occurrences of super(<thisclass>, <firstarg>) to super().
Seems to have worked, all the tests still pass.
Exception: test_descr and test_descrtut, which have tons of these
and are there to test the various usages.
................
r55939 | collin.winter | 2007-06-12 13:57:33 -0700 (Tue, 12 Jun 2007) | 1 line
Patch #1735485: remove StandardError from the exception hierarchy.
................
r55954 | neal.norwitz | 2007-06-12 21:56:32 -0700 (Tue, 12 Jun 2007) | 51 lines
Merged revisions 55913-55950 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55926 | marc-andre.lemburg | 2007-06-12 02:09:58 -0700 (Tue, 12 Jun 2007) | 3 lines
Apply patch #1734945 to support TurboLinux as distribution.
........
r55927 | marc-andre.lemburg | 2007-06-12 02:26:49 -0700 (Tue, 12 Jun 2007) | 3 lines
Add patch #1726668: Windows Vista support.
........
r55929 | thomas.heller | 2007-06-12 08:36:22 -0700 (Tue, 12 Jun 2007) | 1 line
Checkout, but do not yet try to build, exernal sources.
........
r55930 | thomas.heller | 2007-06-12 09:08:27 -0700 (Tue, 12 Jun 2007) | 6 lines
Add bufferoverflowU.lib to the libraries needed by _ssl (is this the
right thing to do?).
Set the /XP64 /RETAIL build enviroment in the makefile when building
ReleaseAMD64.
........
r55931 | thomas.heller | 2007-06-12 09:23:19 -0700 (Tue, 12 Jun 2007) | 5 lines
Revert this change, since it breaks the win32 build:
Add bufferoverflowU.lib to the libraries needed by _ssl (is this the
right thing to do?).
........
r55934 | thomas.heller | 2007-06-12 10:28:31 -0700 (Tue, 12 Jun 2007) | 3 lines
Specify the bufferoverflowU.lib to the makefile on the command line
(for ReleaseAMD64 builds).
........
r55937 | thomas.heller | 2007-06-12 12:02:59 -0700 (Tue, 12 Jun 2007) | 3 lines
Add bufferoverflowU.lib to PCBuild\_bsddb.vcproj.
Build sqlite3.dll and bsddb.
........
r55938 | thomas.heller | 2007-06-12 12:56:12 -0700 (Tue, 12 Jun 2007) | 2 lines
Don't rebuild Berkeley DB if not needed (this was committed by accident).
........
r55948 | martin.v.loewis | 2007-06-12 20:42:19 -0700 (Tue, 12 Jun 2007) | 3 lines
Provide PY_LLONG_MAX on all systems having long long.
Will backport to 2.5.
........
................
r55959 | guido.van.rossum | 2007-06-13 09:22:41 -0700 (Wed, 13 Jun 2007) | 2 lines
Fix a compilation warning.
................
2007-06-13 18:07:49 +00:00
|
|
|
"This works for class methods too:\n"
|
|
|
|
|
"class C(B):\n"
|
|
|
|
|
" @classmethod\n"
|
|
|
|
|
" def cmeth(cls, arg):\n"
|
2010-05-09 15:52:27 +00:00
|
|
|
" super().cmeth(arg)\n");
|
2001-08-24 16:47:00 +00:00
|
|
|
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
static int
|
|
|
|
|
super_traverse(PyObject *self, visitproc visit, void *arg)
|
|
|
|
|
{
|
2025-02-25 11:44:59 +01:00
|
|
|
superobject *su = superobject_CAST(self);
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
Py_VISIT(su->obj);
|
|
|
|
|
Py_VISIT(su->type);
|
|
|
|
|
Py_VISIT(su->obj_type);
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
|
2010-05-09 15:52:27 +00:00
|
|
|
return 0;
|
Add Garbage Collection support to new-style classes (not yet to their
instances).
Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy. (Only type objects have a tp_clear
field; the other types are.)
One change was necessary to the GC infrastructure. We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header. Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests... In short, a mess. So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not. This slot is
only relevant for types that have the (new) GC flag bit set. If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers. This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).
I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs. (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)
2001-10-02 21:24:57 +00:00
|
|
|
}
|
|
|
|
|
|
2022-03-06 14:21:28 +08:00
|
|
|
static PyObject *
|
|
|
|
|
super_vectorcall(PyObject *self, PyObject *const *args,
|
|
|
|
|
size_t nargsf, PyObject *kwnames)
|
|
|
|
|
{
|
|
|
|
|
assert(PyType_Check(self));
|
|
|
|
|
if (!_PyArg_NoKwnames("super", kwnames)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
|
|
|
|
|
if (!_PyArg_CheckPositional("super()", nargs, 0, 2)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
PyTypeObject *type = NULL;
|
|
|
|
|
PyObject *obj = NULL;
|
|
|
|
|
PyTypeObject *self_type = (PyTypeObject *)self;
|
|
|
|
|
PyObject *su = self_type->tp_alloc(self_type, 0);
|
|
|
|
|
if (su == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
// 1 or 2 argument form super().
|
|
|
|
|
if (nargs != 0) {
|
|
|
|
|
PyObject *arg0 = args[0];
|
|
|
|
|
if (!PyType_Check(arg0)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"super() argument 1 must be a type, not %.200s", Py_TYPE(arg0)->tp_name);
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
type = (PyTypeObject *)arg0;
|
|
|
|
|
}
|
|
|
|
|
if (nargs == 2) {
|
|
|
|
|
obj = args[1];
|
|
|
|
|
}
|
|
|
|
|
if (super_init_impl(su, type, obj) < 0) {
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
return su;
|
|
|
|
|
fail:
|
|
|
|
|
Py_DECREF(su);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-24 16:47:00 +00:00
|
|
|
PyTypeObject PySuper_Type = {
|
2010-05-09 15:52:27 +00:00
|
|
|
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
|
|
|
|
"super", /* tp_name */
|
|
|
|
|
sizeof(superobject), /* tp_basicsize */
|
|
|
|
|
0, /* tp_itemsize */
|
|
|
|
|
/* methods */
|
|
|
|
|
super_dealloc, /* tp_dealloc */
|
2019-05-31 04:13:39 +02:00
|
|
|
0, /* tp_vectorcall_offset */
|
2010-05-09 15:52:27 +00:00
|
|
|
0, /* tp_getattr */
|
|
|
|
|
0, /* tp_setattr */
|
2019-05-31 04:13:39 +02:00
|
|
|
0, /* tp_as_async */
|
2010-05-09 15:52:27 +00:00
|
|
|
super_repr, /* tp_repr */
|
|
|
|
|
0, /* tp_as_number */
|
|
|
|
|
0, /* tp_as_sequence */
|
|
|
|
|
0, /* tp_as_mapping */
|
|
|
|
|
0, /* tp_hash */
|
|
|
|
|
0, /* tp_call */
|
|
|
|
|
0, /* tp_str */
|
|
|
|
|
super_getattro, /* tp_getattro */
|
|
|
|
|
0, /* tp_setattro */
|
|
|
|
|
0, /* tp_as_buffer */
|
|
|
|
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
|
|
|
|
|
Py_TPFLAGS_BASETYPE, /* tp_flags */
|
|
|
|
|
super_doc, /* tp_doc */
|
|
|
|
|
super_traverse, /* tp_traverse */
|
|
|
|
|
0, /* tp_clear */
|
|
|
|
|
0, /* tp_richcompare */
|
|
|
|
|
0, /* tp_weaklistoffset */
|
|
|
|
|
0, /* tp_iter */
|
|
|
|
|
0, /* tp_iternext */
|
|
|
|
|
0, /* tp_methods */
|
|
|
|
|
super_members, /* tp_members */
|
|
|
|
|
0, /* tp_getset */
|
|
|
|
|
0, /* tp_base */
|
|
|
|
|
0, /* tp_dict */
|
|
|
|
|
super_descr_get, /* tp_descr_get */
|
|
|
|
|
0, /* tp_descr_set */
|
|
|
|
|
0, /* tp_dictoffset */
|
|
|
|
|
super_init, /* tp_init */
|
|
|
|
|
PyType_GenericAlloc, /* tp_alloc */
|
|
|
|
|
PyType_GenericNew, /* tp_new */
|
|
|
|
|
PyObject_GC_Del, /* tp_free */
|
2025-02-25 11:44:59 +01:00
|
|
|
.tp_vectorcall = super_vectorcall,
|
2001-08-24 16:47:00 +00:00
|
|
|
};
|