]> granicus.if.org Git - python/log
python
23 years agoAdded the new unicode defines. Not really tested yet, but Python compiles again at...
Jack Jansen [Mon, 2 Jul 2001 15:34:57 +0000 (15:34 +0000)]
Added the new unicode defines. Not really tested yet, but Python compiles again at least.

23 years agoNuke hard tabs.
Tim Peters [Mon, 2 Jul 2001 04:59:35 +0000 (04:59 +0000)]
Nuke hard tabs.

23 years agoWhitespace normalization; the plat-riscos file didn't even get by
Tim Peters [Mon, 2 Jul 2001 04:57:30 +0000 (04:57 +0000)]
Whitespace normalization; the plat-riscos file didn't even get by
tabnanny.py.

23 years agoAdd tentative 2.1.1 Windows build numbers.
Tim Peters [Mon, 2 Jul 2001 04:08:39 +0000 (04:08 +0000)]
Add tentative 2.1.1 Windows build numbers.

23 years agoA clever union-find implementation from c.l.py, due to David Eppstein.
Tim Peters [Mon, 2 Jul 2001 01:38:33 +0000 (01:38 +0000)]
A clever union-find implementation from c.l.py, due to David Eppstein.
This is another one that leaks memory without an explict clear!  Time to
bite this bullet.

23 years agoAdded WeakLink...Generator classes (should have done that ages ago). These check...
Jack Jansen [Sun, 1 Jul 2001 22:09:29 +0000 (22:09 +0000)]
Added WeakLink...Generator classes (should have done that ages ago). These check the c-function pointer for being NULL before calling it and raise UnimplementedError if it is.

This allows system libs to be weak-linked, thereby allowing us to generate functions that are only available on some OS versions without getting a NULL dereference if the function isn't available.

23 years ago- Use weaklink generators so we can support OSX-only calls without crashing on OS9.
Jack Jansen [Sun, 1 Jul 2001 22:04:02 +0000 (22:04 +0000)]
- Use weaklink generators so we can support OSX-only calls without crashing on OS9.
- Convert CFString to/from Python strings. Currently always MacRoman, to be fixed later (as is unicode support). Python->CFString conversion is automatic.

23 years agoDerive an industrial-strength conjoin() via cross-recursion loop unrolling,
Tim Peters [Sat, 30 Jun 2001 07:29:44 +0000 (07:29 +0000)]
Derive an industrial-strength conjoin() via cross-recursion loop unrolling,
and fiddle the conjoin tests to exercise all the new possible paths.

23 years agoTurns out Neil didn't intend for *all* of his gen-branch work to get
Tim Peters [Fri, 29 Jun 2001 23:51:08 +0000 (23:51 +0000)]
Turns out Neil didn't intend for *all* of his gen-branch work to get
committed.

tokenize.py:  I like these changes, and have tested them extensively
without even realizing it, so I just updated the docstring and the docs.

tabnanny.py:  Also liked this, but did a little code fiddling.  I should
really rewrite this to *exploit* generators, but that's near the bottom
of my effort/benefit scale so doubt I'll get to it anytime soon (it
would be most useful as a non-trivial example of ideal use of generators;
but test_generators.py has already grown plenty of food-for-thought
examples).

inspect.py:  I'm sure Ping intended for this to continue running even
under 1.5.2, so I reverted this to the last pre-gen-branch version.  The
"bugfix" I checked in in-between was actually repairing a bug *introduced*
by the conversion to generators, so it's OK that the reverted version
doesn't reflect that checkin.

23 years agoUse the more conventional "self" as the name of the self parameter in an
Fred Drake [Fri, 29 Jun 2001 17:50:57 +0000 (17:50 +0000)]
Use the more conventional "self" as the name of the self parameter in an
example.  It actually confused a reader.

23 years agoCorrect a markup error for an accented character.
Fred Drake [Fri, 29 Jun 2001 16:25:07 +0000 (16:25 +0000)]
Correct a markup error for an accented character.

Reported by Milan Zamazal <pdm@zamazal.org>.

23 years agoRemoved some stray periods, and fix up a number of visible markup
Fred Drake [Fri, 29 Jun 2001 16:21:47 +0000 (16:21 +0000)]
Removed some stray periods, and fix up a number of visible markup
consistency errors (mostly omitted "()" at the end of function and
method names).

