summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* SF bug #436207: "if 0: yield x" is ignored.Tim Peters2001-06-261-7/+128
| | | | Not anymore <wink>. Pure hack. Doesn't fix any other "if 0:" glitches.
* Teach the types module about generators. Thanks to James Althoff on theTim Peters2001-06-252-0/+25
| | | | Iterators list for bringing it up!
* Return self.trace_dispatch from dispatch_return() to enable stepping through ↵Just van Rossum2001-06-251-0/+1
| | | | generators. (An alternative would be to create a new "yield" debugger event, but that involves many more changes, and might break Bdb subclasses.)
* Initial revisionSteven M. Gava2001-06-253-0/+435
|
* Repair indentation in comment.Tim Peters2001-06-251-2/+9
| | | | Add a temporary driver to help track down remaining leak(s).
* Changed some comments. Removed the caution about clearing globs, sinceTim Peters2001-06-241-3/+3
| | | | clearing a shallow copy _run_examples() makes itself can't hurt anything.
* Clear the copy of the globs dict after running examples. This helps toTim Peters2001-06-241-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* doctest systematically leaked memory when handling an exception in anTim Peters2001-06-241-1/+1
| | | | | example (an obvious trackback cycle). Repaired. Bugfix candidate.
* Added a "generate k-combinations of a list" example posted to c.l.py.Tim Peters2001-06-241-1/+49
|
* New tests to provoke SyntaxErrors unique to generators. Minor fiddlingTim Peters2001-06-241-6/+85
| | | | of other tests.
* doctest doesn't handle intentional SyntaxError exceptions gracefully,Tim Peters2001-06-241-1/+1
| | | | | because it picks up the first line of traceback.format_exception_only() instead of the last line. Pick up the last line instead!
* Another variant of the 2-3-5 test, mixing generators with a LazyList class.Tim Peters2001-06-241-0/+37
| | | | | | | 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.
* More tests.Tim Peters2001-06-241-1/+68
|
* Add a recursive Sieve of Eratosthenes prime generator. Not practical,Tim Peters2001-06-231-1/+39
| | | | but it's a heck of a good generator exerciser (think about it <wink>).
* Add all the examples from PEP 255, and a few email examples.Tim Peters2001-06-231-2/+183
|
* New std test for generators, initially populated with doctests NeilS putTim Peters2001-06-231-0/+139
| | | | together.
* Add sha and _sre to the list of allowed built-in modules.Fred Drake2001-06-221-1/+1
|
* Teach the UNPACK_SEQUENCE opcode how to tease an iterable object intoTim Peters2001-06-211-0/+53
| | | | | giving up the goods. NEEDS DOC CHANGES
* Add a bunch of sample strings to test soft line breaks of varying endBarry Warsaw2001-06-191-1/+28
| | | | cases.
* encode(): Fixed the handling of soft line breaks for lines over 76Barry Warsaw2001-06-191-14/+12
| | | | | characters in length. Remember that when calculating the soft breaks, the trailing `=' sign counts against the max length!
* - _filename_to_abs() didn't cater for .. components in the pathname. Fixed.Jack Jansen2001-06-191-1/+14
| | | | | - compile() didn't return a (empty) list of objects. Fixed. - the various _fix_xxx_args() methods weren't called (are they new or did I overlook them?). Fixed.
* The test used int(time.time()) to get a random number, but this doesn't work ↵Jack Jansen2001-06-191-1/+1
| | | | on the mac (where times are bigger than ints). Changed to int(time.time()%1000000).
* An import MacOS was missing after the code-rearranging. Added.Jack Jansen2001-06-191-0/+1
|
* Test by Martin v. Loewis for the new UTF-16 codec handling of BOMMarc-André Lemburg2001-06-191-0/+25
| | | | marks.
* This patch by Martin v. Loewis changes the UTF-16 codec to onlyMarc-André Lemburg2001-06-191-3/+33
| | | | | | | | | | | write a BOM at the start of the stream and also to only read it as BOM at the start of a stream. Subsequent reading/writing of BOMs will read/write the BOM as ZWNBSP character. This is in sync with the Unicode specifications. Note that UTF-16 files will now *have* to start with a BOM mark in order to be readable by the codec.
* Fixed -D emulation for symbols with a value, as specified with the ↵Just van Rossum2001-06-191-1/+1
| | | | define_macros Extension argument.
* A unittest-based test for the quopri module.Barry Warsaw2001-06-191-0/+112
|
* Better support for RFC 1521 quoted-printable specification, along withBarry Warsaw2001-06-191-25/+77
| | | | | | | | | | | | | | | | | | | | | | addition of interface for consistency with base64 module. Namely, encodestring(), decodestring(): New functions which accept a string object and return a string object. They just wrap the string in StringIOs and pass them to the encode() and decode() methods respectively. encodestring() accepts a default argument of quotetabs, defaulting to zero, which is passed on straight through to encode(). encode(): Fix the bug where an extra newline would always be added to the output, which prevented an idempotent roundtrip through encode->decode. Now, if the source string doesn't end in a newline, then the result string won't end in a newline. Also, extend the quotetabs argument semantics to include quoting embedded strings, which is also optional according to the RFC. test() -> main() "from quopri import *" also imports encodestring() and decodestring().
* Updated keyword.py for "yield".Tim Peters2001-06-191-0/+1
|
* Somebody checked this in w/ an ambiguous tab/space mix (reported byTim Peters2001-06-181-5/+5
| | | | Mark Favas).
* Added "i" and "l" to the list of std-mode struct codes that don't range-Tim Peters2001-06-181-1/+4
| | | | | check correctly on pack(). While these were checking OK on my 32-bit box, Mark Favas reported failures on a 64-bit box (alas, easy to believe).
* Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters2001-06-184-113/+49
| | | | | Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
* SF bug 434186: 0x80000000/2 != 0x80000000>>1Tim Peters2001-06-181-0/+7
| | | | | | | | | i_divmod: New and simpler algorithm. Old one returned gibberish on most boxes when the numerator was -sys.maxint-1. Oddly enough, it worked in the release (not debug) build on Windows, because the compiler optimized away some tricky sign manipulations that were incorrect in this case. Makes you wonder <wink> ... Bugfix candidate.
* Fix SF bug #433904 (Alex Martelli) - all s_* methods return None only.Guido van Rossum2001-06-181-6/+7
|
* Patch #413171: Implement get, setdefault, update in terms ofMartin v. Löwis2001-06-181-5/+7
| | | | has_key, __getitem__, and __setitem__.
* SF patch #433619, by Michel Pelletier:Guido van Rossum2001-06-171-0/+7
| | | | | | | | | Summary: NAMESPACE support in imaplib.py Initial Comment: Support for the IMAP NAMESPACE extension defined in rfc 2342. This is almost a necessity for working with modern IMAP servers.
* Synchronize with 1.13 of PyXML:Martin v. Löwis2001-06-171-6/+28
| | | | | | Allow application to set a new content handler and lex_prop handler during parsing. Closes bug #433761. Small hack to make expat be ignored in Jython.
* Generalize the new qQ std-mode tests to all int codes (bBhHiIlLqQ).Tim Peters2001-06-131-158/+202
| | | | | | | | Unfortunately, the std-mode bBhHIL codes don't do any range-checking; if and when some of those get fixed, remove their letters from the IntTester.BUGGY_RANGE_CHECK string. In the meantime, a msg saying that range-tests are getting skipped is printed to stdout whenever one is skipped.
* The new {b,l}p_{u,}longlong() didn't check get_pylong()'s return for NULL.Tim Peters2001-06-131-0/+6
| | | | Repaired that, and added appropriate tests for it to test_struct.py.
* Add new built-in 'help' which invokes pydoc.help (with a twist).Guido van Rossum2001-06-121-0/+14
|
* Added q/Q standard (x-platform 8-byte ints) mode in struct module.Tim Peters2001-06-121-6/+165
| | | | | | | | | | | | | | This completes the q/Q project. longobject.c _PyLong_AsByteArray: The original code had a gross bug: the most-significant Python digit doesn't necessarily have SHIFT significant bits, and you really need to count how many copies of the sign bit it has else spurious overflow errors result. test_struct.py: This now does exhaustive std q/Q testing at, and on both sides of, all relevant power-of-2 boundaries, both positive and negative. NEWS: Added brief dict news while I was at it.
* Renamed some stuff to tell the truth about what it does.Tim Peters2001-06-101-4/+4
|
* Initial support for 'q' and 'Q' struct format codes: for now, only inTim Peters2001-06-101-10/+47
| | | | | | | | | | | | | | | | | | native mode, and only when config #defines HAVE_LONG_LONG. Standard mode will eventually treat them as 8-byte ints across all platforms, but that likely requires a new set of routines in longobject.c first (while sizeof(long) >= 4 is guaranteed by C, there's nothing in C we can rely on x-platform to hold 8 bytes of int, so we'll have to roll our own; I'm thinking of a simple pair of conversion functions, Python long to/from sized vector of unsigned bytes; that may be useful for GMP conversions too; std q/Q would call them with size fixed at 8). test_struct.py: In addition to adding some native-mode 'q' and 'Q' tests, got rid of unused code, and repaired a non-portable assumption about native sizeof(short) (it isn't 2 on some Cray boxes). libstruct.tex: In addition to adding a bit of 'q'/'Q' docs (more needed later), removed an erroneous footnote about 'I' behavior.
* SF bug 431772: traceback.print_exc() causes tracebackTim Peters2001-06-101-13/+14
| | | | | | | Patch from Michael Hundson. format_exception_only() blew up when trying to report a SyntaxError from a string input (line is None in this case, but it assumed a string). Bugfix candidate.
* SF bug 430991: wrong co_lnotabTim Peters2001-06-091-17/+14
| | | | | | | | | Armin Rigo pointed out that the way the line-# table got built didn't work for lines generating more than 255 bytes of bytecode. Fixed as he suggested, plus corresponding changes to pyassem.py, plus added some long overdue docs about this subtle table to compile.c. Bugfix candidate (line numbers may be off in tracebacks under -O).
* Patch #424475: Speed-up tp_compare usage, by special-casing the commonMartin v. Löwis2001-06-091-1/+1
| | | | | | case of objects with equal types which support tp_compare. Give type objects a tp_compare function. Also add c<0 tests before a few PyErr_Occurred tests.
* Performance improvements to the profiler:Fred Drake2001-06-081-57/+93
| | | | | | | | | | | | | | | | | Ensure that all the default timers are called as functions, not an expensive method wrapper around a variety of different functions. Agressively avoid dictionary lookups. Modify the dispatch scheme (Profile.trace_dispatch_*(), where * is not 'call', 'exception' or 'return') so that the callables dispatched to are simple functions and not bound methods -- this reduces the number of layers of Python call machinery that gets touched. Remove a couple of duplicate imports from the "if __name__ == ..." section. This closes SF patch #430948.
* Patch #429957: Add support for cp1140, which is identical to cp037,Martin v. Löwis2001-06-072-0/+50
| | | | | with the addition of the euro character. Also added a few EDBDIC aliases.
* check in for patch #430846Peter Schneider-Kamp2001-06-071-10/+6
| | | | | use faster code for base64.encodestring (courtesy of Mr. Tim Peters) and for base64.decodestring (courtesy of Anthony Baxter)
* Previous check-in was by mistake, undo it.Martin v. Löwis2001-06-071-1/+3
|