summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* SF bug #422177: Results from .pyc differs from .pyTim Peters2001-05-084-8/+34
| | | | | | | | Store floats and doubles to full precision in marshal. Test that floats read from .pyc/.pyo closely match those read from .py. Declare PyFloat_AsString() in floatobject header file. Add new PyFloat_AsReprString() API function. Document the functions declared in floatobject.h.
* Removed some confusing sentences that are no longer relevant now thatJack Jansen2001-05-081-9/+0
| | | | calldll is part of the standard macPython distribution.
* Michael Hudson <mwh21@cam.ac.uk>:Fred Drake2001-05-081-2/+3
| | | | | | | | Documentation update to reflect changes to the termios module (noting that the termios functions can take a file object as well as a file descriptor). This closes the documentation portion of SF patch #417081.
* SF patch #421922: Implement rich comparison for dicts.Tim Peters2001-05-083-4/+104
| | | | | | d1 == d2 and d1 != d2 now work even if the keys and values in d1 and d2 don't support comparisons other than ==, and testing dicts for equality is faster now (especially when inequality obtains).
* Fix several bugs and add two features.Jeremy Hylton2001-05-081-34/+88
| | | | | | | | | | | | | | | | | | | | | | | | | Assertion error message had typos in arguments to string format. .cover files for modules in packages are now put in the right place. The code that generate .cover files seemed to prepend a "./" to many absolute paths, causing them to fail. The code now checks explicitly for absolute paths and leaves them alone. In trace/coverage code, recover from case where module has no __name__ attribute, when e.g. it is executed by PyRun_String(). In this case, assign modulename to None and hope for the best. There isn't anywhere to write out coverage data for this code anyway. Also, replace several sys.stderr.writes with print >> sys.stderr. New features: -C/--coverdir dir: Generate .cover files in specified directory instead of in the directory where the .py file is. -s: Print a short summary of files coverred (# lines, % coverage, name)
* Several small changes. Mostly reformatting, adding parens.Jeremy Hylton2001-05-081-10/+11
| | | | | | | | | Check for free in class and method only if nested scopes are enabled. Add assertion to verify that no free variables occur when nested scopes are disabled. XXX When should nested scopes by made non-optional on the trunk?
* SF patch 419176 from MvL; fixed bug 418977Jeremy Hylton2001-05-083-6/+24
| | | | Two errors in dict_to_map() helper used by PyFrame_LocalsToFast().
* Remove unused variableJeremy Hylton2001-05-081-1/+0
|
* This is a test showing SF bug 422177. It won't trigger until I check inTim Peters2001-05-081-0/+30
| | | | | | another change (to test_import.py, which simply imports the new file). I'm checking this piece in now, though, to make it easier to distribute a patch for x-platform checking.
* SF bug #422108 - Error in rich comparisons.Tim Peters2001-05-071-1/+7
| | | | | | 2.1.1 bugfix candidate too. Fix a bad (albeit unlikely) return value in try_rich_to_3way_compare(). Also document do_cmp()'s return values.
* Michael Hudson <mwh21@cam.ac.uk>:Fred Drake2001-05-071-53/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does several things to termios: (1) changes all functions to be METH_VARARGS (2) changes all functions to be able to take a file object as the first parameter, as per http://mail.python.org/pipermail/python-dev/2001-February/012701.html (3) give better error messages (4) removes a bunch of comments that just repeat the docstrings (5) #includes <termio.h> before #including <sys/ioctl.h> so more #constants are actually #defined. (6) a couple of docstring tweaks I have tested this minimally (i.e. it builds, and doesn't blow up too embarassingly) on OSF1/alpha and on one of the sf compile farm's solaris boxes, and rather more comprehansively on my linux/x86 box. It still needs to be tested on all the other platforms we build termios on. This closes the code portion of SF patch #417081.
* Hmm... better add a version annotation for the Iterator Protocol section.Fred Drake2001-05-071-0/+2
|
* Added documentation for PyIter_Check() and PyIter_Next().Fred Drake2001-05-071-1/+39
| | | | Wrapped a long line.
* Generalize zip() to work with iterators.Tim Peters2001-05-064-28/+96
| | | | | | | | NEEDS DOC CHANGES. More AttributeErrors transmuted into TypeErrors, in test_b2.py, and, again, this strikes me as a good thing. This checkin completes the iterator generalization work that obviously needed to be done. Can anyone think of others that should be changed?
* Get rid of silly 5am "del" stmts.Tim Peters2001-05-051-2/+0
|
* Reimplement PySequence_Contains() and instance_contains(), so they workTim Peters2001-05-054-77/+67
| | | | | | | | | safely together and don't duplicate logic (the common logic was factored out into new private API function _PySequence_IterContains()). Visible change: some_complex_number in some_instance no longer blows up if some_instance has __getitem__ but neither __contains__ nor __iter__. test_iter changed to ensure that remains true.
* Skeletal version; I'm checking this in now so I can keep a list of changes,Andrew M. Kuchling2001-05-051-0/+106
| | | | | but don't plan on actually writing any text until, ooh, say, July or thereabouts.
* Generalize PySequence_Count() (operator.countOf) to work with iterators.Tim Peters2001-05-053-15/+70
|
* Remove redundant line.Tim Peters2001-05-051-1/+0
|
* Make 'x in y' and 'x not in y' (PySequence_Contains) play nice w/ iterators.Tim Peters2001-05-055-33/+94
| | | | | | | | | | | | | NEEDS DOC CHANGES A few more AttributeErrors turned into TypeErrors, but in test_contains this time. The full story for instance objects is pretty much unexplainable, because instance_contains() tries its own flavor of iteration-based containment testing first, and PySequence_Contains doesn't get a chance at it unless instance_contains() blows up. A consequence is that some_complex_number in some_instance dies with a TypeError unless some_instance.__class__ defines __iter__ but does not define __getitem__.
* Make unicode.join() work nice with iterators. This also required a changeTim Peters2001-05-054-13/+65
| | | | | | | | to string.join(), so that when the latter figures out in midstream that it really needs unicode.join() instead, unicode.join() can actually get all the sequence elements (i.e., there's no guarantee that the sequence passed to string.join() can be iterated over *again* by unicode.join(), so string.join() must not pass on the original sequence object anymore).
* Mark string.join() as done. Turns out string_join() works "for free" now,Tim Peters2001-05-051-1/+2
| | | | | | because PySequence_Fast() started working for free as soon as PySequence_Tuple() learned how to work with iterators. For some reason unicode.join() still doesn't work, though.
* Fix a tiny and unlikely memory leak. Was there before too, and actuallyTim Peters2001-05-051-1/+3
| | | | several of these turned up and got fixed during the iteration crusade.
* Generalize tuple() to work nicely with iterators.Tim Peters2001-05-056-49/+89
| | | | | | | | | | | | | | | | | | | | | NEEDS DOC CHANGES. This one surprised me! While I expected tuple() to be a no-brainer, turns out it's actually dripping with consequences: 1. It will *allow* the popular PySequence_Fast() to work with any iterable object (code for that not yet checked in, but should be trivial). 2. It caused two std tests to fail. This because some places used PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test whether something *is* a sequence. But tuple() code only looked for the existence of sq->item to determine that, and e.g. an instance passed that test whether or not it supported the other operations tuple() needed (e.g., __len__). So some things the tests *expected* to fail with an AttributeError now fail with a TypeError instead. This looks like an improvement to me; e.g., test_coercion used to produce 559 TypeErrors and 2 AttributeErrors, and now they're all TypeErrors. The error details are more informative too, because the places calling this were *looking* for TypeErrors in order to replace the generic tuple() "not a sequence" msg with their own more specific text, and AttributeErrors snuck by that.
* Make PyIter_Next() a little smarter (wrt its knowledge of iteratorTim Peters2001-05-054-66/+35
| | | | internals) so clients can be a lot dumber (wrt their knowledge).
* Make the license GPL-compatible.Guido van Rossum2001-05-041-16/+5
|
* Add TODO item about x in y -- this should use iterators too, IMO.Guido van Rossum2001-05-041-0/+1
|
* Added reminders to make some remaining functions iterator-friendly. FeelTim Peters2001-05-041-1/+3
| | | | free to do one!
* Generalize reduce() to work with iterators.Tim Peters2001-05-043-12/+33
| | | | NEEDS DOC CHANGES.
* Purge redundant cut&paste line.Tim Peters2001-05-031-2/+1
|
* Generalize map() to work with iterators.Tim Peters2001-05-033-66/+104
| | | | | | | | | | | NEEDS DOC CHANGES. Possibly contentious: The first time s.next() yields StopIteration (for a given map argument s) is the last time map() *tries* s.next(). That is, if other sequence args are longer, s will never again contribute anything but None values to the result, even if trying s.next() again could yield another result. This is the same behavior map() used to have wrt IndexError, so it's the only way to be wholly backward-compatible. I'm not a fan of letting StopIteration mean "try again later" anyway.
* The weakref support in PyObject_InitVar() as well; this should have come outFred Drake2001-05-031-4/+0
| | | | at the same time as it did from PyObject_Init() .
* Remove unnecessary intialization for the case of weakly-referencable objects;Fred Drake2001-05-031-4/+0
| | | | | | | the code necessary to accomplish this is simpler and faster if confined to the object implementations, so we only do this there. This causes no behaviorial changes beyond a (very slight) speedup.
* Remove an obsolete comment and a "return" before fallig off the end of aFred Drake2001-05-031-2/+0
| | | | void function.
* Since Py_TPFLAGS_HAVE_WEAKREFS is set in Py_TPFLAGS_DEFAULT, it does notFred Drake2001-05-032-21/+21
| | | | | | | need to be specified in the type structures independently. The flag exists only for binary compatibility. This is a "source cleanliness" issue and introduces no behavioral changes.
* Remove redundant copy+paste code.Tim Peters2001-05-031-3/+0
|
* Generalize max(seq) and min(seq) to work with iterators.Tim Peters2001-05-033-15/+61
| | | | NEEDS DOC CHANGES.
* InteractiveInterpreter.showsyntaxerror():Fred Drake2001-05-031-0/+1
| | | | | When replacing the exception object, be sure we stuff the new value in sys.last_value (which we already did for the original value).
* Added support for .__contains__(), .__iter__(), .iterkeys().Fred Drake2001-05-031-1/+8
|
* Added support for .iteritems(), .iterkeys(), .itervalues().Fred Drake2001-05-031-0/+3
|
* The general iteration support is part of 2.2, not 2.1 -- fixed the versionFred Drake2001-05-032-2/+3
| | | | | | annotations! Also fixed a typo noted by Neil S.
* Add documentation for the StopIteration exception.Fred Drake2001-05-031-0/+8
|
* State that Mailbox objects are iterator objects.Fred Drake2001-05-021-2/+2
|
* Make the Mailbox objects support iteration -- they already had theFred Drake2001-05-021-0/+9
| | | | | appropriate next() method, and this is what people really want to do with these objects in practice.
* Update the filter() and list() descriptions to include information aboutFred Drake2001-05-021-12/+14
| | | | the support for containers and iteration.
* Added section describing the iterator protocol.Fred Drake2001-05-021-0/+51
|
* Added new parser markers 'et' and 'et#' which do not recode stringMarc-André Lemburg2001-05-022-4/+32
| | | | | | | objects but instead assume that they use the requested encoding. This is needed on Windows to enable opening files by passing in Unicode file names.
* Mchael Hudson pointed out that the code for detecting changes inGuido van Rossum2001-05-021-4/+4
| | | | | | dictionary size was comparing ma_size, the hash table size, which is always a power of two, rather than ma_used, wich changes on each insertion or deletion. Fixed this.
* Fix for bug #417030: "print '%*s' fails for unicode string"Marc-André Lemburg2001-05-022-2/+9
|
* Generalize filter(f, seq) to work with iterators. This also generalizesTim Peters2001-05-023-48/+107
| | | | | filter() to no longer insist that len(seq) be defined. NEEDS DOC CHANGES.