Reported by Milan Zamazal <pdm@zamazal.org>.

23 years agoTwo more names.
Fred Drake [Fri, 29 Jun 2001 15:42:20 +0000 (15:42 +0000)]
Two more names.

23 years agoSourceForge bug #437041:
Fred Drake [Fri, 29 Jun 2001 15:39:53 +0000 (15:39 +0000)]
SourceForge bug #437041:
Use a portable format in the example that creates a timestamp suitable for
use in email, also updating it and the footnote from RFC 822 to RFC 2822.

23 years agoSimplify an example based on comment from Thomas Holenstein <thomas@hex.ch>:
Fred Drake [Fri, 29 Jun 2001 14:59:01 +0000 (14:59 +0000)]
Simplify an example based on comment from Thomas Holenstein <thomas@hex.ch>:
Do not use an extra flag variable to test only once in one subsequent if
statement.

23 years agoSolve SF bug #231249: cgi.py opens too many (temporary) files.
Guido van Rossum [Fri, 29 Jun 2001 13:06:06 +0000 (13:06 +0000)]
Solve SF bug #231249: cgi.py opens too many (temporary) files.

class FieldStorage: this patch changes read_lines() and co. to use a
StringIO() instead of a real file.  The write() calls are redirected
to a private method that replaces it with a real, external file only
when it gets too big (> 1000 bytes).

This avoids problems in forms using the multipart/form-data encoding
with many fields.  The original code created a temporary file for
*every* field (not just for file upload fields), thereby sometimes
exceeding the open file limit of some systems.

Note that the simpler solution "use a real file only for file uploads"
can't be used because the form field parser has no way to tell which
fields correspond to file uploads.

It's *possible* but extremely unlikely that this would break someone's
code; they would have to be stepping way outside the documented
interface for FieldStorage and use f.file.fileno(), or depend on
overriding make_file() to return a file-like object with additional
known properties.

23 years agoAdded a simple but general backtracking generator (conjoin), and a couple
Tim Peters [Fri, 29 Jun 2001 02:41:16 +0000 (02:41 +0000)]
Added a simple but general backtracking generator (conjoin), and a couple
examples of use.  These poke stuff not specifically targeted before, incl.
recursive local generators relying on nested scopes, ditto but also
inside class methods and rebinding instance vars, and anonymous
partially-evaluated generators (the N-Queens solver creates a different
column-generator for each row -- AFAIK this is my invention, and it's
really pretty <wink>).  No problems, not even a new leak.

23 years agoAdded CFURL support, and got base chaining to really work.
Jack Jansen [Thu, 28 Jun 2001 22:08:26 +0000 (22:08 +0000)]
Added CFURL support, and got base chaining to really work.

23 years agoMake basechain a class variable in stead of initializing it in __init__. That way...
Jack Jansen [Thu, 28 Jun 2001 22:07:30 +0000 (22:07 +0000)]
Make basechain a class variable in stead of initializing it in __init__. That way it's more easily overridden.

23 years agoAnother "if 0:" hack, this time to complain about otherwise invisible
Tim Peters [Thu, 28 Jun 2001 01:52:22 +0000 (01:52 +0000)]
Another "if 0:" hack, this time to complain about otherwise invisible
"return expr" instances in generators (which latter may be generators
due to otherwise invisible "yield" stmts hiding in "if 0" blocks).
This was fun the first time, but this has gotten truly ugly now.

23 years agoremoved "register const" from scalar arguments to the unicode
Fredrik Lundh [Wed, 27 Jun 2001 22:08:26 +0000 (22:08 +0000)]
removed "register const" from scalar arguments to the unicode
predicates

23 years agoCFArray, CFData and CFDictonary are now covered, but mainly opaque.
Jack Jansen [Wed, 27 Jun 2001 22:00:55 +0000 (22:00 +0000)]
CFArray, CFData and CFDictonary are now covered, but mainly opaque.
CFStrings are in better shape, but Unicode support and automatic conversion to/from Python strings remains to be done.

23 years agoAdded a couple more types that Apple has taken a fancy to.
Jack Jansen [Wed, 27 Jun 2001 21:58:40 +0000 (21:58 +0000)]
Added a couple more types that Apple has taken a fancy to.

