Georg Brandl [Fri, 18 Aug 2006 07:28:03 +0000 (07:28 +0000)]
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.
(backport from rev. 51364)
Anthony Baxter [Thu, 17 Aug 2006 00:38:04 +0000 (00:38 +0000)]
Branching release25-maint. All further 2.5 releases (including the release candidates,
the final release and all bugfix releases) will be from this branch, not the trunk.
Kurt B. Kaiser [Wed, 16 Aug 2006 21:45:59 +0000 (21:45 +0000)]
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'.
Thomas Heller [Wed, 16 Aug 2006 15:10:12 +0000 (15:10 +0000)]
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)
Thomas Heller [Wed, 16 Aug 2006 14:07:44 +0000 (14:07 +0000)]
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.
Thomas Heller [Wed, 16 Aug 2006 13:03:11 +0000 (13:03 +0000)]
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.
Ka-Ping Yee [Wed, 16 Aug 2006 07:02:50 +0000 (07:02 +0000)]
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.
Neal Norwitz [Tue, 15 Aug 2006 04:58:28 +0000 (04:58 +0000)]
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:
Georg Brandl [Mon, 14 Aug 2006 21:34:08 +0000 (21:34 +0000)]
Make tabnanny recognize IndentationErrors raised by tokenize.
Add a test to test_inspect to make sure indented source
is recognized correctly. (fixes #1224621)
Thomas Heller [Mon, 14 Aug 2006 11:17:48 +0000 (11:17 +0000)]
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.
Neal Norwitz [Mon, 14 Aug 2006 00:59:03 +0000 (00:59 +0000)]
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.
Neal Norwitz [Sun, 13 Aug 2006 18:12:03 +0000 (18:12 +0000)]
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.)
Neal Norwitz [Sat, 12 Aug 2006 18:44:06 +0000 (18:44 +0000)]
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.
Neal Norwitz [Sat, 12 Aug 2006 17:03:09 +0000 (17:03 +0000)]
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.
Tim Peters [Sat, 12 Aug 2006 04:42:47 +0000 (04:42 +0000)]
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.
Neal Norwitz [Sat, 12 Aug 2006 02:12:30 +0000 (02:12 +0000)]
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
Neal Norwitz [Sat, 12 Aug 2006 01:57:47 +0000 (01:57 +0000)]
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).
Neal Norwitz [Sat, 12 Aug 2006 01:50:38 +0000 (01:50 +0000)]
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.
Neal Norwitz [Sat, 12 Aug 2006 01:47:59 +0000 (01:47 +0000)]
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.
Neal Norwitz [Sat, 12 Aug 2006 01:45:47 +0000 (01:45 +0000)]
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?
Thomas Heller [Fri, 11 Aug 2006 19:55:35 +0000 (19:55 +0000)]
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.