Commit Graph

35755 Commits

Author SHA1 Message Date
Tim Peters c02c1c8a12 Whitespace normalization. 2006-08-15 00:25:04 +00:00
Georg Brandl 9dc7b7ce82 Patch #1511317: don't crash on invalid hostname info 2006-08-14 22:10:24 +00:00
Georg Brandl d76bd69712 Cookie.py shouldn't "bogusly" use string._idmap. 2006-08-14 22:01:24 +00:00
Georg Brandl 7a1af770b9 Patch #1536071: trace.py should now find the full module name of a
file correctly even on Windows.
2006-08-14 21:55:28 +00:00
Georg Brandl 85fec59104 Add an additional test: BZ2File write methods should raise IOError
when file is read-only.
2006-08-14 21:45:32 +00:00
Georg Brandl 3335a7ad63 Patch #1535500: fix segfault in BZ2File.writelines and make sure it
raises the correct exceptions.
2006-08-14 21:42:55 +00:00
Georg Brandl 2463f8f831 Make tabnanny recognize IndentationErrors raised by tokenize.
Add a test to test_inspect to make sure indented source
is recognized correctly. (fixes #1224621)
2006-08-14 21:34:08 +00:00
Georg Brandl 26a07b5198 Fix refleak introduced in rev. 51248. 2006-08-14 20:25:39 +00:00
Thomas Heller 1ce433e937 News item for rev 51281. 2006-08-14 16:20:04 +00:00
Thomas Heller ef8d513d62 Patch #1536908: Add support for AMD64 / OpenBSD.
Remove the -no-stack-protector compiler flag for OpenBSD
as it has been reported to be unneeded.
2006-08-14 16:17:41 +00:00
Marc-André Lemburg 3a457790c7 Correct an accidentally removed previous patch. 2006-08-14 12:57:27 +00:00
Georg Brandl 4873fb2bac Improve markup in PyUnicode_RichCompare. 2006-08-14 12:36:06 +00:00
Marc-André Lemburg 757ea27b0f Readd NEWS items that were accidentally removed by r51276. 2006-08-14 11:44:34 +00:00
Thomas Heller 867200483b 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.
2006-08-14 11:17:48 +00:00
Marc-André Lemburg 040f76b79c 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.
2006-08-14 10:55:19 +00:00
Thomas Heller e6dd31c50b Revert the change that tries to zero out a closure's result storage
area because the size if unknown in source/callproc.c.
2006-08-14 10:02:24 +00:00
Thomas Heller dca703fbda Check for NULL return value of GenericCData_new().
Fixes klockwork issues #188, #189.
2006-08-14 07:50:14 +00:00
Thomas Heller efa2727334 Check for NULL return value from new_CArgObject().
Fixes klockwork issues #183, #184, #185.
2006-08-14 07:14:09 +00:00
Thomas Heller acdedfbf0a Remove unused, buggy test function.
Fixes klockwork issue #207.
2006-08-14 07:13:05 +00:00
Neal Norwitz 4c7317768b Update purify doc some. 2006-08-14 01:49:54 +00:00
Neal Norwitz af33f2d571 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.
2006-08-14 00:59:03 +00:00
Neal Norwitz 714a59d265 Ignore pgen.exe and kill_python.exe for cygwin 2006-08-14 00:51:15 +00:00
Neal Norwitz 5ed4997e1f Get rid of compiler warning 2006-08-13 18:41:15 +00:00
Neal Norwitz 93bf902242 Handle alloca failures.
Klocwork 225-228
2006-08-13 18:40:39 +00:00
Neal Norwitz 9ac8953568 Handle malloc failure.
Klocwork 281
2006-08-13 18:13:36 +00:00
Neal Norwitz ccc56c7c96 Really address the issue of where to place the assert for leftblock.
(Followup of Klocwork 274)
2006-08-13 18:13:02 +00:00
Neal Norwitz 20745b1a70 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.
2006-08-13 18:12:45 +00:00
Neal Norwitz 26a8abf1f4 Handle failures from lookup.
Klocwork 341-342
2006-08-13 18:12:26 +00:00
Neal Norwitz ee7c8f9af8 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
2006-08-13 18:12:03 +00:00
Neal Norwitz 5aa96895d8 Handle malloc and fopen failures more gracefully.
Klocwork 180-181
2006-08-13 18:11:43 +00:00
Neal Norwitz e9ac0bb169 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.
2006-08-13 18:11:27 +00:00
Neal Norwitz 56423e5762 Fix segfault when doing string formatting on subclasses of long if
__oct__, __hex__ don't return a string.

Klocwork 308
2006-08-13 18:11:08 +00:00
Neal Norwitz 3cb31ac704 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
2006-08-13 18:10:47 +00:00
Neal Norwitz b09f4f578f Handle a whole lot of failures from PyString_FromInternedString().
Should fix most of Klocwork 234-272.
2006-08-13 18:10:28 +00:00
Neal Norwitz df6a6494cb Move/copy assert for tstate != NULL before first use.
Verify that PyEval_Get{Globals,Locals} returned valid pointers.

Klocwork 231-232
2006-08-13 18:10:10 +00:00
Neal Norwitz bfa5f0bb5d SF bug #1539336, distutils example code missing 2006-08-13 00:20:49 +00:00
Neal Norwitz 1872b1c01f 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.
2006-08-12 18:44:06 +00:00
Neal Norwitz 8a87f5d37e 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.
2006-08-12 17:03:09 +00:00
Georg Brandl f3e304297e Repair logging test spew caused by rev. 51206. 2006-08-12 08:32:02 +00:00
Tim Peters 953c1897d2 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.
2006-08-12 05:17:41 +00:00
Tim Peters 1742f3331f 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.
2006-08-12 04:42:47 +00:00
Neal Norwitz ebcf8759bb 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)
2006-08-12 03:18:50 +00:00
Neal Norwitz 0f7dbf731a PyModule_GetDict() can fail, produce fatal errors if this happens on startup.
Klocwork #298-299.
2006-08-12 03:17:41 +00:00
Neal Norwitz b88cfad318 Check return of PyMem_MALLOC (garbage) is non-NULL.
Check seq in both portions of if/else.

Klocwork #289-290.
2006-08-12 03:16:54 +00:00
Neal Norwitz 5f17d9a1df Don't deref v if it's NULL.
Klocwork #214
2006-08-12 02:33:36 +00:00
Neal Norwitz 421c1319ad 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 2006-08-12 02:12:30 +00:00
Neal Norwitz 6b4953fd3d Check returned pointer is valid.
Klocwork #233
2006-08-12 02:06:34 +00:00
Neal Norwitz b45f351832 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
2006-08-12 01:57:47 +00:00
Neal Norwitz ef0de023db 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
2006-08-12 01:53:28 +00:00
Neal Norwitz 9cd3c34b6a Move the assert which checks for a NULL pointer first.
Klocwork #274.
2006-08-12 01:51:12 +00:00