summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* Iterators phase 1. This comprises:Guido van Rossum2001-04-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER new C API PyObject_GetIter(), calls tp_iter new builtin iter(), with two forms: iter(obj), and iter(function, sentinel) new internal object types iterobject and calliterobject new exception StopIteration new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py) new magic number for .pyc files new special method for instances: __iter__() returns an iterator iteration over dictionaries: "for x in dict" iterates over the keys iteration over files: "for x in file" iterates over lines TODO: documentation test suite decide whether to use a different way to spell iter(function, sentinal) decide whether "for key in dict" is a good idea use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?) speed tuning (make next() a slot tp_next???)
* dispatcher.__repr__() was unprepared to handle the address for a UnixJeremy Hylton2001-04-201-11/+16
| | | | | domain socket. Fix that and make the error message for failures a little more helpful by including the class name.
* Implement, test and document "key in dict" and "key not in dict".Guido van Rossum2001-04-201-0/+4
| | | | | | | | | I know some people don't like this -- if it's really controversial, I'll take it out again. (If it's only Alex Martelli who doesn't like it, that doesn't count as "real controversial" though. :-) That's why this is a separate checkin from the iterators stuff I'm about to check in next.
* Weak*Dictionary: Added docstrings to the classes.Fred Drake2001-04-191-24/+36
| | | | | | | | | | | | | | | | Weak*Dictionary.update(): No longer create a temporary list to hold the things that will be stuffed into the underlying dictionary. This had been done so that if any of the objects used as the weakly-held value was not weakly-referencable, no updates would take place (TypeError would be raised). With this change, TypeError will still be raised but a partial update could occur. This is more like other .update() implementations. Thoughout, use of the name "ref" as a local variable has been removed. The original use of the name occurred when the function to create a weak reference was called "new"; the overloaded use of the name could be confusing for someone reading the code. "ref" used as a variable name has been replaced with "wr" (for 'weak reference').
* Fix compileall.py so that it fails on SyntaxErrorsJeremy Hylton2001-04-181-8/+26
| | | | | | | | | | | | | | | | The changes cause compilation failures in any file in the Python installation lib directory to cause the install to fail. It looks like compileall.py intended to behave this way, but a change to py_compile.py and a separate bug defeated it. Fixes SF bug #412436 This change affects the test suite, which contains several files that contain intentional errors. The solution is to extend compileall.py with the ability to skip compilation of selected files. NB compileall.py is changed so that compile_dir() returns success only if all recursive calls to compile_dir() also check success.
* Fix compileall.py so that it fails on SyntaxErrorsJeremy Hylton2001-04-1810-16/+11
| | | | | | | | | | | | | | | | | | | | | The changes cause compilation failures in any file in the Python installation lib directory to cause the install to fail. It looks like compileall.py intended to behave this way, but a change to py_compile.py and a separate bug defeated it. Fixes SF bug #412436 This change affects the test suite, which contains several files that contain intentional errors. The solution is to extend compileall.py with the ability to skip compilation of selected files. In the test suite, rename nocaret.py and test_future[3..7].py to start with badsyntax_nocaret.py and badsyntax_future[3..7].py. Update the makefile to skip compilation of these files. Update the tests to use the name names for imports. NB compileall.py is changed so that compile_dir() returns success only if all recursive calls to compile_dir() also check success.
* Unused variable (caught by PyChecker) removed.Eric S. Raymond2001-04-171-1/+0
|
* Fix three PyChecker-detected gotchas.Jeremy Hylton2001-04-161-4/+10
| | | | | Import OPT_ symbols from _symtable. Define has_exec() and has_import_star().
* In walk(), don't die when os.lstat() raises os.error, e.g. because aGuido van Rossum2001-04-161-1/+4
| | | | | | | | | file was deleted by a previous call to the visitor function. This used to be the behavior in 1.5.2 and before, but a patch to avoid making two stat() calls accidentally broke this in 2.0. Moshe, this would be a good one for 2.0.1 too!
* Add a test case for Weak*Dictionary.update() that would have caught aFred Drake2001-04-161-0/+25
| | | | recently reported bug; also exposed some other bugs in the implementation.
* Weak*Dictionary.update(): Fix calls to [].append() to only have oneFred Drake2001-04-161-4/+15
| | | | | | | | parameter. Weak*Dictionary.get(): Make the second parameter optional. WeakKeyDictionary.has_key(), .keys(): Make these actually work!
* Implement Mark Favas's suggestion. There's a clear bug in _group():Guido van Rossum2001-04-161-1/+1
| | | | | | | | | | its first return statement returns a single value while its caller always expects it to return a tuple of two items. Fix this by returning (s, 0) instead. This won't make the locale test on Irix succeed, but now it will fail because of a bug in the platform's en_US locale rather than because of a bug in the locale module.
* Change the test data to ask for class C from module __main__ ratherGuido van Rossum2001-04-161-2/+3
| | | | | | than from module pickletester. Using the latter turned out to cause the test to break when invoked as "import test.test_pickle" or "import test.autotest".
* Fix SF bug [ #416231 ] urllib.basejoin fails to apply some ../.Guido van Rossum2001-04-151-0/+2
| | | | Reported by Juan M. Bello Rivas.
* Get rid of the seek() method on the _Mailbox class. This was aGuido van Rossum2001-04-151-8/+0
| | | | | | | | | | | | cut-and-paste copy of the seek() method on the _Subfile class, but it didn't make one bit of sense: it sets self.pos, which is not used in this class or its subclasses, and it uses self.start and self.stop, which aren't defined on this class or its subclasses. This is purely my own fault -- I added this in rev 1.4 and apparently never tried to use it. Since it's not documented, and of very questionable use given that there's no tell(), I'm ripping it out. This resolves SF bug 416199 by Andrew Dalke: mailbox.py seek problems.
* In order to make this test work on Windows, the test locale has to beGuido van Rossum2001-04-151-2/+7
| | | | | set to 'en' there -- Windows does not understand the 'en_US' locale. The test succeeds there.
* Fix typo (missing "req." prefix on error_302_dict) found by NeilGuido van Rossum2001-04-151-1/+2
| | | | Norwitz's PyChecker.
* Fix typo in exception name (UnimplementedError should beGuido van Rossum2001-04-151-2/+2
| | | | NotImplementedError) found by Neil Norwitz's PyChecker.
* Fix typo in exception name (SGMLParserError should be SGMLParseError)Guido van Rossum2001-04-151-1/+1
| | | | found by Neil Norwitz's PyChecker.
* Fix typo in attribute name (file should be filename) found byGuido van Rossum2001-04-151-1/+1
| | | | Neil Norwitz's PyChecker.
* Fix typo in attribute name (chunk_size should be chunksize) found byGuido van Rossum2001-04-151-1/+1
| | | | Neil Norwitz's PyChecker.
* - Typo in message for TestCase.failIfEqual()Steve Purcell2001-04-151-2/+1
| | | | - Removed unused variable 'opts' in TestProgram.__init__ (thanks to PyChecker)
* Set the SO_REUSEADDR socket option in the server thread -- this seemsGuido van Rossum2001-04-151-0/+1
| | | | | needed on some platforms (e.g. Solaris 8) when the test is run twice in quick succession.
* Mark Favas points out that there's an 'self.fp.flush()' call in theGuido van Rossum2001-04-141-1/+1
| | | | | | ZipFile.close() method that should be part of the preceding 'if' block. On some platforms (Mark noticed this on FreeBSD 4.2) doing a flush() on a file open for reading is not allowed.
* Pete Shinners discovered that zipfile.ZipFile() is called with modeGuido van Rossum2001-04-141-1/+1
| | | | | argument "wb", while the only valid modes are "r", "w" or "a". Fix this by changing the mode to "w".
* Should resolve [ #416039 ] pstats browser crashes.Eric S. Raymond2001-04-141-3/+3
|
* Add "import thread" at the top of the module; this prevents us fromGuido van Rossum2001-04-142-0/+2
| | | | | failing later when Python is compiled without threading but a failing 'threading' module can be imported due to an earlier (caught) attempt.
* If the sunaudiodev module is available but we cannot find an audioFred Drake2001-04-141-1/+9
| | | | | | | device to use, skip this test instead of allowing an error to occur when we attempt to play sound on the absent device. Verified by Mark Favas.
* Import readline when possible to make the commaninterpreter UI nicer.Eric S. Raymond2001-04-141-0/+4
|
* Added regression test for SF bug #415660 (failure to invalidate allFred Drake2001-04-131-5/+24
| | | | | | references to an object before calling registered callbacks). Change last uses of verify() to self.assert_().
* Fix typo in comment (the module is now called _testcapi, not _test).Guido van Rossum2001-04-131-1/+1
|
* Change error message raised when free variable is not yet bound. ItJeremy Hylton2001-04-131-1/+2
| | | | | | | | | now raises NameError instead of UnboundLocalError, because the var in question is definitely not local. (This affects test_scope.py) Also update the recent fix by Ping using get_func_name(). Replace tests of get_func_name() return value with call to get_func_desc() to match all the other uses.
* One-character style change to appease Netscape stylesheets.Ka-Ping Yee2001-04-131-1/+1
|
* Use nturl2path to generate a file: URL to source files in Windows.Ka-Ping Yee2001-04-131-3/+7
|
* Add test for SF bug #405427Jeremy Hylton2001-04-132-0/+36
|
* SF patch #405845 by Martin von LöwisJeremy Hylton2001-04-131-1/+7
| | | | | | Fixes SF bug #405427. If an http response has a bogus return code, e.g. 400.100, raise BadStatusLine.
* Update to reflect new tokenize_test.pyJeremy Hylton2001-04-131-8/+8
|
* There's no need for the tokenize tests to include a SyntaxError.Jeremy Hylton2001-04-131-1/+1
|
* Clean up isroutine().Ka-Ping Yee2001-04-131-2/+1
|
* Use inspect.stack()[1][3] to tell if Helper.__repr__ is called interactively.Ka-Ping Yee2001-04-131-2/+2
|
* Add inode checks to detect circular symbolic links (so that theKa-Ping Yee2001-04-131-3/+7
| | | | Tools/idle/idlelib link doesn't cause an infinite loop -- aack!)
* Small style change to accommodate Netscape.Ka-Ping Yee2001-04-131-1/+1
|
* Robustify getfile() against classes that lie about their __module__sKa-Ping Yee2001-04-131-1/+1
| | | | (such as the exceptions in _weakref and _locale!)
* Word-wrap the list of cross-references.Ka-Ping Yee2001-04-131-1/+5
|
* Another pass through the topic table to fill in cross references.Ka-Ping Yee2001-04-131-20/+27
| | | | Restore Helper.__repr__ for now.
* Make force-loading optional; don't force-load in interactive mode.Ka-Ping Yee2001-04-131-133/+147
| | | | | | | | Make synopsis() load modules as '__temp__' so they don't clobber anything. Change "constants" section to "data" section. Don't show __builtins__ or __doc__ in "data" section. For Bob Weiner: don't boldface text in Emacs shells or dumb terminals. Remove Helper.__repr__ (it really belongs in site.py, and should be guarded by a check for len(inspect.stack) <= 2).
* Remove duplicate type objects from isroutine() and isbuiltin().Ka-Ping Yee2001-04-131-4/+4
| | | | Make getmodule() on a module return the module itself.
* Patch #415777: new grouping strategy.Martin v. Löwis2001-04-133-10/+68
| | | | | | | | | fixes bug #414940, and redoes the fix for #129417 in a different way. It also fixes a number of other problems with locale-specific formatting: If there is leading or trailing spaces, then no grouping should be applied in the spaces, and the total length of the string should not be changed due to grouping. Also added test case which works only if the en_US locale is available.
* Whitespace normalization.Tim Peters2001-04-132-2/+1
|
* Added a test main to the pstats library that can help you browse profile dumps.Eric S. Raymond2001-04-131-0/+126
|