]> granicus.if.org Git - python/log
python
23 years agoUpdated version numbers for post 2.2b1 development.
Barry Warsaw [Fri, 19 Oct 2001 17:11:58 +0000 (17:11 +0000)]
Updated version numbers for post 2.2b1 development.

23 years agoadded tests for long ints and ints where they are > 32 bits.
Skip Montanaro [Fri, 19 Oct 2001 16:06:52 +0000 (16:06 +0000)]
added tests for long ints and ints where they are > 32 bits.
should have been checked in as part of patch #470254.

23 years agoFix for Bug #216405:
Thomas Heller [Fri, 19 Oct 2001 13:49:35 +0000 (13:49 +0000)]
Fix for Bug #216405:
use the correct base for a buffer object in _PyBuffer_FromObject.

23 years ago(Hopefully) fix SF bug #472675: CVS socketmodule now doesn't compile
Guido van Rossum [Fri, 19 Oct 2001 12:40:40 +0000 (12:40 +0000)]
(Hopefully) fix SF bug #472675: CVS socketmodule now doesn't compile

This appears to be a case of a missing \n\ in a multiline string
literal.

23 years agoAdditional test and documentation for the unicode() changes.
Marc-André Lemburg [Fri, 19 Oct 2001 12:02:29 +0000 (12:02 +0000)]
Additional test and documentation for the unicode() changes.

This patch should also be applied to the 2.2b1 trunk.

23 years agoLast minute updates for changes since 2.2a4. Unless Fred wants to add
Barry Warsaw [Fri, 19 Oct 2001 05:35:40 +0000 (05:35 +0000)]
Last minute updates for changes since 2.2a4.  Unless Fred wants to add
anything about the hotshot profiler, this file is ready for the 2.2b1
Windows build.

23 years agoAdded a note about the somewhat kludgey behavior of the message
Barry Warsaw [Fri, 19 Oct 2001 04:34:42 +0000 (04:34 +0000)]
Added a note about the somewhat kludgey behavior of the message
epilogue, based on the discussion in this SF bug report:

https://sourceforge.net/tracker/index.php?func=detail&aid=472481&group_id=25568&atid=384678

23 years agoAnother merge from mimelib:
Barry Warsaw [Fri, 19 Oct 2001 04:08:59 +0000 (04:08 +0000)]
Another merge from mimelib:

    TestMIMEMessage.test_epilogue(), TestIdempotent.test_preamble_epilogue():
    Test cases for SF bug #472481.

23 years agoAnother email package test file
Barry Warsaw [Fri, 19 Oct 2001 04:07:27 +0000 (04:07 +0000)]
Another email package test file

23 years agoAnother merge from mimelib:
Barry Warsaw [Fri, 19 Oct 2001 04:06:39 +0000 (04:06 +0000)]
Another merge from mimelib:

    _handle_multipart(): If there is an epilogue and the epilogue does
    not itself start with a newline, add a newline before writing the
    epilogue.  Closes SF bug #472481.

23 years agoAdd entry for RAND_xxx() functions in socket module.
Jeremy Hylton [Fri, 19 Oct 2001 03:40:19 +0000 (03:40 +0000)]
Add entry for RAND_xxx() functions in socket module.

23 years agoNote the Unicode changes from SF patch #470578.
Guido van Rossum [Fri, 19 Oct 2001 02:05:35 +0000 (02:05 +0000)]
Note the Unicode changes from SF patch #470578.

23 years agoSF patch #470578: Fixes to synchronize unicode() and str()
Guido van Rossum [Fri, 19 Oct 2001 02:01:31 +0000 (02:01 +0000)]
SF patch #470578: Fixes to synchronize unicode() and str()

    This patch implements what we have discussed on python-dev late in
    September: str(obj) and unicode(obj) should behave similar, while
    the old behaviour is retained for unicode(obj, encoding, errors).

    The patch also adds a new feature with which objects can provide
    unicode(obj) with input data: the __unicode__ method. Currently no
    new tp_unicode slot is implemented; this is left as option for the
    future.

    Note that PyUnicode_FromEncodedObject() no longer accepts Unicode
    objects as input. The API name already suggests that Unicode
    objects do not belong in the list of acceptable objects and the
    functionality was only needed because
    PyUnicode_FromEncodedObject() was being used directly by
    unicode(). The latter was changed in the discussed way:

    * unicode(obj) calls PyObject_Unicode()
    * unicode(obj, encoding, errors) calls PyUnicode_FromEncodedObject()

    One thing left open to discussion is whether to leave the
    PyUnicode_FromObject() API as a thin API extension on top of
    PyUnicode_FromEncodedObject() or to turn it into a (macro) alias
    for PyObject_Unicode() and deprecate it. Doing so would have some
    surprising consequences though, e.g.  u"abc" + 123 would turn out
    as u"abc123"...

