Tim Peters [Fri, 31 Mar 2006 04:11:16 +0000 (04:11 +0000)]
test_main(): Restore the decimal context that was in
effect at the time test_decimal was imported. Else
running test_decimal had the bad side effect of
permanently changing the decimal context in effect.
That caused text_tokenize to fail if it ran after
test_decimal.
Barry Warsaw [Thu, 30 Mar 2006 22:45:35 +0000 (22:45 +0000)]
SF patch #1458476 with modifications based on discussions in python-dev. This
adds the following API calls: PySet_Clear(), _PySet_Next(), and
_PySet_Update(). The latter two are considered non-public. Tests and
documentation (for the public API) are included.
Ronald Oussoren [Thu, 30 Mar 2006 20:18:33 +0000 (20:18 +0000)]
Add '-Wno-deprecated-warnings' to the compile flags for the Carbon extensions
on OSX 10.4 or later. This stops the compiler for complaining about calls to
deprecated functions in these extensions, they are supposed to wrap as much
of Carbon as possible.
Fred Drake [Thu, 30 Mar 2006 02:58:38 +0000 (02:58 +0000)]
merge revision 43437 from the release24-maint branch:
- update the refcount information (late, but not a bad thing to do...)
- clarify that PyGen_New() steals a reference
Thomas Wouters [Tue, 28 Mar 2006 08:44:55 +0000 (08:44 +0000)]
In true regression-test spirit, make sure the
itertools.tee->instance->attribute->itertools.tee and
itertools.tee->teedataobject->itertools.tee cycles, which can be found now
that itertools.tee and its teedataobject participate in GC, remain findable
and cleanable. The test won't fail when they aren't, but at least the
frequent hunt-refleaks runs would spot the rise in refleaks.
Thomas Wouters [Mon, 27 Mar 2006 21:02:13 +0000 (21:02 +0000)]
Make itertools.tee and its internal teedataobject participate in GC. This
alone does not solve the leak in test_generators, unfortunately, but it is
part of test_generators' problem and it does solve other cycles.
def foo((x)): was getting recognized as requiring tuple unpacking
which is not correct.
Add tests for this case and the proper way to unpack a tuple of one:
def foo((x,)):
test_inpsect was incorrect before. I'm not sure why it was passing,
but that has been corrected with a test for both functions above.
This means the test (and therefore inspect.getargspec()) are broken in 2.4.
Tim Peters [Sun, 26 Mar 2006 23:27:58 +0000 (23:27 +0000)]
Years in the making.
objimpl.h, pymem.h: Stop mapping PyMem_{Del, DEL} and PyMem_{Free, FREE}
to PyObject_{Free, FREE} in a release build. They're aliases for the
system free() now.
_subprocess.c/sp_handle_dealloc(): Since the memory was originally
obtained via PyObject_NEW, it must be released via PyObject_FREE (or
_DEL).
pythonrun.c, tokenizer.c, parsermodule.c: I lost count of the number of
PyObject vs PyMem mismatches in these -- it's like the specific
function called at each site was picked at random, sometimes even with
memory obtained via PyMem getting released via PyObject. Changed most
to use PyObject uniformly, since the blobs allocated are predictably
small in most cases, and obmalloc is generally faster than system
mallocs then.
If extension modules in real life prove as sloppy as Python's front
end, we'll have to revert the objimpl.h + pymem.h part of this patch.
Note that no problems will show up in a debug build (all calls still go
thru obmalloc then). Problems will show up only in a release build, most
likely segfaults.
Neal Norwitz [Sun, 26 Mar 2006 03:11:57 +0000 (03:11 +0000)]
Try to handle sys.getfilesystemencoding() returning None.
ascii seems like the safest bet that it will exist. I wonder if utf-8
would be a better choice? This should get test_fileinput passing on OpenBSD.
Phillip J. Eby [Sat, 25 Mar 2006 00:28:24 +0000 (00:28 +0000)]
Fix a problem with @contextmanager not detecting a broken generator
that yields after a throw(). Make @contextmanager not reraise
exceptions, but return a false value in that case instead. Add test
cases for both behaviors.