23 years agoAdd more items that need to be written about
Andrew M. Kuchling [Wed, 27 Jun 2001 20:32:12 +0000 (20:32 +0000)]
Add more items that need to be written about

23 years agoDefault to ucs2 when no argument to --enable-unicode is specified.
Martin v. Löwis [Wed, 27 Jun 2001 20:22:04 +0000 (20:22 +0000)]
Default to ucs2 when no argument to --enable-unicode is specified.

23 years agomake wchar_t usable again on Windows (this enables the MBCS codecs)
Fredrik Lundh [Wed, 27 Jun 2001 19:49:17 +0000 (19:49 +0000)]
make wchar_t usable again on Windows (this enables the MBCS codecs)

23 years agoRevise the interface to the profiling and tracing support for the
Fred Drake [Wed, 27 Jun 2001 19:19:46 +0000 (19:19 +0000)]
Revise the interface to the profiling and tracing support for the
Python interpreter.

This change adds two new C-level APIs:  PyEval_SetProfile() and
PyEval_SetTrace().  These can be used to install profile and trace
functions implemented in C, which can operate at much higher speeds
than Python-based functions.  The overhead for calling a C-based
profile function is a very small fraction of a percent of the overhead
involved in calling a Python-based function.

The machinery required to call a Python-based profile or trace
function been moved to sysmodule.c, where sys.setprofile() and
sys.setprofile() simply become users of the new interface.

As a side effect, SF bug #436058 is fixed; there is no longer a
_PyTrace_Init() function to declare.

23 years agoRevise the interface to the profiling and tracing support for the
Fred Drake [Wed, 27 Jun 2001 19:18:03 +0000 (19:18 +0000)]
Revise the interface to the profiling and tracing support for the
Python interpreter.

This change adds two new C-level APIs:  PyEval_SetProfile() and
PyEval_SetTrace().  These can be used to install profile and trace
functions implemented in C, which can operate at much higher speeds
than Python-based functions.  The overhead for calling a C-based
profile function is a very small fraction of a percent of the overhead
involved in calling a Python-based function.

The machinery required to call a Python-based profile or trace
function been moved to sysmodule.c, where sys.setprofile() and
sys.setprofile() simply become users of the new interface.

23 years agouse Py_UNICODE_WIDE instead of USE_UCS4_STORAGE and Py_UNICODE_SIZE
Fredrik Lundh [Wed, 27 Jun 2001 18:59:43 +0000 (18:59 +0000)]
use Py_UNICODE_WIDE instead of USE_UCS4_STORAGE and Py_UNICODE_SIZE
tests.

23 years agoReplace the text with a link to the PEP-ified version.
Barry Warsaw [Wed, 27 Jun 2001 17:14:04 +0000 (17:14 +0000)]
Replace the text with a link to the PEP-ified version.

23 years agoRemove duplicate ', ' in dbhash.open()'s argument list.
Thomas Wouters [Wed, 27 Jun 2001 13:49:59 +0000 (13:49 +0000)]
Remove duplicate ', ' in dbhash.open()'s argument list.

23 years agoThis no longer leaks memory when run in an infinite loop. However,
Tim Peters [Wed, 27 Jun 2001 07:17:57 +0000 (07:17 +0000)]
This no longer leaks memory when run in an infinite loop.  However,
that required explicitly calling LazyList.clear() in the two tests that
use LazyList (I added a LazyList Fibonacci generator too).

A real bitch:  the extremely inefficient first version of the 2-3-5 test
*looked* like a slow leak on Win98SE, but it wasn't "really":  it generated
so many results that the heap grew over 4Mb (tons of frames!  the number
of frames grows exponentially in that test).  Then Win98SE malloc() starts
fragmenting address space allocating more and more heaps, and the visible
memory use grew very slowly while the disk was thrashing like mad.
Printing fewer results (i.e., keeping the heap burden under 4Mb) made
that illusion vanish.

Looks like there's no hope for plugging the LazyList leaks automatically
short of adding frameobjects and genobjects to gc.  OTOH, they're very
easy to break by hand, and they're the only *kind* of plausibly realistic
leaks I've been able to provoke.

Dilemma.

