]> granicus.if.org Git - python/log
python
23 years agoUpdate the description of getboolean() to reflect the changes made by
Fred Drake [Mon, 8 Oct 2001 16:03:20 +0000 (16:03 +0000)]
Update the description of getboolean() to reflect the changes made by
SF patch #467580.

23 years agoMods by Alexandre Parenteau to allow embedding programs to disable the MacPython...
Jack Jansen [Mon, 8 Oct 2001 15:35:38 +0000 (15:35 +0000)]
Mods by Alexandre Parenteau to allow embedding programs to disable the MacPython console window completely, and optionally route console output (and input) to routines provided by the embedding app.

Things don't fully work yet, but at least it doesn't break anything.

23 years agoBrought up to date with the current state of affairs.
Jack Jansen [Mon, 8 Oct 2001 15:32:17 +0000 (15:32 +0000)]
Brought up to date with the current state of affairs.

23 years agoKeep track of a type's subclasses (subtypes), in tp_subclasses, which
Guido van Rossum [Mon, 8 Oct 2001 15:18:27 +0000 (15:18 +0000)]
Keep track of a type's subclasses (subtypes), in tp_subclasses, which
is a list of weak references to types (new-style classes).  Make this
accessible to Python as the function __subclasses__ which returns a
list of types -- we don't want Python programmers to be able to
manipulate the raw list.

In order to make this possible, I also had to add weak reference
support to type objects.

This will eventually be used together with a trap on attribute
assignment for dynamic classes for a major speed-up without losing the
dynamic properties of types: when a __foo__ method is added to a
class, the class and all its subclasses will get an appropriate tp_foo
slot function.

23 years agoMac OS X build instructions talked about --without-toolbox-glue, but
Jack Jansen [Mon, 8 Oct 2001 13:21:15 +0000 (13:21 +0000)]
Mac OS X build instructions talked about --without-toolbox-glue, but
the configure option is really called --disable-toolbox-glue.

23 years agoDo not add -shared to linker_so. Any necessary options should already be
Martin v. Löwis [Mon, 8 Oct 2001 13:18:37 +0000 (13:18 +0000)]
Do not add -shared to linker_so. Any necessary options should already be
in LDSHARED.

23 years agoProvide explicit program when trying to link pthread_create.
Martin v. Löwis [Mon, 8 Oct 2001 13:17:28 +0000 (13:17 +0000)]
Provide explicit program when trying to link pthread_create.
Contributed by Albert Chin in discussion of bug #210665.

23 years agoAdded declarations for PyMac_SetConsoleHandler, PyMan_DUmmyReadHandler
Jack Jansen [Mon, 8 Oct 2001 13:16:39 +0000 (13:16 +0000)]
Added declarations for PyMac_SetConsoleHandler, PyMan_DUmmyReadHandler
and PyMac_DummyWriteHandler.

23 years agoAdded weakrefobject.c and regenerated .exp files.
Jack Jansen [Mon, 8 Oct 2001 13:01:05 +0000 (13:01 +0000)]
Added weakrefobject.c and regenerated .exp files.

23 years agoPut the deprecated .ignore() method back where it was.
Tim Peters [Mon, 8 Oct 2001 06:28:18 +0000 (06:28 +0000)]
Put the deprecated .ignore() method back where it was.

23 years agoWidespread random code cleanup.
Tim Peters [Mon, 8 Oct 2001 06:13:19 +0000 (06:13 +0000)]
Widespread random code cleanup.
Most of this code was old enough to vote.  Examples of cleanups:

+ Backslashes were used for line continuation even inside unclosed
  bracket structures, from back in the days that was still needed.

+ There was no use of % formats, and e.g. the old fpformat module was
  still used to format floats "by hand" in conjunction with rjust().

+ There was even use of a do-nothing .ignore() method to tack on to the
  end of a chain of method calls, else way back when Python would print
  the non-None result (as it does now in an interactive session -- it
  *used* to do that in batch mode too).

