Tim Peters [Tue, 11 Apr 2006 19:12:33 +0000 (19:12 +0000)]
_Py_PrintReferenceAddresses,_Py_PrintReferences:
interpolate PY_FORMAT_SIZE_T for refcount display
instead of casting refcounts to long.
I understand that gcc on some boxes delivers
nuisance warnings about this, but if any new ones
appear because of this they'll get fixed by magic
when the others get fixed.
Anthony Baxter [Tue, 11 Apr 2006 12:01:56 +0000 (12:01 +0000)]
more low-hanging fruit to make code compile under a C++ compiler. Not
entirely happy with the two new VISIT macros in compile.c, but I
couldn't see a better approach.
As discussed on python-dev, really fix the PyMem_*/PyObject_* memory API
mismatches. At least I hope this fixes them all.
This reverts part of my change from yesterday that converted everything
in Parser/*.c to use PyObject_* API. The encoding doesn't really need
to use PyMem_*, however, it uses new_string() which must return PyMem_*
for handling the result of PyOS_Readline() which returns PyMem_* memory.
If there were 2 versions of new_string() one that returned PyMem_*
for tokens and one that return PyObject_* for encodings that could
also fix this problem. I'm not sure which version would be clearer.
This seems to fix both Guido's and Phillip's problems, so it's good enough
for now. After this change, it would be good to review Parser/*.c
for consistent use of the 2 memory APIs.
Anthony Baxter [Tue, 11 Apr 2006 07:42:36 +0000 (07:42 +0000)]
More low-hanging fruit. Still need to re-arrange some code (or find a better
solution) in the same way as listobject.c got changed. Hoping for a better
solution.
Anthony Baxter [Tue, 11 Apr 2006 06:54:30 +0000 (06:54 +0000)]
More C++-compliance. Note especially listobject.c - to get C++ to accept the
PyTypeObject structures, I had to make prototypes for the functions, and
move the structure definition ahead of the functions. I'd dearly like a better
way to do this - to change this would make for a massive set of changes to
the codebase.
There's still some warnings - this is purely to get rid of errors first.
Anthony Baxter [Tue, 11 Apr 2006 05:39:14 +0000 (05:39 +0000)]
Fix the code in Parser/ to also compile with C++. This was mostly casts for
malloc/realloc type functions, as well as renaming one variable called 'new'
in tokensizer.c. Still lots more to be done, going to be checking in one
chunk at a time or the patch will be massively huge. Still compiles ok with
gcc.
Tim Peters [Tue, 11 Apr 2006 02:59:48 +0000 (02:59 +0000)]
Try to repair what may be the last new test failure on the
"x86 OpenBSD trunk" buildbot due to changing Python so that
Python-exposed addresses are always non-negative.
test_int_pointer_arg(): This line failed now whenever the
box happened to assign an address to `ci` "with the sign
bit set":
The problem is that the ctypes addressof() inherited "all
addresses are non-negative now" from changes to
PyLong_FromVoidPtr(), but byref() did not inherit that
change and can still return a negative int.
I don't know whether, or what, the ctypes implementation wants
to do about that (possibly nothing), but in the meantime
the test fails frequently.
So, introduced a Python positive_address() function in
the test module, that takes a purported machine address and,
if negative, converts it to a non-negative value "with the
same bits". This should leave the test passing under all
versions of Python.
Belated thanks to Armin Rigo for teaching me the sick trick ;-)
for determining the # of bits in a machine pointer via abuse
of the struct module.
Tim Peters [Tue, 11 Apr 2006 01:59:34 +0000 (01:59 +0000)]
subclasspropagation(): Squash two more bogus hash(x) == id(x)
tests. Alas, because only the "x86 OpenBSD trunk" buildbot fails
these tests, and test_descr stops after the first failure, there's
no sane way for me to fix these short of fixing one and then
waiting for the buildbot to reveal the next one.
Tim Peters [Tue, 11 Apr 2006 01:44:07 +0000 (01:44 +0000)]
More words on patch #837242, since 4 or 5 tests started
failing on one of the 32-bit buildbot boxes because of it,
due to tempting but always-wrong Python code. Users
probably have code like this too (I know I did ...).
Tim Peters [Tue, 11 Apr 2006 01:21:00 +0000 (01:21 +0000)]
specials(): squash another incorrect hash(x) == id(x)
test. Add some lines that at least invoke the default
__hash__, although there's nothing to check there beyond
that they don't blow up.
Updated the warnings, linecache, inspect, traceback, site, and doctest modules
to work correctly with modules imported from zipfiles or via other PEP 302
__loader__ objects. Tests and doc updates are included.
Tim Peters [Tue, 11 Apr 2006 00:43:27 +0000 (00:43 +0000)]
Try to repair more new buildbot failures in "x86 OpenBSD trunk", due
to that id() can now return a Python long on a 32-bit box that allocates
addresses "with the sign bit set".
test_set.py test_subclass_with_custom_hash(): it's never been portably
legal for a __hash__() method to return id(self), but on 32-bit boxes
that never caused a problem before it became possible for id() to
return a Python long. Changed __hash__ here to return a Python int
regardless of platform.
test_descr.py specials():
vereq(hash(c1), id(c1))
has never been a correct test -- just removed it (hash() is always
a Python int; id() may be a Python long).
Tim Peters [Mon, 10 Apr 2006 21:38:11 +0000 (21:38 +0000)]
Fix one of the tests that fails on the "x86 OpenBSD trunk" buildbot,
due to that id() may return a long on a 32-bit box now. On a box that
assigns addresses "with the sign bit set", id() always returns a long now.
Tim Peters [Mon, 10 Apr 2006 21:34:00 +0000 (21:34 +0000)]
Fix one of the tests that fails on the "x86 OpenBSD trunk" buildbot, due
to that id() may return a long on a 32-bit box now. On a box that assigns
addresses "with the sign bit set", id() always returns a long now.
Tim Peters [Mon, 10 Apr 2006 20:25:47 +0000 (20:25 +0000)]
DecimalContextTestCase: this permanently changed the
default decimal context, causing test_tokenize to fail
if it ran after test_contextlib. Changed to restore
the decimal context in effect at the test's start.
SF Patch #1463867: Improved generator finalization to allow generators
that are suspended outside of any try/except/finally blocks to be
garbage collected even if they are part of a cycle. Generators that
suspend inside of an active try/except or try/finally block (including
those created by a ``with`` statement) are still not GC-able if they
are part of a cycle, however.
Martin v. Löwis [Mon, 10 Apr 2006 15:55:37 +0000 (15:55 +0000)]
Patch #1467770: Add Popen objects to _active only in __del__.
Introduce _child_active member to keep track on whether a child
needs to be waited for.
Backport candidate.
SF patch #1467512, fix double free with triple quoted string in standard build.
This was the result of inconsistent use of PyMem_* and PyObject_* allocators.
By changing to use PyObject_* allocator almost everywhere, this removes
the inconsistency.
Anthony Baxter [Sun, 9 Apr 2006 15:07:40 +0000 (15:07 +0000)]
Python on OS X 10.3 and above now uses dlopen() (via dynload_shlib.c)
to load extension modules and now provides the dl module. As a result,
sys.setdlopenflags() now works correctly on these systems. (SF patch
#1454844)
Tim Peters [Sat, 8 Apr 2006 12:05:15 +0000 (12:05 +0000)]
test_timeout(): This test was added during Bug Day, but disabled
soon after because the gmail address it connects to started timing
out on all the buildbot slaves. Rewrote the test to produce a
warning message (instead of failing) when the address times out.
Also removed the special case for Windows -- this test started to
work on Windows as soon as bug 1462352 was fixed.
Thomas Heller [Thu, 6 Apr 2006 15:23:16 +0000 (15:23 +0000)]
Expose RTLD_LOCAL and RTLD_GLOBAL always from the _ctypes extension module.
If RTLD_LOCAL is not #defined in any header file (Windows), set it to 0.
If RTLD_GLOBAL is not #defined, set it equal to RTLD_LOCAL.
Anthony Baxter [Thu, 6 Apr 2006 07:12:39 +0000 (07:12 +0000)]
In some environments (under screen, in a chroot) curses doesn't support
mouse events. This makes the test fail. Catch that case and don't run
the tests. Should make the debian/ubuntu buildbots that run in a chroot
work again.