1599 Commits

Author SHA1 Message Date
Michael W. Hudson
78e179cdcf backport theller's checkin of
revision 1.73 of marshal.c

Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000).
See there for a description.

Added test case.

Bugfix candidate for 2.2.x, not sure about previous versions:
probably low priority, because virtually no one runs debug builds.
2002-09-24 11:55:54 +00:00
Michael W. Hudson
070fe1680a backport nowonder's checkin of
revision 2.265 of bltinmodule.c

date: 2002/08/27 16:58:00;  author: nowonder;  state: Exp;  lines: +1 -1

execfile should call PyErr_SetFromErrnoWithFilename instead of
simply PyErr_SetFromErrno

This closes bug 599163.
2002-09-24 11:23:05 +00:00
Guido van Rossum
2992e13268 Backported 1.39 and 1.40 from trunk:
1.39:
Fix SF bug 610610 (reported by Martijn Pieters, diagnosed by Neal Norwitz).

The switch in Exception__str__ didn't clear the error if
PySequence_Size() raised an exception.  Added a case -1 which clears
the error and falls through to the default case.

1.40:
Two more cases of switch(PySequence_Size()) without checking for case -1.
(Same problem as last checkin for SF bug 610610)
Need to clear the error and proceed.
2002-09-23 21:19:44 +00:00
Neal Norwitz
677ed2cb68 SF bug # 557028, illegal use of malloc/free
This only applies to 2.2.  Use PyMem_Malloc/Free instead of malloc/free.
2002-08-11 15:40:35 +00:00
Neil Schemenauer
3d6247a3e3 Remove calls to 2.1 GC API (they are noops). 2002-08-05 14:46:29 +00:00
Martin v. Löwis
59b5b4720b Patch #554716: Use __va_copy where available. 2002-07-28 10:21:31 +00:00
Fred Drake
ed06e07dc9 Fix the docstring for sys.getrefcount().
Closes SF bug #571759.
2002-06-20 21:35:02 +00:00
Fred Drake
2c5d1ab857 PyModule_AddObject(): Added missing exceptions.
Closes SF bug #523473.
2002-06-17 17:16:34 +00:00
Guido van Rossum
9d21cd7e1a Backport:
SF bug 567538: Generator can crash the interpreter (Finn Bock).