[Marc-Andre didn't have time to check this in before the deadline.  I
hope this is OK, Marc-Andre!  You can still make changes and commit
them on the trunk after the branch has been made, but then please mail
Barry a context diff if you want the change to be merged into the
2.2b1 release branch.  GvR]

23 years agoAnother.
Guido van Rossum [Fri, 19 Oct 2001 01:51:11 +0000 (01:51 +0000)]
Another.

23 years agoSF patch #470393 (Jim Ahlstrom): Add missing marshal function
Guido van Rossum [Fri, 19 Oct 2001 01:46:21 +0000 (01:46 +0000)]
SF patch #470393 (Jim Ahlstrom): Add missing marshal function

    In Include/, marshal.h declares both
    PyMarshal_ReadLongFromFile()
    and PyMarshal_ReadShortFromFile(),
    but the second is missing from marshal.c.

[Shouldn't the return type be declared as 'short' instead of 'int'?
But 'int' is what was in marshal.h all those years...  --Guido]

23 years agoSF patch #460805 by Chris Gonnerman: Support for unsetenv()
Guido van Rossum [Fri, 19 Oct 2001 01:31:59 +0000 (01:31 +0000)]
SF patch #460805 by Chris Gonnerman: Support for unsetenv()

This adds unsetenv to posix, and uses it in the __delitem__ method of
os.environ.

(XXX Should we change the preferred name for putenv to setenv, for
consistency?)

23 years agoSF patch #443759: Add Interface to readline's add_history
Guido van Rossum [Fri, 19 Oct 2001 01:18:43 +0000 (01:18 +0000)]
SF patch #443759: Add Interface to readline's add_history

This was submitted by Moshe, but apparently he's too busy to check it
in himself.  He wrote:

    Here is a function in GNU readline called add_history,
    which is used to manage the history list. Though Python
    uses this function internally, it does not expose it to
    the Python programmer. This patch adds direct interface
    to this function with documentation.

    This could be used by friendly modules to "seed" the
    history with commands.

23 years agoAssume a 64-bit start and len if O_LARGEFILE is available.
Martin v. Löwis [Thu, 18 Oct 2001 22:07:48 +0000 (22:07 +0000)]
Assume a 64-bit start and len if O_LARGEFILE is available.

23 years agoExpose O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW.
Martin v. Löwis [Thu, 18 Oct 2001 22:05:36 +0000 (22:05 +0000)]
Expose O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW.

23 years agoWhitespace normalization.
Tim Peters [Thu, 18 Oct 2001 21:57:37 +0000 (21:57 +0000)]
Whitespace normalization.

23 years agoMove dlfcn.h block out of NetBSD block, assuming that NetBSD before
Martin v. Löwis [Thu, 18 Oct 2001 21:24:04 +0000 (21:24 +0000)]
Move dlfcn.h block out of NetBSD block, assuming that NetBSD before
199712 didn't have dlfcn.h, or that it wouldn't conflict with the other
stuff defined.

