- New function sys.call_tracing() allows pdb to debug code
recursively.
- pdb has a new command, "debug", which lets you step through
arbitrary code from the debugger's (pdb) prompt.
property_traverse() should also traverse into prop_doc -- there's no
typecheck that guarantees it's a string, and BTW string subclasses
could hide references.
Jason Tishler [Wed, 9 Apr 2003 16:03:57 +0000 (16:03 +0000)]
Patch #709178: remove -static option from cygwinccompiler
Currently, the cygwinccompiler.py compiler handling in
distutils is invoking the cygwin and mingw compilers
with the -static option.
Logically, this means that the linker should choose to
link to static libraries instead of shared/dynamically
linked libraries.
Current win32 binutils expect import libraries to have
a .dll.a suffix and static libraries to have .a suffix.
If -static is passed, it will skip the .dll.a
libraries. This is pain if one has a tree with both
static and dynamic libraries using this naming
convention, and wish to use the dynamic libraries.
The -static option being passed in distutils is to get
around a bug in old versions of binutils where it would
get confused when it found the DLLs themselves.
The decision to use static or shared libraries is site
or package specific, and should be left to the setup
script or to command line options.
Jeremy Hylton [Tue, 8 Apr 2003 21:28:47 +0000 (21:28 +0000)]
Make staticmethods and classmethods participate in GC.
If a class was defined inside a function, used a static or class
method, and used super() inside the method body, it would be caught in
an uncollectable cycle. (Simplified version: The static/class method
object would point to a function object with a closure that referred
to the class.)
Tim Peters [Tue, 8 Apr 2003 19:44:13 +0000 (19:44 +0000)]
New tests identical to boom and boom2, except using new-style classes.
These never failed in 2.3, and the tests confirm it. They still blow up
in the 2.2 branch, despite that all the gc-vs-__del__ fixes from 2.3
have been backported (and this is expected -- 2.2 needs more work than
2.3 needed).
Tim Peters [Mon, 7 Apr 2003 19:21:15 +0000 (19:21 +0000)]
Reworked has_finalizer() to use the new _PyObject_Lookup() instead
of PyObject_HasAttr(); the former promises never to execute
arbitrary Python code. Undid many of the changes recently made to
worm around the worst consequences of that PyObject_HasAttr() could
execute arbitrary Python code.
Compatibility is hard to discuss, because the dangerous cases are
so perverse, and much of this appears to rely on implementation
accidents.
To start with, using hasattr() to check for __del__ wasn't only
dangerous, in some cases it was wrong: if an instance of an old-
style class didn't have "__del__" in its instance dict or in any
base class dict, but a getattr hook said __del__ existed, then
hasattr() said "yes, this object has a __del__". But
instance_dealloc() ignores the possibility of getattr hooks when
looking for a __del__, so while object.__del__ succeeds, no
__del__ method is called when the object is deleted. gc was
therefore incorrect in believing that the object had a finalizer.
The new method doesn't suffer that problem (like instance_dealloc(),
_PyObject_Lookup() doesn't believe __del__ exists in that case), but
does suffer a somewhat opposite-- and even more obscure --oddity:
if an instance of an old-style class doesn't have "__del__" in its
instance dict, and a base class does have "__del__" in its dict,
and the first base class with a "__del__" associates it with a
descriptor (an object with a __get__ method), *and* if that
descriptor raises an exception when __get__ is called, then
(a) the current method believes the instance does have a __del__,
but (b) hasattr() does not believe the instance has a __del__.
While these disagree, I believe the new method is "more correct":
because the descriptor *will* be called when the object is
destructed, it can execute arbitrary Python code at the time the
object is destructed, and that's really what gc means by "has a
finalizer": not specifically a __del__ method, but more generally
the possibility of executing arbitrary Python code at object
destruction time. Code in a descriptor's __get__() executed at
destruction time can be just as problematic as code in a
__del__() executed then.
So I believe the new method is better on all counts.
Bugfix candidate, but it's unclear to me how all this differs in
the 2.2 branch (e.g., new-style and old-style classes already
took different gc paths in 2.3 before this last round of patches,
but don't in the 2.2 branch).
Tim Peters [Sun, 6 Apr 2003 19:41:39 +0000 (19:41 +0000)]
handle_finalizers(): Rewrote to call append_objects() and gc_list_merge()
instead of looping. Smaller and clearer. Faster, too, when we're not
appending to gc.garbage: gc_list_merge() takes constant time, regardless
of the lists' sizes.
append_objects(): Moved up to live with the other list manipulation
utilities.
Tim Peters [Sun, 6 Apr 2003 00:11:39 +0000 (00:11 +0000)]
Reworked move_finalizer_reachable() to create two distinct lists:
externally unreachable objects with finalizers, and externally unreachable
objects without finalizers reachable from such objects. This allows us
to call has_finalizer() at most once per object, and so limit the pain of
nasty getattr hooks. This fixes the failing "boom 2" example Jeremy
posted (a non-printing variant of which is now part of test_gc), via never
triggering the nasty part of its __getattr__ method.
Tim Peters [Sat, 5 Apr 2003 18:40:50 +0000 (18:40 +0000)]
move_finalizers(): Rewrote. It's not necessary for this routine
to special-case classic classes, or to worry about refcounts;
has_finalizer() deleted the current object iff the first entry in
the unreachable list has changed. I don't believe it was correct
to check for ob_refcnt == 1, either: the dealloc routine would get
called by Py_DECREF then, but there's nothing to stop the dealloc
routine from ressurecting the object, and then gc would remain at
the head of the unreachable list despite that its refcount temporarily
fell to 0 (and that would lead to an infinite loop in move_finalizers()).
I'm still worried about has_finalizer() resurrecting other objects
in the unreachable list: what's to stop them from getting collected?
Tim Peters [Sat, 5 Apr 2003 17:35:54 +0000 (17:35 +0000)]
New comments. Rewrote has_finalizer() as a sequence of ifs instead of
squashed-together conditional operators; makes it much easier to step
thru in the debugger, and to set a breakpoint on the only dangerous
path.
Tim Peters [Sat, 5 Apr 2003 17:15:44 +0000 (17:15 +0000)]
Fixed new seemingly random segfaults, by moving the initialization of
delstr from initgc() into collect(). initgc() isn't called unless the
user explicitly imports gc, so can be used only for initialization of
user-visible module features; delstr needs to be initialized for proper
internal operation, whether or not gc is explicitly imported.
Bugfix candidate? I don't know whether the new bug was backported to
2.2 already.
Use fcntl() to put the audio device *back* into blocking mode after
opening it in non-blocking mode. Both Guido and David Hammerton have
reported that this fixes their problems with ossaudiodev -- hooray!
Walter Dörwald [Wed, 2 Apr 2003 16:37:24 +0000 (16:37 +0000)]
Change formatchar(), so that u"%c" % 0xffffffff now raises
an OverflowError instead of a TypeError to be consistent
with "%c" % 256. See SF patch #710127.
Jack Jansen [Tue, 1 Apr 2003 22:27:18 +0000 (22:27 +0000)]
Sigh... The get() and set() commands are not declared in the aete for
the Standard_Suite, but various other suites do expect it (the Finder
implements get() without declaring it itself). It is probably another
case of OSA magic. Adding them to the global base class.
Jack Jansen [Tue, 1 Apr 2003 22:01:58 +0000 (22:01 +0000)]
Properties (like enums) are not in the global namespace but only valid
within a certain context. Give them an _Prop_ prefix, so they don't
accidentally obscure an element from another suite (as happened with
the Finder). Comparisons I'm not sure about, so I left them as global
names.
Also got rid of the lists if declarations, they serve no useful purpose.
Jack Jansen [Tue, 1 Apr 2003 13:32:17 +0000 (13:32 +0000)]
- All messages are now dependent on the --verbose option.
- Added a --dump option that doesn't generate the module but dumps
the pretty-printed aete resource(s) on stdout.
Jack Jansen [Mon, 31 Mar 2003 13:32:59 +0000 (13:32 +0000)]
Subclasses of ObjectSpecifier can now be packed and unpacked. This allows
you to say something like "talker.count(want=Address_Book.people)" in
stead of having to manually create the aetypes.Type(Address_Book.people.want)
OSA type.
Jack Jansen [Mon, 31 Mar 2003 13:29:32 +0000 (13:29 +0000)]
In TalkTo.send(), check that we have access to the window manager,
and initialize the event loop (if not done previously) to work around
a bug (IMHO) in MacOSX 10.2.
Jack Jansen [Sun, 30 Mar 2003 22:39:39 +0000 (22:39 +0000)]
Classes have to be sorted by code, not name, and synonyms have to
be sorted after the main name, otherwise filling of properties and
elements messes up.
Skip Montanaro [Sun, 30 Mar 2003 04:54:24 +0000 (04:54 +0000)]
The socket module now always uses the _socketobject wrapper class, even on
platforms which have dup(2). The makefile() method is built directly on top
of the socket without duplicating the file descriptor, allowing timeouts to
work properly. Includes a new test case (urllibnet) which requires the
network resource.
Jack Jansen [Sat, 29 Mar 2003 22:54:00 +0000 (22:54 +0000)]
- Added an is_scriptable method to test applications for having
a scripting dictionary. Made up by me, not guaranteed to be correct
(and, indeed, Internet Explorer does not seem to play by the book).
- Added the interactive main program as a separate routine, so it
can be called from the IDE later. Also made it less interactive by
default: only the input app and output package folder are asked for.
Jack Jansen [Sat, 29 Mar 2003 22:07:47 +0000 (22:07 +0000)]
The test for setpgrp having two arguments didn't actually test anything.
For reasons unknown this suddenly started to matter (since Martin's 1.396
checkin? But why?), at least on MacOSX. Added a real test similar to the
getpgrp argument test.
Neal Norwitz [Sat, 29 Mar 2003 22:01:17 +0000 (22:01 +0000)]
Move Mac/Windows specific expected skips from each platform list
to the ExpectedSkips class. Add test_scriptpackages to Mac only list.
Add test_unicode_file to Windows only list.
Jack Jansen [Sat, 29 Mar 2003 00:13:17 +0000 (00:13 +0000)]
Regenerated with the new way to get terminology (through AppleEvents),
which sometimes seems to result in different terminology. It does
seem to be mostly compatible, though.
Jack Jansen [Sat, 29 Mar 2003 00:11:32 +0000 (00:11 +0000)]
- Prefer using events (in stead of poking around in resource files) to
get terminology resources. Unfortunately there doesn't seem to be any
application I can ask for the basic StdSuites terminology (?).
- Prefer OSX-native versions of applications over OS9 versions.