This was a simple typo.  Strange that the compiler didn't catch it!
Instead of WHY_CONTINUE, two tests used CONTINUE_LOOP, which isn't a
why_code at all, but an opcode; but even though 'why' is declared as
an enum, comparing it to an int is apparently not even worth a
warning -- not in gcc, and not in VC++. :-(
2002-06-12 03:48:46 +00:00
Neal Norwitz
f79e084e38 Fix SF #561858 Assertion with very long lists
if co_stacksize was > 32767 (the maximum value
which can be stored in 16 bits (signed)),
the PyCodeObject would be written wrong.
So on the second import (reading the .pyc)
would cause a crash.

Since we can't change the PYC magic, we
go on (silently), but don't write the file.
This means everything will work, but
a .pyc will not be written and the file will need
to be parsed on each import.

I will backport.
2002-06-01 18:26:22 +00:00
Anthony Baxter
911933704e backport tim_one's patch:
Repair widespread misuse of _PyString_Resize.  Since it's clear people
don't understand how this function works, also beefed up the docs.  The
most common usage error is of this form (often spread out across gotos):

	if (_PyString_Resize(&s, n) < 0) {
		Py_DECREF(s);
		s = NULL;
		goto outtahere;
	}

The error is that if _PyString_Resize runs out of memory, it automatically
decrefs the input string object s (which also deallocates it, since its
refcount must be 1 upon entry), and sets s to NULL.  So if the "if"
branch ever triggers, it's an error to call Py_DECREF(s):  s is already
NULL!  A correct way to write the above is the simpler (and intended)

	if (_PyString_Resize(&s, n) < 0)
		goto outtahere;

Bugfix candidate.

Original patch(es):
python/dist/src/Python/bltinmodule.c:2.253
2002-04-30 04:05:33 +00:00
Michael W. Hudson
1f828b6297 This may well be my final checkin before 2.2.1.
If you think I've forgotten something, now is a good
time to howl (although I won't read the howl for a good
few hours 'cause I'm going home).

backport lemburg's checkin of
    revision 2.158 of pythonrun.c

Move Unicode finalization further down in the chain.
Fixes bug #525620.
2002-04-08 17:00:54 +00:00
Guido van Rossum
5b172978bb Add bool(), True, False (as ints) for backwards compatibility. 2002-04-08 13:31:12 +00:00
Guido van Rossum
919c066be2 Backport to 2.2.1:
This is Neil's fix for SF bug 535905 (Evil Trashcan and GC interaction).

The fix makes it possible to call PyObject_GC_UnTrack() more than once
on the same object, and then move the PyObject_GC_UnTrack() call to
*before* the trashcan code is invoked.

BUGFIX CANDIDATE!
2002-03-29 14:47:18 +00:00
Guido van Rossum
fe34d0facd Backport to 2.2.1.
Fix an issue that was reported in but unrelated to the main problem of
SF bug 535905 (Evil Trashcan and GC interaction).

The SETLOCAL() macro should not DECREF the local variable in-place and
then store the new value; it should copy the old value to a temporary
value, then store the new value, and then DECREF the temporary value.
This is because it is possible that during the DECREF the frame is
accessed by other code (e.g. a __del__ method or gc.collect()) and the
variable would be pointing to already-freed memory.

BUGFIX CANDIDATE!
2002-03-28 20:18:48 +00:00
Michael W. Hudson
6ce28c36ad backport nascheme's checkin of
revision 2.102 of sysmodule.c

Fix wording of sys.exit docstring.  Close SF bug 534113.
2002-03-25 12:33:56 +00:00
Michael W. Hudson
db780071b7 backport tim_one's checkin of
revision 2.248 of bltinmodule.c

Docstring for filter():  Someone on the Tutor list reasonably complained
that it didn't tell enough of the truth.
Bugfix candidate (I guess -- it helps and it's harmless).
2002-03-11 10:15:00 +00:00
Michael W. Hudson
f51017d5f7 backport tim_one's checkin of
revision 2.22 of thread_nt.h

SF patch  522961: Leak in Python/thread_nt.h, from Gerald S. Williams.
A file-static "threads" dict mapped thread IDs to Windows handles, but
was never referenced, and entries never got removed.  This gets rid of
the YAGNI-dict entirely.
Bugfix candidate.
2002-03-05 13:56:23 +00:00
Martin v. Löwis
59509f511e Patch #50002: Display line information for bad \x escapes:
- recognize "SyntaxError"s by the print_file_and_line attribute.
- add the syntaxerror attributes to all exceptions in compile.c.
Fixes #221791
2002-03-03 21:32:01 +00:00
Neal Norwitz
ebaaf18711 SF #506611, fix sys.setprofile(), sys.settrace() core dumps
when no arguments are passed
2002-03-03 15:17:07 +00:00
Michael W. Hudson
6ac411e448 backport my checkin of
revision 1.16 of getcopyright.c

date: 2002/02/27 13:29:46;  author: mwh;  state: Exp;  lines: +1 -1
Add 2002 to PSF copyrights.
2002-02-27 13:31:58 +00:00
Michael W. Hudson
d17700cc49 Backport jackjansen's checkin of revision 2.37:
Workaround for what is probably a problem in Apple's gcc: <pthread.h> fails
on a function pointer formal argument called "destructor", which is typedeffed
as a different function pointer type in object.h.
2002-02-23 08:43:03 +00:00
Michael W. Hudson
fa338d7fad Fix a bunch of typos found by nnorwitz. 2002-02-06 17:06:03 +00:00
Michael W. Hudson
7043010028 It's merge time! (well, this is the last one for the moment)
Backport gvanrossum's checkin of revision 2.236:

A tentative fix for SF bug #503837 (Roeland Rengelink):
type.__module__ problems (again?)

This simply initializes the __module__ local in a class statement from
the __name__ global.  I'm not 100% sure that this is the correct fix,
although it usually does the right thing.  The problem is that if the
class statement executes in a custom namespace, the __name__ global
may be taken from __builtins__, in which case it would have the value
__builtin__, or it may not exist at all (if the custom namespace also
has a custom __builtins__), in which case the class statement will
fail.

Nevertheless, unless someone finds a better solution, this is a 2.2.1
bugfix too.

(apparently noone has :()
2002-01-28 16:06:11 +00:00
Michael W. Hudson
23d65ff4e4 It's merge time!
Backport loewis' checkin of revision 2.7 (of dynload_hpux.c):

Test for error status of shl_findsym. Fixes #505417. 2.2.1 candiate.
2002-01-28 15:13:21 +00:00