23 years agoThe assignment to result.st_rdev can raise AttributeError as well as
Guido van Rossum [Thu, 18 Oct 2001 21:19:31 +0000 (21:19 +0000)]
The assignment to result.st_rdev can raise AttributeError as well as
TypeError (on systems where it's not defined at all, it raises
AttributeError; when it's defined, assignment to it raises TypeError).

23 years agochanged misleading argument name
Fredrik Lundh [Thu, 18 Oct 2001 20:58:25 +0000 (20:58 +0000)]
changed misleading argument name

23 years agoDon't leave bare newlines in long strings -- VC doesn't like that.
Guido van Rossum [Thu, 18 Oct 2001 20:53:15 +0000 (20:53 +0000)]
Don't leave bare newlines in long strings -- VC doesn't like that.

23 years agoadd structseq.c to project
Guido van Rossum [Thu, 18 Oct 2001 20:51:32 +0000 (20:51 +0000)]
add structseq.c to project

23 years agoSF Patch (but with no patch) 472555 Remove trailing common in enumeration.
Tim Peters [Thu, 18 Oct 2001 20:49:35 +0000 (20:49 +0000)]
SF Patch (but with no patch) 472555 Remove trailing common in enumeration.
Some AIX compiler didn't like the trailing comma at the end of the
why_code enum decl.

23 years agoMissing file structseq.c for SF patch #462296
Guido van Rossum [Thu, 18 Oct 2001 20:47:51 +0000 (20:47 +0000)]
Missing file structseq.c for SF patch  #462296

23 years agoSF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum [Thu, 18 Oct 2001 20:34:25 +0000 (20:34 +0000)]
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.

This is a big one, touching lots of files.  Some of the platforms
aren't tested yet.  Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences.  When accessed as a sequence, they behave exactly as
before.  But they also have attributes like st_mtime or tm_year.  The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there).  If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.

(Still missing is a documentation update.)

23 years agoSF bug [#472347] pydoc and properties.
Tim Peters [Thu, 18 Oct 2001 19:56:17 +0000 (19:56 +0000)]
SF bug [#472347] pydoc and properties.
The GUI-mode code to display properties blew up if the property functions
(get, set, etc) weren't simply methods (or functions).

"The problem" here is really that the generic document() method dispatches
to one of .doc{routine, class, module, other}(), but all of those require
a different(!) number of arguments.  Thus document isn't general-purpose
at all:  you have to know exactly what kind of thing is it you're going
to document first, in order to pass the correct number of arguments to
.document for it to pass on.  As an expedient hack, just tacked "*ignored"
on to the end of the formal argument lists for the .docXXX routines so
that .document's caller doesn't have to know in advance which path
.document is going to take.

23 years agoShut up warnings for setgroups() on Linux -- you have to #include
Guido van Rossum [Thu, 18 Oct 2001 19:44:10 +0000 (19:44 +0000)]
Shut up warnings for setgroups() on Linux -- you have to #include
<grp.h> it seems.  This requires yet another configure test.

23 years agoSome minor clarifications for find()'s arguments based on SF bug
Barry Warsaw [Thu, 18 Oct 2001 19:41:48 +0000 (19:41 +0000)]
Some minor clarifications for find()'s arguments based on SF bug
#463572.  Closing.

23 years agoDo not expect line number events when running under "python -O".
Fred Drake [Thu, 18 Oct 2001 19:34:00 +0000 (19:34 +0000)]
Do not expect line number events when running under "python -O".
The right fix is to generate line number events anyway ;-), but this will
have to do for now.

23 years agoSRE bug #441409:
Fredrik Lundh [Thu, 18 Oct 2001 19:30:16 +0000 (19:30 +0000)]
SRE bug #441409:
    compile should raise error for non-strings
SRE bug #432570, 448951:
    reset group after failed match

also bumped version number to 2.2.0

23 years agoAdd a test for calling a weakref proxy with a dictionary of keyword args.
Fred Drake [Thu, 18 Oct 2001 19:28:29 +0000 (19:28 +0000)]
Add a test for calling a weakref proxy with a dictionary of keyword args.

23 years agoRemove an unnecessary check for NULL.
Fred Drake [Thu, 18 Oct 2001 19:21:46 +0000 (19:21 +0000)]
Remove an unnecessary check for NULL.

23 years agoNote stricter tp_compare return value requirements.
Guido van Rossum [Thu, 18 Oct 2001 19:20:25 +0000 (19:20 +0000)]
Note stricter tp_compare return value requirements.

23 years agoPart 2/2 of SF patch #416704: More robust freeze, by Toby Dickenson.
Guido van Rossum [Thu, 18 Oct 2001 19:15:32 +0000 (19:15 +0000)]
Part 2/2 of SF patch #416704: More robust freeze, by Toby Dickenson.

(With slight cosmetic improvements to shorten lines and a grammar fix
to a docstring.)

This addes -X and -E options to freeze.  From the docstring:

-X module     Like -x, except the module can never be imported by
              the frozen binary.

-E:           Freeze will fail if any modules can't be found (that
              were not excluded using -x or -X).