23 years agoEncode surrogates in UTF-8 even for a wide Py_UNICODE.
Martin v. Löwis [Wed, 27 Jun 2001 06:28:56 +0000 (06:28 +0000)]
Encode surrogates in UTF-8 even for a wide Py_UNICODE.
Implement sys.maxunicode.
Explicitly wrap around upper/lower computations for wide Py_UNICODE.
When decoding large characters with UTF-8, represent expected test
results using the \U notation.

23 years agoCosmetic changes to MvL's change to unichr():
Guido van Rossum [Tue, 26 Jun 2001 23:12:25 +0000 (23:12 +0000)]
Cosmetic changes to MvL's change to unichr():

- the correct range for the error message is range(0x110000);

- put the 4-byte Unicode-size code inside the same else branch as the
  2-byte code, rather generating unreachable code in the 2-byte case.

- Don't hide the 'else' behine the '}'.

(I would prefer that in 4-byte mode, any value should be accepted, but
reasonable people can argue about that, so I'll put that off.)

23 years agoMake Unicode work a bit better on Windows...
Fredrik Lundh [Tue, 26 Jun 2001 22:59:49 +0000 (22:59 +0000)]
Make Unicode work a bit better on Windows...

23 years agoWhen decoding UTF-16, don't assume that the buffer is in native endianness
Martin v. Löwis [Tue, 26 Jun 2001 22:43:40 +0000 (22:43 +0000)]
When decoding UTF-16, don't assume that the buffer is in native endianness
when checking surrogates.

23 years agoWindows build broke from recent Unicode changes -- need to #define
Tim Peters [Tue, 26 Jun 2001 22:40:47 +0000 (22:40 +0000)]
Windows build broke from recent Unicode changes -- need to #define
SIZEOF_SHORT by hand here.
Also added dynamic check that SIZEOF_SHORT is correct for the platform (in
_testcapimodule).

23 years agogen_getattr: make the gi_running and gi_frame members discoverable (but
Tim Peters [Tue, 26 Jun 2001 22:24:51 +0000 (22:24 +0000)]
gen_getattr:  make the gi_running and gi_frame members discoverable (but
not writable -- too dangerous!) from Python code.

23 years agoSupport using UCS-4 as the Py_UNICODE type:
Martin v. Löwis [Tue, 26 Jun 2001 22:22:37 +0000 (22:22 +0000)]
Support using UCS-4 as the Py_UNICODE type:
Add configure option --enable-unicode.
Add config.h macros Py_USING_UNICODE, PY_UNICODE_TYPE, Py_UNICODE_SIZE,
                    SIZEOF_WCHAR_T.
Define Py_UCS2.
Encode and decode large UTF-8 characters into single Py_UNICODE values
for wide Unicode types; likewise for UTF-16.
Remove test whether sizeof Py_UNICODE is two.

23 years agoAdded a Parser_OSX class that can parse new-style (C-only) headers,
Jack Jansen [Tue, 26 Jun 2001 21:53:25 +0000 (21:53 +0000)]
Added a Parser_OSX class that can parse new-style (C-only) headers,
such as the Core Foundation ones.

23 years agoAdded CF module build and project generation (carbon only).
Jack Jansen [Tue, 26 Jun 2001 21:52:08 +0000 (21:52 +0000)]
Added CF module build and project generation (carbon only).

23 years agoFirst small step towards bgen-generated CoreFoundation. there is hardly any real...
Jack Jansen [Tue, 26 Jun 2001 21:51:18 +0000 (21:51 +0000)]
First small step towards bgen-generated CoreFoundation. there is hardly any real functionality yet, but method chains seem to work, and so do Retain/Release semantics.

23 years agoAdd "gi_" (generator-iterator) prefix to names of genobject members.
Tim Peters [Tue, 26 Jun 2001 20:58:58 +0000 (20:58 +0000)]
Add "gi_" (generator-iterator) prefix to names of genobject members.
Makes it much easier to find references via dumb editor search (former
"frame" in particular was near-hopeless).

23 years agomore unicode tweaks: fix unicodectype for sizeof(Py_UNICODE) >
Fredrik Lundh [Tue, 26 Jun 2001 20:36:12 +0000 (20:36 +0000)]
more unicode tweaks: fix unicodectype for sizeof(Py_UNICODE) >
sizeof(int)

23 years agoRemove the restriction on a mapping's .update() method.
Barry Warsaw [Tue, 26 Jun 2001 20:32:59 +0000 (20:32 +0000)]
Remove the restriction on a mapping's .update() method.

23 years agoAdd an item about the extension to {}.update() to allow generic
Barry Warsaw [Tue, 26 Jun 2001 20:12:50 +0000 (20:12 +0000)]
Add an item about the extension to {}.update() to allow generic
mapping objects as an argument.

23 years agoAdd a bunch of tests for extended dict.update() where the argument is
Barry Warsaw [Tue, 26 Jun 2001 20:09:28 +0000 (20:09 +0000)]
Add a bunch of tests for extended dict.update() where the argument is
a non-dictionary mapping object.  Include tests for several expected
failure modes.

23 years agodict_update(): Generalize this method so {}.update() accepts any
Barry Warsaw [Tue, 26 Jun 2001 20:08:32 +0000 (20:08 +0000)]
dict_update(): Generalize this method so {}.update() accepts any
"mapping" object, specifically one that supports PyMapping_Keys() and
PyObject_GetItem().  This allows you to say e.g. {}.update(UserDict())

We keep the special case for concrete dict objects, although that
seems moderately questionable.  OTOH, the code exists and works, so
why change that?

.update()'s docstring already claims that D.update(E) implies calling
E.keys() so it's appropriate not to transform AttributeErrors in
PyMapping_Keys() to TypeErrors.

Patch eyeballed by Tim.

23 years agomore unicode tweaks: make unichr(0xdddddddd) behave like u"\Udddddddd"
Fredrik Lundh [Tue, 26 Jun 2001 20:01:56 +0000 (20:01 +0000)]
more unicode tweaks: make unichr(0xdddddddd) behave like u"\Udddddddd"
wrt surrogates.  (this extends the valid range from 65535 to 1114111)

23 years agoexperimental UCS-4 support: don't assume that MS_WIN32 implies
Fredrik Lundh [Tue, 26 Jun 2001 17:46:10 +0000 (17:46 +0000)]
experimental UCS-4 support: don't assume that MS_WIN32 implies
HAVE_USABLE_WCHAR_T

23 years agoexperimental UCS-4 support: added USE_UCS4_STORAGE define to
Fredrik Lundh [Tue, 26 Jun 2001 17:17:07 +0000 (17:17 +0000)]
experimental UCS-4 support: added USE_UCS4_STORAGE define to
unicodeobject.h, which forces sizeof(Py_UNICODE) == sizeof(Py_UCS4).
(this may be good enough for platforms that doesn't have a 16-bit
type.  the UTF-16 codecs don't work, though)

23 years agoexperimental UCS-4 support: made compare a bit more robust, in case
Fredrik Lundh [Tue, 26 Jun 2001 16:39:36 +0000 (16:39 +0000)]
experimental UCS-4 support: made compare a bit more robust, in case
sizeof(Py_UNICODE) >= sizeof(long).  also changed surrogate expansion
to work if sizeof(Py_UNICODE) > 2.

23 years agoexperimental UCS-4 support: don't assume that MS_WIN32 implies
Fredrik Lundh [Tue, 26 Jun 2001 15:11:00 +0000 (15:11 +0000)]
experimental UCS-4 support: don't assume that MS_WIN32 implies
HAVE_USABLE_WCHAR_T

23 years agoAdded a note about recompiling OSAm before distributing.
Jack Jansen [Tue, 26 Jun 2001 08:06:59 +0000 (08:06 +0000)]
Added a note about recompiling OSAm before distributing.

23 years agoFixed typo in doc string.
Just van Rossum [Tue, 26 Jun 2001 06:57:12 +0000 (06:57 +0000)]
Fixed typo in doc string.

23 years agoFixed bug that prevented shared libs that are submodules of a
Just van Rossum [Tue, 26 Jun 2001 06:54:33 +0000 (06:54 +0000)]
Fixed bug that prevented shared libs that are submodules of a
package to be loaded from a PYD resource.

23 years agoSF bug #436207: "if 0: yield x" is ignored.
Tim Peters [Tue, 26 Jun 2001 03:36:28 +0000 (03:36 +0000)]
SF bug #436207:  "if 0: yield x" is ignored.
Not anymore <wink>.  Pure hack.  Doesn't fix any other "if 0:" glitches.

23 years agoTeach the types module about generators. Thanks to James Althoff on the
Tim Peters [Mon, 25 Jun 2001 19:46:25 +0000 (19:46 +0000)]
Teach the types module about generators.  Thanks to James Althoff on the
Iterators list for bringing it up!

23 years agoReturn self.trace_dispatch from dispatch_return() to enable stepping through generato...
Just van Rossum [Mon, 25 Jun 2001 18:01:24 +0000 (18:01 +0000)]
Return self.trace_dispatch from dispatch_return() to enable stepping through generators. (An alternative would be to create a new "yield" debugger event, but that involves many more changes, and might break Bdb subclasses.)

23 years agoUpdated link to zlib's home page.
Fred Drake [Mon, 25 Jun 2001 15:30:13 +0000 (15:30 +0000)]
Updated link to zlib's home page.

23 years agoWaitNextEvent short vs. unsigned short fix.
Jack Jansen [Mon, 25 Jun 2001 08:48:05 +0000 (08:48 +0000)]
WaitNextEvent short vs. unsigned short fix.

23 years agoInitial revision
Steven M. Gava [Mon, 25 Jun 2001 07:23:57 +0000 (07:23 +0000)]
Initial revision

23 years agoRemove const-ness in inet_pton declaration.
Martin v. Löwis [Mon, 25 Jun 2001 06:38:03 +0000 (06:38 +0000)]
Remove const-ness in inet_pton declaration.

23 years agoReplace snprintf with sprintf.
Martin v. Löwis [Mon, 25 Jun 2001 06:37:02 +0000 (06:37 +0000)]
Replace snprintf with sprintf.

23 years agoRepair indentation in comment.
Tim Peters [Mon, 25 Jun 2001 01:30:12 +0000 (01:30 +0000)]
Repair indentation in comment.
Add a temporary driver to help track down remaining leak(s).

23 years agoFix typos in inet_pton/inet_ntop.
Martin v. Löwis [Sun, 24 Jun 2001 21:35:43 +0000 (21:35 +0000)]
Fix typos in inet_pton/inet_ntop.

23 years agoProvide a definition for offsetof.
Martin v. Löwis [Sun, 24 Jun 2001 21:28:42 +0000 (21:28 +0000)]
Provide a definition for offsetof.

23 years agoEmulate inet_{pton,ntop} on systems that don't provide it.
Martin v. Löwis [Sun, 24 Jun 2001 21:18:26 +0000 (21:18 +0000)]
Emulate inet_{pton,ntop} on systems that don't provide it.

23 years agoMove USE_TOOLBOX_OBJECT_GLUE into acconfig.h.
Martin v. Löwis [Sun, 24 Jun 2001 20:59:45 +0000 (20:59 +0000)]
Move USE_TOOLBOX_OBJECT_GLUE into acconfig.h.

23 years agoChanged some comments. Removed the caution about clearing globs, since
Tim Peters [Sun, 24 Jun 2001 20:24:16 +0000 (20:24 +0000)]
Changed some comments.  Removed the caution about clearing globs, since
clearing a shallow copy _run_examples() makes itself can't hurt anything.

23 years agoClear the copy of the globs dict after running examples. This helps to
Tim Peters [Sun, 24 Jun 2001 20:02:47 +0000 (20:02 +0000)]
Clear the copy of the globs dict after running examples.  This helps to
break cycles, which are a special problem when running generator tests
that provoke exceptions by invoking the .next() method of a named
generator-iterator:  then the iterator is named in globs, and the
iterator's frame gets a tracekback object pointing back to globs, and
gc doesn't chase these types so the cycle leaks.

Also changed _run_examples() to make a copy of globs itself, so its
callers (direct and indirect) don't have to (and changed the callers
to stop making their own copies); *that* much is a change I've been
meaning to make for a long time (it's more robust the new way).

Here's a way to provoke the symptom without doctest; it leaks at a
prodigious rate; if the last two "source" lines are replaced with
    g().next()
the iterator isn't named and then there's no leak:

source = """\
def g():
    yield 1/0

k = g()
k.next()
"""

code = compile(source, "<source>", "exec")

def f(globs):
    try:
        exec code in globs
    except ZeroDivisionError:
        pass

while 1:
    f(globals().copy())

After this change, running test_generators in an infinite loop still leaks,
but reduced from a flood to a trickle.

23 years agodoctest systematically leaked memory when handling an exception in an
Tim Peters [Sun, 24 Jun 2001 18:59:01 +0000 (18:59 +0000)]
doctest systematically leaked memory when handling an exception in an
example (an obvious trackback cycle).  Repaired.
Bugfix candidate.

24 years agoAdded a "generate k-combinations of a list" example posted to c.l.py.
Tim Peters [Sun, 24 Jun 2001 10:14:27 +0000 (10:14 +0000)]
Added a "generate k-combinations of a list" example posted to c.l.py.

24 years agoNew tests to provoke SyntaxErrors unique to generators. Minor fiddling
Tim Peters [Sun, 24 Jun 2001 07:10:02 +0000 (07:10 +0000)]
New tests to provoke SyntaxErrors unique to generators.  Minor fiddling
of other tests.

24 years agodoctest doesn't handle intentional SyntaxError exceptions gracefully,
Tim Peters [Sun, 24 Jun 2001 06:46:58 +0000 (06:46 +0000)]
doctest doesn't handle intentional SyntaxError exceptions gracefully,
because it picks up the first line of traceback.format_exception_only()
instead of the last line.  Pick up the last line instead!

24 years agoAnother variant of the 2-3-5 test, mixing generators with a LazyList class.
Tim Peters [Sun, 24 Jun 2001 05:47:06 +0000 (05:47 +0000)]
Another variant of the 2-3-5 test, mixing generators with a LazyList class.
Good news:  Some of this stuff is pretty sophisticated (read nuts), and
I haven't bumped into a bug yet.
Bad news:  If I run the doctest in an infinite loop, memory is clearly
leaking.

24 years agoPure brute-force hackery to allow Python to build on Windows again,
Tim Peters [Sun, 24 Jun 2001 05:08:52 +0000 (05:08 +0000)]
Pure brute-force hackery to allow Python to build on Windows again,
because I need to make progress and don't have time now to think about
whatever it is the new code is trying to accomplish.

24 years agoMore tests.
Tim Peters [Sun, 24 Jun 2001 03:44:52 +0000 (03:44 +0000)]
More tests.

24 years agoAdd a recursive Sieve of Eratosthenes prime generator. Not practical,
Tim Peters [Sat, 23 Jun 2001 21:01:47 +0000 (21:01 +0000)]
Add a recursive Sieve of Eratosthenes prime generator.  Not practical,
but it's a heck of a good generator exerciser (think about it <wink>).

24 years agoAdd all the examples from PEP 255, and a few email examples.
Tim Peters [Sat, 23 Jun 2001 20:45:43 +0000 (20:45 +0000)]
Add all the examples from PEP 255, and a few email examples.

24 years agoNew std test for generators, initially populated with doctests NeilS put
Tim Peters [Sat, 23 Jun 2001 20:27:04 +0000 (20:27 +0000)]
New std test for generators, initially populated with doctests NeilS put
together.

24 years agoProperly use &&. Closes bug #434988.
Martin v. Löwis [Sat, 23 Jun 2001 19:58:46 +0000 (19:58 +0000)]
Properly use &&. Closes bug #434988.

24 years agoProperly use &&. Closes bug #434989.
Martin v. Löwis [Sat, 23 Jun 2001 19:55:38 +0000 (19:55 +0000)]
Properly use &&. Closes bug #434989.

24 years agoPatch #401196: Configuration machinery for IPv6.
Martin v. Löwis [Sat, 23 Jun 2001 16:30:13 +0000 (16:30 +0000)]
Patch #401196: Configuration machinery for IPv6.
Contributed by Jun-ichiro "itojun" Hagino. get{addr,name}info emulation
code taken from WIDE.

24 years agoFix typo
Andrew M. Kuchling [Sat, 23 Jun 2001 16:26:44 +0000 (16:26 +0000)]
Fix typo

24 years agoCorrect erroneous description of precmd.
Eric S. Raymond [Sat, 23 Jun 2001 14:42:43 +0000 (14:42 +0000)]
Correct erroneous description of precmd.

24 years agoChange the semantics of "return" in generators, as discussed on the
Tim Peters [Sat, 23 Jun 2001 06:19:16 +0000 (06:19 +0000)]
Change the semantics of "return" in generators, as discussed on the
Iterators list and Python-Dev; e.g., these all pass now:

def g1():
    try:
        return
    except:
        yield 1
assert list(g1()) == []

def g2():
    try:
        return
    finally:
        yield 1
assert list(g2()) == [1]

def g3():
    for i in range(3):
        yield None
    yield None
assert list(g3()) == [None] * 4

compile.c:  compile_funcdef and com_return_stmt:  Just van Rossum's patch
to compile the same code for "return" regardless of function type (this
goes back to the previous scheme of returning Py_None).

ceval.c:  gen_iternext:  take a return (but not a yield) of Py_None as
meaning the generator is exhausted.

24 years agoRemove some bogus trailing whitespace.
Fred Drake [Sat, 23 Jun 2001 06:16:52 +0000 (06:16 +0000)]
Remove some bogus trailing whitespace.

24 years agoFix minor markup nits.
Fred Drake [Sat, 23 Jun 2001 06:06:52 +0000 (06:06 +0000)]
Fix minor markup nits.

24 years agoUse a named reference to another chapter instead of hard coding the
Fred Drake [Sat, 23 Jun 2001 06:06:21 +0000 (06:06 +0000)]
Use a named reference to another chapter instead of hard coding the
chapter number.  This also makes the reference a hyperlink in the HTML
version.

24 years agogen_iternext(): Don't assume that the current thread state's frame is
Tim Peters [Sat, 23 Jun 2001 05:47:56 +0000 (05:47 +0000)]
gen_iternext():  Don't assume that the current thread state's frame is
not NULL.  I don't think it can be NULL from Python code, but if using
generators via the C API I expect a NULL frame is possible.

24 years agoFix a very minor (but annoying when looking for things!) markup nit.
Fred Drake [Sat, 23 Jun 2001 05:27:20 +0000 (05:27 +0000)]
Fix a very minor (but annoying when looking for things!) markup nit.

24 years agoPyFrameObject: rename f_stackbottom to f_stacktop, since it points to
Tim Peters [Sat, 23 Jun 2001 05:26:56 +0000 (05:26 +0000)]
PyFrameObject:  rename f_stackbottom to f_stacktop, since it points to
the next free valuestack slot, not to the base (in America, stacks push
and pop at the top -- they mutate at the bottom in Australia <winK>).
eval_frame():  assert that f_stacktop isn't NULL upon entry.
frame_delloc():  avoid ordered pointer comparisons involving f_stacktop
when f_stacktop is NULL.

24 years agoAdd "yeild" to the list of keywords.
Fred Drake [Sat, 23 Jun 2001 05:26:52 +0000 (05:26 +0000)]
Add "yeild" to the list of keywords.

Fix a very minor (but annoying when looking for things!) markup nit.

24 years agoConsistently use semi-colons after the last property for each selector.
Fred Drake [Sat, 23 Jun 2001 04:53:43 +0000 (04:53 +0000)]
Consistently use semi-colons after the last property for each selector.

24 years agoGive the pattern used to pick out a source anchor a more specific pattern.
Fred Drake [Sat, 23 Jun 2001 04:35:09 +0000 (04:35 +0000)]
Give the pattern used to pick out a source anchor a more specific pattern.

24 years agoAdded several names.
Fred Drake [Sat, 23 Jun 2001 03:17:02 +0000 (03:17 +0000)]
Added several names.

24 years agoContributed updates from Harald Hanche-Olsen, giving details of the branch
Fred Drake [Sat, 23 Jun 2001 03:16:29 +0000 (03:16 +0000)]
Contributed updates from Harald Hanche-Olsen, giving details of the branch
cuts for the complex math functions.  Includes a brief description of
what branch cuts are.

24 years agoAdded support for our new \infinity and \plusminus macros, and the
Fred Drake [Sat, 23 Jun 2001 03:13:30 +0000 (03:13 +0000)]
Added support for our new \infinity and \plusminus macros, and the
standard \textbar macro (not supported in many versions of LaTeX2HTML).

Added newline to error message.

24 years ago\infinity,
Fred Drake [Sat, 23 Jun 2001 03:11:45 +0000 (03:11 +0000)]
\infinity,
\plusminus:  New macros to allow us to avoid math mode for these symbols.