Jack Jansen [Mon, 10 Dec 2001 16:08:14 +0000 (16:08 +0000)]
The new menu initialization code would also add the SIOUX menus if a (frozen) Python program had installed its own menubar previously. We now guard against this, with a bit of a hack: FrameWork uses the same Menu ID as Sioux, and the init code checks that the text in the menu is "About SIOUX" before replacing it.
Guido van Rossum [Mon, 10 Dec 2001 15:45:54 +0000 (15:45 +0000)]
SF patch #491049 (David Jacobs): Small PyString_FromString optimization
PyString_FromString():
Since the length of the string is already being stored in size,
changed the strcpy() to a memcpy() for a small speed improvement.
Jack Jansen [Sun, 9 Dec 2001 23:25:00 +0000 (23:25 +0000)]
The module generator now tells its object generators about the module name (through the new setmodulename() method). If the module name has been set the object generators output it as part of the tp_name field for the object type.
Jack Jansen [Sun, 9 Dec 2001 23:15:56 +0000 (23:15 +0000)]
Mods by Tony Lownds (patch 490100, slightly massaged by me) to make Tkinter
work with Mac OS X Aqua-Tk, all nicely within ifdefs.
The process is not for the faint of heart, though: you need to download
and install the (alfa) Aqua-Tk, obtain a few needed X11 headers from
somewhere else and then everything builds. To run scripts using Tkinter
you must build with --enable-framework, build Python.app in Mac/OSX
and run your Tkinter scripts with that. Then, about half the tests in
Demo/tkinter work (or at least do something).
Checking this in anyway because it shouldn't break anything, and newer
versions of Aqua-Tk will streamline the process.
Finn Bock [Sun, 9 Dec 2001 10:19:25 +0000 (10:19 +0000)]
Moved a print statement outside the jython platform test. Otherwise
the output fails to compare correctly for jython. This change was part
of the original patch #403666.
Tim Peters [Sat, 8 Dec 2001 23:40:38 +0000 (23:40 +0000)]
PySymtableEntry_New(): I'm not sure what this routine is doing, but it
was obviously leaking an int object when whatever the heck it's looking for
was found. Repaired that. This accounts for why entering function and
class definitions at an interactive prompt leaked a reference to the
integer 1 each time.
Bugfix candidate.
Patch supplied by Burton Radons for his own SF bug #487390: Modifying
type.__module__ behavior.
This adds the module name and a dot in front of the type name in every
type object initializer, except for built-in types (and those that
already had this). Note that it touches lots of Mac modules -- I have
no way to test these but the changes look right. Apologies if they're
not. This also touches the weakref docs, which contains a sample type
object initializer. It also touches the mmap test output, because the
mmap type's repr is included in that output. It touches object.h to
put the correct description in a comment.
SF patch #490515 (Joe A) urllib.open_https() protocol issue
open_http():
In urllib.py library module, URLopener.open_https()
returns a class instance of addinfourl() with its
self.url property missing the protocol.
Instead of "https://www.someurl.com", it becomes
"://www.someurl.com".
Just van Rossum [Sat, 8 Dec 2001 09:51:41 +0000 (09:51 +0000)]
Don't do App.DrawThemeListBoxFrame() upon activate: it starts
looking worse and worse if you deactivate/activate the window
a few times. I don't know how to fix this properly, but I'm beginning
to think that it's almost impossible to support the Appearance
manager properly due to the way W works. Time for W2?...
Fred Drake [Fri, 7 Dec 2001 21:56:13 +0000 (21:56 +0000)]
Revise description of dumbdbm.open() to reflect that the flag argument is
ignored and that mode was ignored before Python 2.2.
This closes SF bug #490098.
Fred Drake [Fri, 7 Dec 2001 21:54:46 +0000 (21:54 +0000)]
Honor the mode argument to dumbdbm.open(); there is not good reason not to,
especially since the documentation described it in detail.
This partially closes SF bug #490098.
Fred Drake [Fri, 7 Dec 2001 21:35:57 +0000 (21:35 +0000)]
Describe the behavior of the read() method when the list of filenames
includes files that do not exist, explain the intended use of the interface,
and show how to ensure an expected file really exists.
This closes SF bug #490399.
I found that when run as a script, this test suite ran its tests
twice! Fixed this by avoiding the import of test_email, which loads
the module a second time in that situation, and fiddled the __main__
section to resemble other test suites using unittest.
Tim Peters [Fri, 7 Dec 2001 20:35:43 +0000 (20:35 +0000)]
SF patch #489173: Make os.spawnv not block the interpreter, from
Anthony Roach.
Release the global interpreter lock around platform spawn calls.
Bugfix candidate? Hard to say; I favor "yes, bugfix".
These clearly *should* have been releasing the GIL all along, if for no
other reason than compatibility with the similar os.system(). But it's
possible some program out there is (a) multithreaded, (b) calling a spawn
function with P_WAIT, and (c) relying on the spawn call to block all their
threads until the spawned program completes. I think it's very unlikely
anyone is doing that on purpose, but someone may be doing so by accident.
O_cwrite(): rewrote for clarity, replacing all the (Oobject *)self
casts with a variable oself that has the proper type. A smart
compiler may put this thing into a register.
(I'm not sure what good this does except satisfy my desire to
understand this function; I got a report about an uninitialized read
from Insure++ about this function and it hurt my eyes to even look at
it. I gotta run away or I'll get tempted to reformat the entire
file...)
_PyTuple_Resize(): this dumped core on tuple(globals()) for me. Turns
out the for loop at the end intended to zero out new items wasn't
doing anything, because sv->ob_size was already equal to newsize. The
fix slightly refactors the function, introducing a variable oldsize
and doing away with sizediff (which was used only once), and using
oldsize and newsize consistently. I also added comments explaining
what the two for loops do. (Looking at the CVS annotation of this
function, it's no miracle a bug crept in -- this has been patched by
many different folks! :-)
Jack Jansen [Fri, 7 Dec 2001 16:07:04 +0000 (16:07 +0000)]
Not being able to copy PythonCore to the system-folder is not a fatal error, on OSX the user may not have permission to do so. Also give a more informative message in this case.
Fix for #489672 (Neil Norwitz): memory leak in test_sre.
(At least for the repeatable test case that Tim produced.)
pattern_subx(): Add missing DECREF(filter) in both exit branches
(normal and error return). Also fix a DECREF(args) that should
certainly be a DECREF(match) -- because it's inside if (!args) and
right after allocation of match.
In unconditional except clauses, don't catch KeyboardInterrupt -- it's
annoying that often you have to hit ^C numerous times before it
works. The solution: before the "except:" clause, insert "except
KeyboardInterrupt: raise". This propagates KeyboardInterrupt out,
stopping the test in its tracks.
Tim Peters [Thu, 6 Dec 2001 23:16:09 +0000 (23:16 +0000)]
For ratecv, document that None should be the initial state argument (when
I was squashing spurious overflows in the implementation, I got hung up
on this point).
Fred Drake [Thu, 6 Dec 2001 22:59:54 +0000 (22:59 +0000)]
Visious hackery to solve a build-control problem related to our use of
distutils for the library modules built as shared objects. A better solution
appears possible, but with the threat that the distutils becomes more
magical ("complex").
This closes SF bug #458343.
Jack Jansen [Thu, 6 Dec 2001 22:58:56 +0000 (22:58 +0000)]
Don't fail on importing things with undefined references. Unfortunately we
still fail on importing modules that link with libraries that fail
their initialization code (such as windowing libraries when we don't have
access to the window server) and that is what I really wanted to fix.
Jack Jansen [Thu, 6 Dec 2001 21:47:20 +0000 (21:47 +0000)]
Test wether we are building on a case-insensitive filesystem (such
as OSX HFS+) and if so add an extension to the python executable, but
only in the build directory, not on the installed python.
Fix for SF bug #489671 (Neil Norwitz): memory leak in test_richcmp.
Had nothing to do with rich comparisons -- some stack cleanup code was
lost as a result of merging in Neil Schemenauer's generators patch.
Reinserted the stack cleanup code, skipping it when yielding.
Thomas Heller [Thu, 6 Dec 2001 20:44:19 +0000 (20:44 +0000)]
Use a version number of 0.0.0 instead of ???. The latter leads to
invalid filenames on Windows when building without specifying a
version number in the setup script.
See also
http://mail.python.org/pipermail/distutils-sig/2001-November/002656.html
Fix for #489669 (Neil Norwitz): memory leak in test_descr (unicode).
This is best reproduced by
while 1:
class U(unicode):
pass
U(u"xxxxxx")
The unicode_dealloc() code wasn't properly freeing the str and defenc
fields of the Unicode object when freeing a subtype instance. Fixed
this by a subtle refactoring that actually reduces the amount of code
slightly.
Fred Drake [Thu, 6 Dec 2001 16:51:41 +0000 (16:51 +0000)]
Be more careful about accessing attributes of the parent: if Tk has not been
initialized, this will be None, but the functions will still work (there will
simply be a bogus parent on the screen). Allowing the parent to be None
is useful when testing the functions from an interactive interpreter.
Add an optional keyword paramter "show" to the _QueryString class; when given
it is used to set the -show option to the entry widget. This allows passing
show="*" or the like to askstring(), making it useful for requesting
passwords/passphrases from the user.
This closes SF bug #438517.
Jeremy Hylton [Thu, 6 Dec 2001 15:48:16 +0000 (15:48 +0000)]
Fix memory leak in dict_to_map(), SF bug [ #485152 ] memory leak in test_scope.
PyCell_Set() incremenets the reference count, so the earlier XINCREF
causes a leak.
Also make a number of small performance improvements to the code on
the assumption that most of the time variables are not rebound across
a FastToLocals() / LocalsToFast() pair.
Replace uses of PyCell_Set() and PyCell_Get() with PyCell_SET() and
PyCell_GET(), since the frame is guaranteed to contain cells.
Jeremy Hylton [Thu, 6 Dec 2001 15:18:48 +0000 (15:18 +0000)]
Little stuff.
Add a missing DECREF in an obscure corner. If the str() or repr() of
an object passed to a string interpolation -- e.g. "%s" % obj --
returns a non-string, the returned object was leaked.
Repair an indentation glitch.
Replace a bunch of PyString_AsString() calls (and their ilk) with
macros.
Jeremy Hylton [Thu, 6 Dec 2001 14:34:58 +0000 (14:34 +0000)]
Fix [ #489673 ] memory leak in test_symtable: Free the st_future slot.
The st_future slot of the symtable is not freed by PySymtable_Free()
because it is shared by the symtable and compiling structs in
compiel.c. Since it is shared, it is explicitly deallocated when the
compiling struct is freed.
Fix a typo (probably caused by autocompletion <blush>) that caused a
leak when a class defined a __metaclass__. This fixes the problem
reported on python-dev by Ping; I dunno if it's the same as SF bug
#489669 (since that mentions Unicode).
Tim Peters [Thu, 6 Dec 2001 06:23:26 +0000 (06:23 +0000)]
SF bug #488514: -Qnew needs work
Big Hammer to implement -Qnew as PEP 238 says it should work (a global
option affecting all instances of "/").
pydebug.h, main.c, pythonrun.c: define a private _Py_QnewFlag flag, true
iff -Qnew is passed on the command line. This should go away (as the
comments say) when true division becomes The Rule. This is
deliberately not exposed to runtime inspection or modification: it's
a one-way one-shot switch to pretend you're using Python 3.
ceval.c: when _Py_QnewFlag is set, treat BINARY_DIVIDE as
BINARY_TRUE_DIVIDE.
test_{descr, generators, zipfile}.py: fiddle so these pass under
-Qnew too. This was just a matter of s!/!//! in test_generators and
test_zipfile. test_descr was trickier, as testbinop() is passed
assumptions that "/" is the same as calling a "__div__" method; put
a temporary hack there to call "__truediv__" instead when the method
name is "__div__" and 1/2 evaluates to 0.5.
Three standard tests still fail under -Qnew (on Windows; somebody
please try the Linux tests with -Qnew too! Linux runs a whole bunch
of tests Windows doesn't):
test_augassign
test_class
test_coercion
I can't stay awake longer to stare at this (be my guest). Offhand
cures weren't obvious, nor was it even obvious that cures are possible
without major hackery.
Question: when -Qnew is in effect, should calls to __div__ magically
change into calls to __truediv__? See "major hackery" at tail end of
last paragraph <wink>.
The previous checkin to clear __slots__ variables did a little bit of
the work each time it found another base class. All the work is
contiguous, so we might as well do it all at once at the end.
Jack Jansen [Wed, 5 Dec 2001 22:46:23 +0000 (22:46 +0000)]
Link more modules with weak import, and add CarbonAccessors.o to all relevant PowerPC toolbox modules. This, in combination with recent IDE mods, makes the IDE work again under MacOS 8.1.
It was easier than I thought, assuming that no other things contribute
to the instance size besides slots -- a pretty good bet. With a test
suite, no less!
Tim Peters [Wed, 5 Dec 2001 22:30:21 +0000 (22:30 +0000)]
audioop_ratecv(): I left a potentially unsafe multiply unchecked
yesterday -- repair that. Also renamed the silly size_times_nchannels
to bytes_per_frame.
Fred Drake [Wed, 5 Dec 2001 22:10:44 +0000 (22:10 +0000)]
Fix memory leak in the parser module: There were two leaks in
parser_tuple2st() and a failure to propogate an error in
build_node_children() (masking yet another leak, of course!).
This closes SF bug #485133 (confirmed by Insure++).
At the PythonLabs meeting someone mentioned it would make Jim really
happy if one could delete the __dict__ attribute of an instance. I
love to make Jim happy, so here goes...
- New-style objects now support deleting their __dict__. This is for
all intents and purposes equivalent to assigning a brand new empty
dictionary, but saves space if the object is not used further.
Fred Drake [Wed, 5 Dec 2001 15:58:29 +0000 (15:58 +0000)]
Separate the script portion from the library portion; everything that
pertains to the script is now in the if __name__ == "__main__" block.
This is in response to a commenton python-dev from Neal Norwitz.
Tim Peters [Wed, 5 Dec 2001 06:05:07 +0000 (06:05 +0000)]
SF bug 482574: audioop.ratecv crashes.
Bugfix candidate.
A numerically naive computation of output buffer size caused crashes
and spurious MemoryErrors for reasonable arguments.
audioop_ratecv(): Avoid spurious overflow by careful reworking of the
buffer size computations, triggering MemoryError if and only if the
final buffer size can't be represented in a C int (although
PyString_FromStringAndSize may legitimately raise MemoryError even if
it does fit in a C int). All reasonable arguments should work as
intended now, and all unreasonable arguments should be cuaght.
Fred Drake [Wed, 5 Dec 2001 05:46:25 +0000 (05:46 +0000)]
Add a note to the description of the interaction between the softspace
attribute of file objects, the print statement, and other file operations.
This closes SF bug #484857.
Fred Drake [Wed, 5 Dec 2001 05:25:59 +0000 (05:25 +0000)]
Added documentation of the sendall() method, and a note to the send() method
that it does not guarantee that all data is sent.
This closes SF patch #474307.