23 years agoStraighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake [Thu, 18 Oct 2001 18:58:30 +0000 (18:58 +0000)]
Straighten out the exec*() function descriptions a bit, and clarify a few
points in the spawn*() description.

23 years agoSquash compiler wng about signed/unsigned mismatch.
Tim Peters [Thu, 18 Oct 2001 18:57:31 +0000 (18:57 +0000)]
Squash compiler wng about signed/unsigned mismatch.

23 years agoFirst part of SF patch #416704: More robust freeze, by Toby Dickenson.
Guido van Rossum [Thu, 18 Oct 2001 18:54:11 +0000 (18:54 +0000)]
First part of SF patch #416704: More robust freeze, by Toby Dickenson.
This fixes the behavior reported by SF bug #404545, where a file
x.y.py could be imported by the statement "import x.y" when there's a
frozen package x (I believe even if x.y also exists as a frozen
module).

23 years agoFix the frozen bytecode for __hello__ (betcha didn't know that existed
Guido van Rossum [Thu, 18 Oct 2001 18:49:37 +0000 (18:49 +0000)]
Fix the frozen bytecode for __hello__ (betcha didn't know that existed
:-).

Add a test that prevents the __hello__ bytecode from going stale
unnoticed again.

The test also tests the loophole noted in SF bug #404545.  This test
will fail right now; I'll check in the fix in a minute.

23 years agoBump version number.
Fred Drake [Thu, 18 Oct 2001 18:46:22 +0000 (18:46 +0000)]
Bump version number.
Remove inconsistent use of HTMLDIR.

23 years agoBump release information.
Fred Drake [Thu, 18 Oct 2001 18:41:12 +0000 (18:41 +0000)]
Bump release information.

23 years agoAdd a note about changes related to the weak reference objects.
Fred Drake [Thu, 18 Oct 2001 18:18:06 +0000 (18:18 +0000)]
Add a note about changes related to the weak reference objects.

23 years agoMake sure we do not core dump when using proxies with the binary slot
Fred Drake [Thu, 18 Oct 2001 18:06:05 +0000 (18:06 +0000)]
Make sure we do not core dump when using proxies with the binary slot
handlers.  This was fixed in Objects/weakrefobject.c 1.2.

23 years agoWhen weakref proxies are involved in binary & ternary slot operations,
Fred Drake [Thu, 18 Oct 2001 18:04:18 +0000 (18:04 +0000)]
When weakref proxies are involved in binary & ternary slot operations,
the left-hand operand may not be the proxy in all cases.  If it isn't,
we end up doing two things: a) unwrapping something that isn't a
PyWeakReference (later resulting in a core dump) and b) passing a
proxy as the right-hand operand anyway, even though that can't be
handled by the actual handler (maybe eventually causing a core dump).

This is fixed by always unwrapping all the proxies involved before
passing anything to the actual handler.

23 years agoSF bug #471720: ThreadingMixIn/TCPServer forgets close
Guido van Rossum [Thu, 18 Oct 2001 18:02:07 +0000 (18:02 +0000)]
SF bug #471720: ThreadingMixIn/TCPServer forgets close

Solved with a helper method that calls finish_request() and then
close_request().  The code is by Max Neunhöffer.

23 years agoReindent __repr__.
Martin v. Löwis [Thu, 18 Oct 2001 17:33:19 +0000 (17:33 +0000)]
Reindent __repr__.

23 years agoAdd test for local assigned to only in a nested list comp
Jeremy Hylton [Thu, 18 Oct 2001 16:23:11 +0000 (16:23 +0000)]
Add test for local assigned to only in a nested list comp