+ Perhaps controversial (although I can't imagine why for real <wink>),
  used augmented assignment where helpful.  Stuff like

      self.total_calls = self.total_calls + other.total_calls

  is just plain harder to follow than

      self.total_calls += other.total_calls

23 years agoImplement isinstance(x, (A, B, ...)). Note that we only allow tuples,
Guido van Rossum [Sun, 7 Oct 2001 20:54:12 +0000 (20:54 +0000)]
Implement isinstance(x, (A, B, ...)).  Note that we only allow tuples,
not other sequences (then we'd have to except strings, and we'd still
be susceptible to recursive attacks).

23 years agomerged port binding error message patch
Steven M. Gava [Sun, 7 Oct 2001 11:44:49 +0000 (11:44 +0000)]
merged port binding error message patch

23 years agomerged win spawn patch
Steven M. Gava [Sun, 7 Oct 2001 11:26:48 +0000 (11:26 +0000)]
merged win spawn patch

23 years agomerged status bar packing patch
Steven M. Gava [Sun, 7 Oct 2001 11:10:44 +0000 (11:10 +0000)]
merged status bar packing patch

23 years agoOnly close sockets if they have been created. Reported by Blake Winton.
Martin v. Löwis [Sun, 7 Oct 2001 08:53:32 +0000 (08:53 +0000)]
Only close sockets if they have been created. Reported by Blake Winton.

23 years agoTypo repair in comment.
Tim Peters [Sun, 7 Oct 2001 08:49:02 +0000 (08:49 +0000)]
Typo repair in comment.

23 years agoSupport OpenUNIX like UnixWare.
Martin v. Löwis [Sun, 7 Oct 2001 08:39:18 +0000 (08:39 +0000)]
Support OpenUNIX like UnixWare.

23 years agoGuido points out that the comments for self.cur[2] were subtly but
Tim Peters [Sun, 7 Oct 2001 08:35:44 +0000 (08:35 +0000)]
Guido points out that the comments for self.cur[2] were subtly but
seriously wrong.  This started out by just fixing the docs, but then it
occurred to me that the doc confusion propagated into misleading vrbl names
too, so I also renamed those to match reality.  As a result, INO the time
computations are much easier to understand now (within the limitations of
vast quantities of 3-character names <wink>).

23 years agoUse AC_TRY_RUN for checking for -Kpthread.
Martin v. Löwis [Sun, 7 Oct 2001 08:14:41 +0000 (08:14 +0000)]
Use AC_TRY_RUN for checking for -Kpthread.

23 years agoAt Guido's request, changed the code that's conceptually asserting stuff
Tim Peters [Sun, 7 Oct 2001 04:30:53 +0000 (04:30 +0000)]
At Guido's request, changed the code that's conceptually asserting stuff
to use assert stmts (was raising unexpected kinds of exceptions).

23 years agoRepair some longstanding comment errors:
Tim Peters [Sun, 7 Oct 2001 04:02:36 +0000 (04:02 +0000)]
Repair some longstanding comment errors:

+ The last index in the timing tuple is 4, not 5 (noted by Guido).

+ The poorly named trace_dispatch_i works with float return values too.

23 years agoGuido suggests, and I agree, to insist that SIZEOF_VOID_P be a power of 2.
Tim Peters [Sun, 7 Oct 2001 03:54:51 +0000 (03:54 +0000)]
Guido suggests, and I agree, to insist that SIZEOF_VOID_P be a power of 2.
This simplifies the rounding in _PyObject_VAR_SIZE, allows to restore the
pre-rounding calling sequence, and allows some nice little simplifications
in its callers.  I'm still making it return a size_t, though.

23 years agoRemove code and docs for the OldProfile and HotProfile classes: code
Tim Peters [Sun, 7 Oct 2001 03:12:08 +0000 (03:12 +0000)]
Remove code and docs for the OldProfile and HotProfile classes:  code
hasn't worked in years, docs were wrong, and they aren't interesting
anymore regardless.

23 years ago_PyObject_VAR_SIZE: always round up to a multiple-of-pointer-size value.
Tim Peters [Sat, 6 Oct 2001 21:27:34 +0000 (21:27 +0000)]
_PyObject_VAR_SIZE:  always round up to a multiple-of-pointer-size value.
As Guido suggested, this makes the new subclassing code substantially
simpler.  But the mechanics of doing it w/ C macro semantics are a mess,
and _PyObject_VAR_SIZE has a new calling sequence now.

Question:  The PyObject_NEW_VAR macro appears to be part of the public API.
Regardless of what it expands to, the notion that it has to round up the
memory it allocates is new, and extensions containing the old
PyObject_NEW_VAR macro expansion (which was embedded in the
PyObject_NEW_VAR expansion) won't do this rounding.  But the rounding
isn't actually *needed* except for new-style instances with dict pointers
after a variable-length blob of embedded data.  So my guess is that we do
not need to bump the API version for this (as the rounding isn't needed
for anything an extension can do unless it's recompiled anyway).  What's
your guess?

23 years agoRepaired the debug Windows deaths in test_descr, by allocating enough
Tim Peters [Sat, 6 Oct 2001 19:04:01 +0000 (19:04 +0000)]
Repaired the debug Windows deaths in test_descr, by allocating enough
pad memory to properly align the __dict__ pointer in all cases.

gcmodule.c/objimpl.h, _PyObject_GC_Malloc:
+ Added a "padding" argument so that this flavor of malloc can allocate
  enough bytes for alignment padding (it can't know this is needed, but
  its callers do).

typeobject.c, PyType_GenericAlloc:
+ Allocated enough bytes to align the __dict__ pointer.
+ Sped and simplified the round-up-to-PTRSIZE logic.
+ Added blank lines so I could parse the if/else blocks <0.7 wink>.

23 years ago_PyObject_GetDictPtr():
Tim Peters [Sat, 6 Oct 2001 17:45:17 +0000 (17:45 +0000)]
_PyObject_GetDictPtr():
+ Use the _PyObject_VAR_SIZE macro to compute object size.
+ Break the computation into lines convenient for debugger inspection.
+ Speed the round-up-to-pointer-size computation.

23 years ago_PyObject_GC_Malloc(): split a complicated line in two. As is, there was
Tim Peters [Sat, 6 Oct 2001 08:03:20 +0000 (08:03 +0000)]
_PyObject_GC_Malloc():  split a complicated line in two.  As is, there was
no way to talk the debugger into showing me how many bytes were being
allocated.

23 years agoUpdate the documentation to reflect the changes to ReferenceError.
Fred Drake [Sat, 6 Oct 2001 06:10:54 +0000 (06:10 +0000)]
Update the documentation to reflect the changes to ReferenceError.

23 years agoThe fix to profile semantics broke the miserable but advertised way to
Tim Peters [Fri, 5 Oct 2001 23:15:10 +0000 (23:15 +0000)]
The fix to profile semantics broke the miserable but advertised way to
derive Profile subclasses.  This patch repairs that, restoring
negative tuple indices.  Yuck?  You bet.

23 years agoTeach Windows how to build the new weakref module.
Tim Peters [Fri, 5 Oct 2001 22:14:45 +0000 (22:14 +0000)]
Teach Windows how to build the new weakref module.

23 years agoRemove bogus declaration.
Fred Drake [Fri, 5 Oct 2001 22:06:45 +0000 (22:06 +0000)]
Remove bogus declaration.

23 years agoAdd documentation for the public API for weak reference objects.
Fred Drake [Fri, 5 Oct 2001 22:03:58 +0000 (22:03 +0000)]
Add documentation for the public API for weak reference objects.

23 years agoAdjust the _weakref module to use the public API for the weak reference
Fred Drake [Fri, 5 Oct 2001 22:00:24 +0000 (22:00 +0000)]
Adjust the _weakref module to use the public API for the weak reference
objects.  This is now simply a shim to give weakref.py access to the
underlying implementation.

23 years agoPyObject_ClearWeakRefs() is now a real function instead of a function pointer;
Fred Drake [Fri, 5 Oct 2001 21:58:11 +0000 (21:58 +0000)]
PyObject_ClearWeakRefs() is now a real function instead of a function pointer;
the implementation is in Objects/weakrefobject.c.

23 years agoAdd dependencies for the weakref object.
Fred Drake [Fri, 5 Oct 2001 21:56:02 +0000 (21:56 +0000)]
Add dependencies for the weakref object.

23 years agoInclude the weakref object interface.
Fred Drake [Fri, 5 Oct 2001 21:55:19 +0000 (21:55 +0000)]
Include the weakref object interface.

23 years agoReferenceError is now built-in, so pick it up from the right place.
Fred Drake [Fri, 5 Oct 2001 21:54:09 +0000 (21:54 +0000)]
ReferenceError is now built-in, so pick it up from the right place.
It still needs to be here to preserve the API.

23 years agoThe weak reference implementation, separated from the weakref module.
Fred Drake [Fri, 5 Oct 2001 21:52:26 +0000 (21:52 +0000)]
The weak reference implementation, separated from the weakref module.

23 years agoweakref.ReferenceError becomes a built-in exception now that weak ref objects
Fred Drake [Fri, 5 Oct 2001 21:50:08 +0000 (21:50 +0000)]
weakref.ReferenceError becomes a built-in exception now that weak ref objects
are moving into the core; with these changes, it will be possible for the
exception to be raised without the weakref module ever being imported.

23 years agoMartijn Pieters convinced me that when readline() strips the trailing
Guido van Rossum [Fri, 5 Oct 2001 21:22:21 +0000 (21:22 +0000)]
Martijn Pieters convinced me that when readline() strips the trailing
newline from a multifile part, it should also strip a trailing \r\n.

23 years agoEnable GC for new-style instances. This touches lots of files, since
Guido van Rossum [Fri, 5 Oct 2001 20:51:39 +0000 (20:51 +0000)]
Enable GC for new-style instances.  This touches lots of files, since
many types were subclassable but had a xxx_dealloc function that
called PyObject_DEL(self) directly instead of deferring to
self->ob_type->tp_free(self).  It is permissible to set tp_free in the
type object directly to _PyObject_Del, for non-GC types, or to
_PyObject_GC_Del, for GC types.  Still, PyObject_DEL was a tad faster,
so I'm fearing that our pystone rating is going down again.  I'm not
sure if doing something like

void xxx_dealloc(PyObject *self)
{
if (PyXxxCheckExact(self))
PyObject_DEL(self);
else
self->ob_type->tp_free(self);
}

is any faster than always calling the else branch, so I haven't
attempted that -- however those types whose own dealloc is fancier
(int, float, unicode) do use this pattern.

23 years agoWith Andrew's blessing: distutils version number is now 1.0.3.
Thomas Heller [Fri, 5 Oct 2001 20:43:09 +0000 (20:43 +0000)]
With Andrew's blessing: distutils version number is now 1.0.3.

23 years agoIntroduced the oddly-missing PyList_CheckExact(), and used it to replace
Tim Peters [Fri, 5 Oct 2001 20:41:38 +0000 (20:41 +0000)]
Introduced the oddly-missing PyList_CheckExact(), and used it to replace
a hard-coded type check.

23 years agoExplicitely list the metadata attributes to show
Thomas Heller [Fri, 5 Oct 2001 20:40:48 +0000 (20:40 +0000)]
Explicitely list the metadata attributes to show
in the gui.
Updated to include the new exe-file.

23 years agoGet rid of unique local ISSTRICTINT macro in favor of std PyInt_CheckExact.
Tim Peters [Fri, 5 Oct 2001 20:21:03 +0000 (20:21 +0000)]
Get rid of unique local ISSTRICTINT macro in favor of std PyInt_CheckExact.

23 years agoA regexp example was rendered as
Tim Peters [Fri, 5 Oct 2001 20:06:47 +0000 (20:06 +0000)]
A regexp example was rendered as
    foo\d
when it was clearly intended to render as
    foo$
Fred, is this a right way to fix it?  If not, the earlier place in the
same paragraph that does render as
    foo$
is also wrong.

23 years agoSMTPServer.__init__(): Print the start information on the DEBUGSTREAM
Barry Warsaw [Fri, 5 Oct 2001 17:10:31 +0000 (17:10 +0000)]
SMTPServer.__init__(): Print the start information on the DEBUGSTREAM
so that it can be suppressed.

23 years agoRemove false statement about running make in the Modules directory.
Guido van Rossum [Fri, 5 Oct 2001 17:04:42 +0000 (17:04 +0000)]
Remove false statement about running make in the Modules directory.

23 years agoRemove some long-unsupported Mac OS modules.
Fred Drake [Fri, 5 Oct 2001 16:49:31 +0000 (16:49 +0000)]
Remove some long-unsupported Mac OS modules.
This closes SF patch #460737.

23 years agoFrankly, I'd like my "L." as well!
Fred Drake [Fri, 5 Oct 2001 14:12:23 +0000 (14:12 +0000)]
Frankly, I'd like my "L." as well!

23 years agoAnother contributor.
Guido van Rossum [Fri, 5 Oct 2001 14:06:27 +0000 (14:06 +0000)]
Another contributor.
Give Fred his Jr.

23 years agoFix typo in docstring
Andrew M. Kuchling [Fri, 5 Oct 2001 12:24:15 +0000 (12:24 +0000)]
Fix typo in docstring

23 years agoDocument addition of chroot.
Martin v. Löwis [Thu, 4 Oct 2001 22:46:41 +0000 (22:46 +0000)]
Document addition of chroot.

23 years agoAdd chroot call. Implements feature #459267.
Martin v. Löwis [Thu, 4 Oct 2001 22:44:26 +0000 (22:44 +0000)]
Add chroot call. Implements feature #459267.

23 years agoUpdate a couple of old addresses that point to CNRI.
Fred Drake [Thu, 4 Oct 2001 20:40:07 +0000 (20:40 +0000)]
Update a couple of old addresses that point to CNRI.

23 years agoNon-failing test for SF bug #467059.
Fred Drake [Thu, 4 Oct 2001 20:05:10 +0000 (20:05 +0000)]
Non-failing test for SF bug #467059.

23 years agoApply modified SF patch 467580: ConfigParser.getboolean(): FALSE, TRUE.
Guido van Rossum [Thu, 4 Oct 2001 19:58:46 +0000 (19:58 +0000)]
Apply modified SF patch 467580: ConfigParser.getboolean(): FALSE, TRUE.

    This patch allows ConfigParser.getboolean() to interpret TRUE,
    FALSE, YES, NO, ON and OFF instead just '0' and '1'.

    While just allowing '0' and '1' sounds more correct users often
    demand to use more descriptive directives in configuration
    files. Instead of forcing every programmer do brew his own
    solution a system should include the batteries for this.

[My modification to the patch is a slight rewording of the docstring
and use of lowercase instead of uppercase templates.  The code is
still case sensitive. GvR.]

23 years agorun_suite(): If testclass is not available, provide an even more general
Fred Drake [Thu, 4 Oct 2001 19:46:07 +0000 (19:46 +0000)]
run_suite():  If testclass is not available, provide an even more general
               error message.
run_unittest():  Provide the testclass to run_suite() so it can construct
                 the error message.
This closes SF bug #467763.

23 years agoMake new classes dynamic by default.
Guido van Rossum [Thu, 4 Oct 2001 19:46:06 +0000 (19:46 +0000)]
Make new classes dynamic by default.

23 years agoChanged the reindenter to strip only trailing spaces and tabs from lines,
Tim Peters [Thu, 4 Oct 2001 19:44:10 +0000 (19:44 +0000)]
Changed the reindenter to strip only trailing spaces and tabs from lines,
not other control characters string.rstrip() got rid of.  This caters to
the \f thingies Barry likes putting in Python source files.

23 years agoFix bug in profiler modifications detected only in debug builds.
Fred Drake [Thu, 4 Oct 2001 19:26:43 +0000 (19:26 +0000)]
Fix bug in profiler modifications detected only in debug builds.
The new profiler event stream includes a "return" event even when an
exception is being propogated, but the machinery that called the profile
hook did not save & restore the exception.  In debug mode, the exception
was detected during the execution of the profile callback, which did not
have the proper internal flags set for the exception.  Saving & restoring
the exception state solves the problem.

23 years agoTestIterators: Tim Peters suggests a more succinct spelling of
Barry Warsaw [Thu, 4 Oct 2001 18:18:37 +0000 (18:18 +0000)]
TestIterators: Tim Peters suggests a more succinct spelling of
"listify an iterator".

23 years agoMore test data for test_email.py
Barry Warsaw [Thu, 4 Oct 2001 17:59:42 +0000 (17:59 +0000)]
More test data for test_email.py

23 years agotest_header_splitter(), test_body_line_iterator(): Move the test data
Barry Warsaw [Thu, 4 Oct 2001 17:58:50 +0000 (17:58 +0000)]
test_header_splitter(), test_body_line_iterator(): Move the test data
into tests/data/msg_*.txt files.

23 years agoGive me back my page breaks.
Barry Warsaw [Thu, 4 Oct 2001 17:05:11 +0000 (17:05 +0000)]
Give me back my page breaks.

23 years agoAdd note about profiling.
Guido van Rossum [Thu, 4 Oct 2001 17:00:07 +0000 (17:00 +0000)]
Add note about profiling.

23 years agoScript arguments localhost:localport and remotehost:remoteport are now
Barry Warsaw [Thu, 4 Oct 2001 16:27:04 +0000 (16:27 +0000)]
Script arguments localhost:localport and remotehost:remoteport are now
optional, and default to `localhost' and ports 8025 and 25
respectively.

SMTPChannel.__init__(): Calculate __fqdn using socket.getfqdn()
instead of gethostby*() and friends.  This allows us to run this
script even if we don't have access to dns (assuming the localhost is
configured properly).

Also, restore my precious page breaks.  Hands off, oh Whitespace
Normalizer!

23 years agoAdd various typecasts (back and forth from char * to unsigned char *)
Greg Ward [Thu, 4 Oct 2001 14:54:53 +0000 (14:54 +0000)]
Add various typecasts (back and forth from char * to unsigned char *)
to make the SGI C compiler happier (bug #445960).

23 years agoRemove a couple of unused local variables (bug #445960, compiler warnings
Greg Ward [Thu, 4 Oct 2001 14:52:06 +0000 (14:52 +0000)]
Remove a couple of unused local variables (bug #445960, compiler warnings
on IRIX 6.5).

23 years agoUpdated to reflect the rationalized profiler event reporting.
Fred Drake [Thu, 4 Oct 2001 14:49:46 +0000 (14:49 +0000)]
Updated to reflect the rationalized profiler event reporting.

23 years agoRationalize the events passed to the profiler (no changes for the tracer).
Fred Drake [Thu, 4 Oct 2001 14:48:42 +0000 (14:48 +0000)]
Rationalize the events passed to the profiler (no changes for the tracer).

The profiler does not need to know anything about the exception state,
so we no longer call it when an exception is raised.  We do, however,
make sure we *always* call the profiler when we exit a frame.  This
ensures that timing events are more easily isolated by a profiler and
finally clauses that do a lot of work don't have their time
mis-allocated.

When an exception is propogated out of the frame, the C callback for
the profiler now receives a PyTrace_RETURN event with an arg of NULL;
the Python-level profile hook function will see a 'return' event with
an arg of None.  This means that from Python it is impossible for the
profiler to determine if the frame exited with an exception or if it
returned None, but this doesn't matter for profiling.  A C-based
profiler could tell the difference, but this doesn't seem important.

ceval.c:eval_frame():  Simplify the code in two places so that the
                       profiler is called for every exit from a frame
                       and not for exceptions.

sysmodule.c:profile_trampoline():  Make sure we don't expose Python
                                   code to NULL; use None instead.

23 years agoAdd note about profile fix.
Guido van Rossum [Thu, 4 Oct 2001 10:19:00 +0000 (10:19 +0000)]
Add note about profile fix.

23 years agoMake clear that tuple() accepts the same kind of arguments as list().
Tim Peters [Thu, 4 Oct 2001 06:53:20 +0000 (06:53 +0000)]
Make clear that tuple() accepts the same kind of arguments as list().

23 years agoAdded a little type/class NEWS.
Tim Peters [Thu, 4 Oct 2001 06:43:12 +0000 (06:43 +0000)]
Added a little type/class NEWS.

23 years agoThis test relied on hard tab characters, so failed after whitespace
Tim Peters [Thu, 4 Oct 2001 06:26:17 +0000 (06:26 +0000)]
This test relied on hard tab characters, so failed after whitespace
normalization.  Now uses \t in strings instead of hard tabs.

23 years agoclass_docstrings(): The new-style class tests should use new-style
Tim Peters [Thu, 4 Oct 2001 05:48:13 +0000 (05:48 +0000)]
class_docstrings():  The new-style class tests should use new-style
classes (sheesh!).

23 years agotype_new(): cast PyObject_MALLOC's result to char*, for clarity.
Tim Peters [Thu, 4 Oct 2001 05:43:02 +0000 (05:43 +0000)]
type_new():  cast PyObject_MALLOC's result to char*, for clarity.

23 years agoWhitespace normalization.
Tim Peters [Thu, 4 Oct 2001 05:36:56 +0000 (05:36 +0000)]
Whitespace normalization.

23 years agoSF bug [#467331] ClassType.__doc__ always None.
Tim Peters [Thu, 4 Oct 2001 05:27:00 +0000 (05:27 +0000)]
SF bug [#467331] ClassType.__doc__ always None.
For a dynamically constructed type object, fill in the tp_doc slot with
a copy of the argument dict's "__doc__" value, provided the latter exists
and is a string.
NOTE:  I don't know what to do if it's a Unicode string, so in that case
tp_doc is left NULL (which shows up as Py_None if you do Class.__doc__).
Note that tp_doc holds a char*, not a general PyObject*.

23 years agoHopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum [Thu, 4 Oct 2001 00:58:24 +0000 (00:58 +0000)]
Hopefully fix the profiler right.  Add a test suite that checks that
it deals correctly with some anomalous cases; according to this test
suite I've fixed it right.

The anomalous cases had to do with 'exception' events: these aren't
generated when they would be most helpful, and the profiler has to
work hard to recover the right information.  The problems occur when C
code (such as hasattr(), which is used as the example here) calls back
into Python code and clears an exception raised by that Python code.
Consider this example:

    def foo():
        hasattr(obj, "bar")

Where obj is an instance from a class like this:

    class C:
        def __getattr__(self, name):
            raise AttributeError

The profiler sees the following sequence of events:

    call (foo)
    call (__getattr__)
    exception (in __getattr__)
    return (from foo)

Previously, the profiler would assume the return event returned from
__getattr__. An if statement checking for this condition and raising
an exception was commented out...  This version does the right thing.

23 years agoExpand the documentation of the low-level tracing/profiling interface.
Fred Drake [Wed, 3 Oct 2001 21:52:51 +0000 (21:52 +0000)]
Expand the documentation of the low-level tracing/profiling interface.
This reflects what is currently in CVS, which may change before 2.2 is final.

23 years agoAdd some more test cases to be sure we do the right thing in various cases.
Fred Drake [Wed, 3 Oct 2001 21:15:32 +0000 (21:15 +0000)]
Add some more test cases to be sure we do the right thing in various cases.

23 years agoUndo previous patch; it did not quite work out.
Fred Drake [Wed, 3 Oct 2001 21:12:32 +0000 (21:12 +0000)]
Undo previous patch; it did not quite work out.

23 years agoFix a spelling error that has been bugging me for longer than I care to admit.
Greg Ward [Wed, 3 Oct 2001 19:59:30 +0000 (19:59 +0000)]
Fix a spelling error that has been bugging me for longer than I care to admit.

23 years agoSet .addr in a few more places (patch approved by Sam Rushing)
Andrew M. Kuchling [Wed, 3 Oct 2001 17:07:25 +0000 (17:07 +0000)]
Set .addr in a few more places (patch approved by Sam Rushing)

23 years agodynamics(): add a dummy __getattr__ method to the C class so that the
Guido van Rossum [Wed, 3 Oct 2001 13:59:54 +0000 (13:59 +0000)]
dynamics(): add a dummy __getattr__ method to the C class so that the
test for modifying __getattr__ works, now that slot_tp_getattr_hook
zaps the slot if there's no hook.  Added an XXX comment with a ref
back to slot_tp_getattr_hook.

23 years agotypeobject.c, slot_tp_gettattr_hook(): fix the speedup hack -- the
Guido van Rossum [Wed, 3 Oct 2001 13:58:35 +0000 (13:58 +0000)]
typeobject.c, slot_tp_gettattr_hook(): fix the speedup hack -- the
test for getattribute==NULL was bogus because it always found
object.__getattribute__.  Pick it apart using the trick we learned
from slot_sq_item, and if it's just a wrapper around
PyObject_GenericGetAttr, zap it.  Also added a long XXX comment
explaining the consequences.

23 years agoremove empty __del__ method from BaseRequestHandler to avoid cyclic garbage
Skip Montanaro [Wed, 3 Oct 2001 12:21:23 +0000 (12:21 +0000)]
remove empty __del__ method from BaseRequestHandler to avoid cyclic garbage
loss for no reason.

23 years ago*EXPERIMENTAL* speedup of slot_sq_item. This sped up the following
Guido van Rossum [Wed, 3 Oct 2001 12:09:30 +0000 (12:09 +0000)]
*EXPERIMENTAL* speedup of slot_sq_item.  This sped up the following
test dramatically:

    class T(tuple): __dynamic__ = 1
    t = T(range(1000))
    for i in range(1000): tt = tuple(t)

The speedup was about 5x compared to the previous state of CVS (1.7
vs. 8.8, in arbitrary time units).  But it's still more than twice as
slow as as the same test with __dynamic__ = 0 (0.8).

I'm not sure that I really want to go through the trouble of this kind
of speedup for every slot.  Even doing it just for the most popular
slots will be a major effort (the new slot_sq_item is 40+ lines, while
the old one was one line with a powerful macro -- unfortunately the
speedup comes from expanding the macro and doing things in a way
specific to the slot signature).

An alternative that I'm currently considering is sketched in PLAN.txt:
trap setattr on type objects.  But this will require keeping track of
all derived types using weak references.

23 years agoMade the classmethod docstring test a bit less trivial.
Tim Peters [Wed, 3 Oct 2001 04:15:28 +0000 (04:15 +0000)]
Made the classmethod docstring test a bit less trivial.

23 years agoSF bug [#467336] doctest failures w/ new-style classes.
Tim Peters [Wed, 3 Oct 2001 04:08:26 +0000 (04:08 +0000)]
SF bug [#467336] doctest failures w/ new-style classes.
Taught doctest about static methods, class methods, and property docstrings
in new-style classes.  As for inspect.py/pydoc.py before it, the new stuff
needed didn't really fit into the old architecture (but was less of a
strain to force-fit here).
New-style class docstrings still aren't found, but that's the subject
of a different bug and I want to fix that right instead of hacking around
it in doctest.

23 years agoMark treatment of binary operators for __rop__-before-__op__ as done.
Guido van Rossum [Wed, 3 Oct 2001 03:00:56 +0000 (03:00 +0000)]
Mark treatment of binary operators for __rop__-before-__op__ as done.
Add more detail about the speed optimizations needed for __dynamic__.
The weak reference solution becomes more attractive...

23 years agocall_method(), call_maybe(): fix a performance bug: the argument
Guido van Rossum [Wed, 3 Oct 2001 00:50:18 +0000 (00:50 +0000)]
call_method(), call_maybe(): fix a performance bug: the argument
pointing to a static variable to hold the object form of the string
was never used, causing endless calls to PyString_InternFromString().
One particular test (with lots of __getitem__ calls) became a third
faster with this!

23 years agoNote removal of Demo/dns, point to PyDNS.
Guido van Rossum [Tue, 2 Oct 2001 23:15:37 +0000 (23:15 +0000)]
Note removal of Demo/dns, point to PyDNS.

23 years agoRemoved Demo/dns -- see sf.net/projects/pydns/ instead.
Guido van Rossum [Tue, 2 Oct 2001 23:13:16 +0000 (23:13 +0000)]
Removed Demo/dns -- see sf.net/projects/pydns/ instead.

23 years agoSF patch [#466616] Exclude imported items from doctest.
Tim Peters [Tue, 2 Oct 2001 22:47:08 +0000 (22:47 +0000)]
SF patch [#466616] Exclude imported items from doctest.
Another installment; the new functionality wasn't actually enabled in
normal use, only in the strained use checked by the test case.

23 years agoSF bug [#467265] Compile errors on SuSe Linux on IBM/s390.
Tim Peters [Tue, 2 Oct 2001 21:32:07 +0000 (21:32 +0000)]
SF bug [#467265] Compile errors on SuSe Linux on IBM/s390.
Unknown whether this fixes it.
- stringobject.c, PyString_FromFormatV:  don't assume that va_list is of
  a type that can be copied via an initializer.
- errors.c, PyErr_Format:  add a va_end() to balance the va_start().

23 years agoAdd Garbage Collection support to new-style classes (not yet to their
Guido van Rossum [Tue, 2 Oct 2001 21:24:57 +0000 (21:24 +0000)]
Add Garbage Collection support to new-style classes (not yet to their
instances).

Also added GC support to various auxiliary types: super, property,
descriptors, wrappers, dictproxy.  (Only type objects have a tp_clear
field; the other types are.)

One change was necessary to the GC infrastructure.  We have statically
allocated type objects that don't have a GC header (and can't easily
be given one) and heap-allocated type objects that do have a GC
header.  Giving these different metatypes would be really ugly: I
tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new
invent a new name for the new metatype and make it a built-in, change
affected tests...  In short, a mess.  So instead, we add a new type
slot tp_is_gc, which is a simple Boolean function that determines
whether a particular instance has GC headers or not.  This slot is
only relevant for types that have the (new) GC flag bit set.  If the
tp_is_gc slot is NULL (by far the most common case), all instances of
the type are deemed to have GC headers.  This slot is called by the
PyObject_IS_GC() macro (which is only used twice, both times in
gcmodule.c).

I also changed the extern declarations for a bunch of GC-related
functions (_PyObject_GC_Del etc.): these always exist but objimpl.h
only declared them when WITH_CYCLE_GC was defined, but I needed to be
able to reference them without #ifdefs.  (When WITH_CYCLE_GC is not
defined, they do the same as their non-GC counterparts anyway.)

23 years agoCVS patch [#466628] Doc changes for doctest patch (#466616), from
Tim Peters [Tue, 2 Oct 2001 21:01:22 +0000 (21:01 +0000)]
CVS patch [#466628] Doc changes for doctest patch (#466616), from
Tim Hochberg.  Doctest no longer searches imported objects.