23 years agoFix for SF bug [ #471928 ] global made w/nested list comprehensions
Jeremy Hylton [Thu, 18 Oct 2001 16:15:10 +0000 (16:15 +0000)]
Fix for SF bug [ #471928 ] global made w/nested list comprehensions

The symbol table pass didn't have an explicit case for the list_iter
node which is used only for a nested list comprehension.  As a result,
the target of the list comprehension was treated as a use instead of
an assignment.  Fix is to add a case to symtable_node() to handle
list_iter.

Also, rework and document a couple of the subtler implementation
issues in the symbol table pass.  The symtable_node() switch statement
depends on falling through the last several cases, in order to handle
some of the more complicated nodes like atom.  Add a comment
explaining the behavior before the first fall through case.  Add a
comment /* fall through */ at the end of case so that it is explicitly
marked as such.

Move the for_stmt case out of the fall through logic, which simplifies
both for_stmt and default.  (The default used the local variable start
to skip the first three nodes of a for_stmt when it fell through.)

Rename the flag argument to symtable_assign() to def_flag and add a
comment explaining its use:

   The third argument to symatble_assign() is a flag to be passed to
   symtable_add_def() if it is eventually called.  The flag is useful
   to specify the particular type of assignment that should be
   recorded, e.g. an assignment caused by import.

23 years agoFix SF bug #472234: type(obj) calls type->tp_init (Roeland Rengelink)
Guido van Rossum [Thu, 18 Oct 2001 15:49:21 +0000 (15:49 +0000)]
Fix SF bug #472234: type(obj) calls type->tp_init (Roeland Rengelink)

The fix is a band-aid: type_call() now makes the same exception for a
single-argument call to type() as type_new() was already making.

23 years agoUse CXX in LINKCC if CXX is used to build main() and the system requires
Martin v. Löwis [Thu, 18 Oct 2001 15:35:38 +0000 (15:35 +0000)]
Use CXX in LINKCC if CXX is used to build main() and the system requires
to link a C++ main using the C++ compiler. Fixes #472007.

23 years agoFix typo reported by Michael Soulier.
Fred Drake [Thu, 18 Oct 2001 15:22:23 +0000 (15:22 +0000)]
Fix typo reported by Michael Soulier.

23 years agoBump Windows build # for 2.2b1.
Tim Peters [Thu, 18 Oct 2001 15:19:38 +0000 (15:19 +0000)]
Bump Windows build # for 2.2b1.

23 years agoFunction descriptions must end as well as start!
Fred Drake [Thu, 18 Oct 2001 14:26:08 +0000 (14:26 +0000)]
Function descriptions must end as well as start!

23 years agoElaborate on types and meaning of the setgroups arguments.
Martin v. Löwis [Thu, 18 Oct 2001 14:07:12 +0000 (14:07 +0000)]
Elaborate on types and meaning of the setgroups arguments.

23 years agoPatch to bug #472202: Correctly recognize NetBSD before 199712.
Martin v. Löwis [Thu, 18 Oct 2001 11:45:19 +0000 (11:45 +0000)]
Patch to bug #472202: Correctly recognize NetBSD before 199712.

23 years agoPatch #470744: Simplify __repr__ error handling.
Martin v. Löwis [Thu, 18 Oct 2001 11:39:34 +0000 (11:39 +0000)]
Patch #470744: Simplify __repr__ error handling.

23 years agoExpose setgroups. Fixes feature request #468116.
Martin v. Löwis [Thu, 18 Oct 2001 04:06:00 +0000 (04:06 +0000)]
Expose setgroups. Fixes feature request #468116.

23 years agoFix error checking done by abstract_issubclass and abstract_isinstance.
Neil Schemenauer [Thu, 18 Oct 2001 03:18:43 +0000 (03:18 +0000)]
Fix error checking done by abstract_issubclass and abstract_isinstance.
isinstance() now allows any object as the first argument and a class, a
type or something with a __bases__ tuple attribute for the second
argument.  This closes SF patch #464992.

23 years agoAdd trivial test cases for RAND_add() and RAND_status().
Jeremy Hylton [Thu, 18 Oct 2001 00:30:14 +0000 (00:30 +0000)]
Add trivial test cases for RAND_add() and RAND_status().

(The rest of the test cases are trivial, so I don't feel too bad.)

23 years agoExpose three OpenSSL API calls for dealing with the PRNG.
Jeremy Hylton [Thu, 18 Oct 2001 00:28:50 +0000 (00:28 +0000)]
Expose three OpenSSL API calls for dealing with the PRNG.

Quoth the OpenSSL RAND_add man page:

    OpenSSL makes sure that the PRNG state is unique for each
    thread. On systems that provide /dev/urandom, the
    randomness device is used to seed the PRNG transparently.
    However, on all other systems, the application is
    responsible for seeding the PRNG by calling RAND_add(),
    RAND_egd(3) or RAND_load_file(3).

I decided to expose RAND_add() because it's general and RAND_egd()
because it's a useful special case.  RAND_load_file() didn't seem to
offer much over RAND_add(), so I skipped it.  Also supplied
RAND_status() which returns true if the PRNG is seeded and false if
not.

23 years agotest for int and long int overflow (allows operation on 64-bit platforms)
Skip Montanaro [Wed, 17 Oct 2001 22:53:33 +0000 (22:53 +0000)]
test for int and long int overflow (allows operation on 64-bit platforms)
closes patch 470254

23 years agoTwo merges from the mimelib project:
Barry Warsaw [Wed, 17 Oct 2001 20:52:26 +0000 (20:52 +0000)]
Two merges from the mimelib project:

    test_no_semis_header_splitter(): This actually should still split.

    test_no_split_long_header(): An example of an unsplittable line.

    test_no_semis_header_splitter(): Test for SF bug # 471918, Generator
    splitting long headers.

23 years agoTwo merges from the mimelib project:
Barry Warsaw [Wed, 17 Oct 2001 20:51:42 +0000 (20:51 +0000)]
Two merges from the mimelib project:

    _split_header(): Split on folding whitespace if the attempt to split
    on semi-colons failed.

    _split_header(): Patch by Matthew Cowles for fixing SF bug # 471918,
    Generator splitting long headers.

23 years agoProtect references to tp_descr_get and tp_dict with the appropriate test:
Guido van Rossum [Wed, 17 Oct 2001 20:26:38 +0000 (20:26 +0000)]
Protect references to tp_descr_get and tp_dict with the appropriate test:
PyType_HasFeature(t, Py_TPFLAGS_HAVE_CLASS).

23 years agoOops. Catching OverflowError from int() doesn't help, since it raises
Guido van Rossum [Wed, 17 Oct 2001 17:21:47 +0000 (17:21 +0000)]
Oops.  Catching OverflowError from int() doesn't help, since it raises
ValueError on too-large inputs.

23 years agoRemove a bunch of stuff that's no longer needed now that update_slot()
Guido van Rossum [Wed, 17 Oct 2001 13:59:09 +0000 (13:59 +0000)]
Remove a bunch of stuff that's no longer needed now that update_slot()
and fixup_slot_dispatchers() always select the proper slot dispatcher.
This affects slot_sq_item(), slot_tp_getattro(), and
slot_tp_getattr_hook().

23 years agoThe Python symtable module depends on .h files that setup.py doesn't track.
Jeremy Hylton [Wed, 17 Oct 2001 13:46:44 +0000 (13:46 +0000)]
The Python symtable module depends on .h files that setup.py doesn't track.

23 years agoMake sure the output lists are sorted, even if run with -r.
Jeremy Hylton [Wed, 17 Oct 2001 13:45:28 +0000 (13:45 +0000)]
Make sure the output lists are sorted, even if run with -r.

23 years agoTest utility to look for bad stacksize calculations.
Jeremy Hylton [Wed, 17 Oct 2001 13:39:06 +0000 (13:39 +0000)]
Test utility to look for bad stacksize calculations.

23 years agoVastly improved stacksize calculation.
Jeremy Hylton [Wed, 17 Oct 2001 13:37:29 +0000 (13:37 +0000)]
Vastly improved stacksize calculation.

There are now no known cases where the compiler package computes a
stack depth lower than the one computed by the builtin compiler.  (To
achieve this state, we had to fix bugs in both compilers :-).

The chief change is to do the depth calculations with respect to basic
blocks.  The stack effect of block is calculated.  Then the flow graph
is traversed using breadth-first search to find the max weight path
through the graph.

Had to fix the StackDepthTracker to calculate the right info for
several opcodes: LOAD_ATTR, CALL_FUNCTION (and friends), MAKE_CLOSURE,
and DUP_TOPX.

XXX Still need to handle free variables in MAKE_CLOSURE.

XXX There are still a lot of places where the computed stack depth is
larger than for the builtin compiler.  These won't cause the
interpreter to overflow the frame, but they waste space.

23 years agoHandle testlist_safe as if it were testlist.
Jeremy Hylton [Wed, 17 Oct 2001 13:32:52 +0000 (13:32 +0000)]
Handle testlist_safe as if it were testlist.

23 years agoRemove unused convenience routine.
Jeremy Hylton [Wed, 17 Oct 2001 13:32:02 +0000 (13:32 +0000)]
Remove unused convenience routine.

23 years agoFor debug build, check that the stack pointer never exceeds the stack size.
Jeremy Hylton [Wed, 17 Oct 2001 13:29:30 +0000 (13:29 +0000)]
For debug build, check that the stack pointer never exceeds the stack size.

23 years agoFix computation of stack depth for classdef and closures.
Jeremy Hylton [Wed, 17 Oct 2001 13:22:22 +0000 (13:22 +0000)]
Fix computation of stack depth for classdef and closures.
Also minor tweaks to internal routines.
Use PyCF_MASK instead of explicit list of flags.

For the MAKE_CLOSURE opcode, the number of items popped off the stack
depends on both the oparg and the number of free variables for the
code object.  Fix the code so it accounts for the free variables.

In com_classdef(), record an extra pop to account for the STORE call
after the BUILD_CLASS.

Get rid of some commented out debugging code in com_push() and
com_pop().

Factor string resize logic into helper routine com_check_size().

In com_addbyte(), remove redudant if statement after assert.  (They
test the same condition.)

In several routines, use string macros instead of string functions.

23 years agotrack addition of testlist_safe to Grammar
Jeremy Hylton [Wed, 17 Oct 2001 13:13:04 +0000 (13:13 +0000)]
track addition of testlist_safe to Grammar

23 years agoslot_sq_item(): ensure that self is an instance of the wrapper's
Guido van Rossum [Wed, 17 Oct 2001 07:15:43 +0000 (07:15 +0000)]
slot_sq_item(): ensure that self is an instance of the wrapper's
d_type before calling the wrapped function.

fixup_slot_dispatchers(): fix indentation.

23 years agoSF patch #467430.
Guido van Rossum [Wed, 17 Oct 2001 06:45:56 +0000 (06:45 +0000)]
SF patch #467430.

- replace some log_error() calls with log_message()

- flush self.rfile before forking too (hope this works on Windows)

23 years agoSF patch #471894: Makefile installs pydoc incorrectly
Guido van Rossum [Wed, 17 Oct 2001 06:26:53 +0000 (06:26 +0000)]
SF patch #471894: Makefile installs pydoc incorrectly

Add --install-scripts=$(BINDIR) argument to "setup.py install"
invocation.

23 years agoFolder.getlast(): avoid PyChecker warning.
Guido van Rossum [Wed, 17 Oct 2001 05:59:26 +0000 (05:59 +0000)]
Folder.getlast(): avoid PyChecker warning.

23 years agoSimplify and regularize docstrings. Also reformat so that each docstring
Tim Peters [Wed, 17 Oct 2001 04:16:15 +0000 (04:16 +0000)]
Simplify and regularize docstrings.  Also reformat so that each docstring
line fits in reasonable screen width.

23 years agoTrimmed trailing whitespace.
Tim Peters [Wed, 17 Oct 2001 03:57:20 +0000 (03:57 +0000)]
Trimmed trailing whitespace.

23 years agoRemoved more comments that didn't make much sense.
Tim Peters [Wed, 17 Oct 2001 03:56:45 +0000 (03:56 +0000)]
Removed more comments that didn't make much sense.
Made the presence/absence of a semicolon after macros consistent.

23 years agoRemoved obsolete comments about confused string refcount tricks (Jeremy
Tim Peters [Wed, 17 Oct 2001 03:43:54 +0000 (03:43 +0000)]
Removed obsolete comments about confused string refcount tricks (Jeremy
removed the tricks).

Changed the ENTER/LEAVE_ZLIB macros so as not to create a new block (a
new block is neither necessary nor helpful).

23 years agoRemove unused import; reported by Neal Norwitz.
Fred Drake [Wed, 17 Oct 2001 01:51:04 +0000 (01:51 +0000)]
Remove unused import; reported by Neal Norwitz.

23 years agoMinor code cleanups based on comments from Neal Norwitz.
Fred Drake [Wed, 17 Oct 2001 01:49:50 +0000 (01:49 +0000)]
Minor code cleanups based on comments from Neal Norwitz.

23 years agoYAPC.
Guido van Rossum [Wed, 17 Oct 2001 00:17:52 +0000 (00:17 +0000)]
YAPC.

23 years agoUndo needless INCREF chicanery introduced by SF patch #450702.
Jeremy Hylton [Tue, 16 Oct 2001 23:26:08 +0000 (23:26 +0000)]
Undo needless INCREF chicanery introduced by SF patch #450702.

    Apparently this patch (rev 2.41) replaced all the good old "s#"
    formats in PyArg_ParseTuple() with "S".  Then it did
    PyString_FromStringAndSize() to get back the values setup by the
    "s#" format.  It also incref'd and decref'd the string obtained by
    "S" even though the argument tuple had a reference to it.

Replace PyString_AsString() calls with PyString_AS_STRING().

    A good rule of thumb -- if you never check the return value of
    PyString_AsString() to see if it's NULL, you ought to be using the
    macro <wink>.

23 years agoSimplify and fix error handling for most cases.
Jeremy Hylton [Tue, 16 Oct 2001 23:02:32 +0000 (23:02 +0000)]
Simplify and fix error handling for most cases.

Many functions used a local variable called return_error, which was
initialized to zero.  If an error occurred, it was set to true.  Most
of the code paths checked were only executed if return_error was
false.  goto is clearer.

The code also seemed to be written under the curious assumption that
calling Py_DECREF() on a local variable would assign the variable to
NULL.  As a result, more of the error-exit code paths returned an
object that had a reference count of zero instead of just returning
NULL.  Fixed the code to explicitly assign NULL after the DECREF.

A bit more reformatting, but not much.

XXX Need a much better test suite for zlib, since it the current tests
don't exercise any of this broken code.

23 years agoSF bug [#471111] inspect.getframeinfo() needs docs.
Tim Peters [Tue, 16 Oct 2001 23:01:06 +0000 (23:01 +0000)]
SF bug [#471111] inspect.getframeinfo() needs docs.
TeX-ified its docstring.

23 years agoMore reformatting.
Jeremy Hylton [Tue, 16 Oct 2001 21:59:35 +0000 (21:59 +0000)]
More reformatting.

23 years agoAdd zlib_error() helper.
Jeremy Hylton [Tue, 16 Oct 2001 21:56:09 +0000 (21:56 +0000)]
Add zlib_error() helper.

It sets a ZlibError exception, using the msg from the z_stream pointer
if one is available.

23 years agoFix a bug in the previous checkin. The wrong bootstrap function was
Guido van Rossum [Tue, 16 Oct 2001 21:50:04 +0000 (21:50 +0000)]
Fix a bug in the previous checkin.  The wrong bootstrap function was
passed to _beginthread().

23 years agoAdd fix for getattr(obj, name, default). Rearrange a few things.
Guido van Rossum [Tue, 16 Oct 2001 21:34:49 +0000 (21:34 +0000)]
Add fix for getattr(obj, name, default).  Rearrange a few things.

23 years agoSF patch #471852 (anonymous) notes that getattr(obj, name, default)
Guido van Rossum [Tue, 16 Oct 2001 21:31:32 +0000 (21:31 +0000)]
SF patch #471852 (anonymous) notes that getattr(obj, name, default)
masks any exception, not just AttributeError.  Fix this.

23 years agoRemove many calls to set MemoryError exceptions.
Jeremy Hylton [Tue, 16 Oct 2001 21:23:58 +0000 (21:23 +0000)]
Remove many calls to set MemoryError exceptions.

When PyString_FromStringAndSize() and _PyString_Resize() fail, they
set an exception.  There's no need to set a new exception.

23 years agoReformat!
Jeremy Hylton [Tue, 16 Oct 2001 21:19:45 +0000 (21:19 +0000)]
Reformat!

Consistently indent 4 spaces.
Use whitespace around operators.
Put braces in the right places.

23 years agoPartial patch from SF #452266, by Jason Petrone.
Guido van Rossum [Tue, 16 Oct 2001 21:13:49 +0000 (21:13 +0000)]
Partial patch from SF #452266, by Jason Petrone.

This changes Pythread_start_thread() to return the thread ID, or -1
for an error.  (It's technically an incompatible API change, but I
doubt anyone calls it.)

23 years agoAdd note about new zlib feature.
Jeremy Hylton [Tue, 16 Oct 2001 20:42:52 +0000 (20:42 +0000)]
Add note about new zlib feature.