summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* Add sendall() method, which loops until all data is written or anGuido van Rossum2001-10-261-2/+44
| | | | | | | error occurs, and doesn't return a count. (This is my second patch from SF patch #474307, with small change to the docstring for send().) 2.1.2 "bugfix" candidate.
* Fix SF bug #474538: Memory (reference) leak in poller.register (Dave Brueck)Guido van Rossum2001-10-251-3/+13
| | | | | | | | Replace some tortuous code that was trying to be clever but forgot to DECREF the key and value, by more longwinded but obviously correct code. (Inspired by but not copying the fix from SF patch #475033.)
* After discussion with itojun, it was clarified that Tru64 is in error,Martin v. Löwis2001-10-251-1/+3
| | | | and that the work-around should be restricted to that system.
* (experimental) "finditer" method/function. this works pretty muchFredrik Lundh2001-10-241-0/+28
| | | | | like findall, but returns an iterator (which returns match objects) instead of a list of strings/tuples.
* SF patch #474590 -- RISC OS supportGuido van Rossum2001-10-244-38/+23
|
* Fix typo. Thanks to Jack Jansen for spotting it.Martin v. Löwis2001-10-241-1/+1
|
* Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED andMartin v. Löwis2001-10-241-7/+40
| | | | | | STRICT_SYSV_CURSES when compiling curses module on HP/UX. Generalize access to _flags on systems where WINDOW is opaque. Fixes bugs #432497, #422265, and the curses parts of #467145 and #473150.
* Include netdb.h to detect getaddrinfo. Work around problem with getaddrinfoMartin v. Löwis2001-10-241-0/+6
| | | | not properly processing numeric IPv4 addresses. Fixes V5.1 part of #472675.
* Added missing cast.Jack Jansen2001-10-231-1/+1
|
* Got this to work in MacPython. The code is #ifdef macintosh style (to match ↵Jack Jansen2001-10-231-2/+10
| | | | the existing #ifdef MS_WINDOWS), but eventually ifdeffing on configure features is probably better.
* Convert the ref() and proxy() implementations to use the newFred Drake2001-10-231-2/+2
| | | | PyArg_UnpackTuple() function (serves as an example and test case).
* another major speedup: let sre.sub/subn check for escapes in theFredrik Lundh2001-10-221-30/+89
| | | | | template string, and don't call the template compiler if we can avoid it.
* sre.split should return the last segment, even if emptyFredrik Lundh2001-10-221-11/+10
| | | | (sorry, barry)
* Adding missing "static" declarations (found by "make smelly").Neil Schemenauer2001-10-212-2/+2
|
* fixed character set description in docstring (SRE uses PythonFredrik Lundh2001-10-211-96/+41
| | | | | | | | | | | | | | | | | strings, not C strings) removed USE_PYTHON defines, and related sre.py helpers skip calling the subx helper if the template is callable. interestingly enough, this means that def callback(m): return literal result = pattern.sub(callback, string) is much faster than result = pattern.sub(literal, string)
* sre.Scanner fixes (from Greg Chapman). also added a Scanner sanityFredrik Lundh2001-10-211-0/+17
| | | | | | check to the test suite. added a few missing exception checks in the _sre module
* rewrote the pattern.sub and pattern.subn methods in CFredrik Lundh2001-10-211-113/+306
| | | | | | | | | removed (conceptually flawed) getliteral helper; the new sub/subn code uses a faster code path for literal replacement strings, but doesn't (yet) look for literal patterns. added STATE_OFFSET macro, and use it to convert state.start/ptr to char indexes
* Change clear_handlers argument to indicate whether this is an initialization.Martin v. Löwis2001-10-211-9/+10
| | | | Do not set the Expat handlers if it is. Fixes PyXML bug #473195.
* rewrote the pattern.split method in CFredrik Lundh2001-10-201-12/+136
| | | | also restored SRE Unicode support for 1.6/2.0/2.1
* Add two forgotten 'break' statementsAndrew M. Kuchling2001-10-201-15/+40
| | | | | | | | Allow passing strings to the .border() method Correct some error messages ("1 or 4" -> "1 to 4") Bump version number Tweak code formatting Update my e-mail address
* (Hopefully) fix SF bug #472675: CVS socketmodule now doesn't compileGuido van Rossum2001-10-191-1/+1
| | | | | This appears to be a case of a missing \n\ in a multiline string literal.
* SF patch #460805 by Chris Gonnerman: Support for unsetenv()Guido van Rossum2001-10-191-0/+34
| | | | | | | | 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?)
* SF patch #443759: Add Interface to readline's add_historyGuido van Rossum2001-10-191-0/+18
| | | | | | | | | | | | | | 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.
* Expose O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW.Martin v. Löwis2001-10-181-0/+17
|
* Don't leave bare newlines in long strings -- VC doesn't like that.Guido van Rossum2001-10-181-3/+3
|
* SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.Guido van Rossum2001-10-182-78/+227
| | | | | | | | | | | | | | | | | 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.)
* Shut up warnings for setgroups() on Linux -- you have to #includeGuido van Rossum2001-10-181-0/+5
| | | | <grp.h> it seems. This requires yet another configure test.
* SRE bug #441409:Fredrik Lundh2001-10-181-1/+3
| | | | | | | | compile should raise error for non-strings SRE bug #432570, 448951: reset group after failed match also bumped version number to 2.2.0
* Expose setgroups. Fixes feature request #468116.Martin v. Löwis2001-10-181-0/+48
|
* Expose three OpenSSL API calls for dealing with the PRNG.Jeremy Hylton2001-10-181-0/+67
| | | | | | | | | | | | | | | | | 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.
* The Python symtable module depends on .h files that setup.py doesn't track.Jeremy Hylton2001-10-171-0/+3
|
* Remove unused convenience routine.Jeremy Hylton2001-10-171-19/+0
|
* Simplify and regularize docstrings. Also reformat so that each docstringTim Peters2001-10-171-52/+47
| | | | line fits in reasonable screen width.
* Trimmed trailing whitespace.Tim Peters2001-10-171-62/+62
|
* Removed more comments that didn't make much sense.Tim Peters2001-10-171-17/+1
| | | | Made the presence/absence of a semicolon after macros consistent.
* Removed obsolete comments about confused string refcount tricks (JeremyTim Peters2001-10-171-9/+4
| | | | | | | 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).
* Undo needless INCREF chicanery introduced by SF patch #450702.Jeremy Hylton2001-10-161-47/+15
| | | | | | | | | | | | | | 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>.
* Simplify and fix error handling for most cases.Jeremy Hylton2001-10-161-167/+113
| | | | | | | | | | | | | | | | | | 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.
* More reformatting.Jeremy Hylton2001-10-161-51/+50
|
* Add zlib_error() helper.Jeremy Hylton2001-10-161-92/+25
| | | | | It sets a ZlibError exception, using the msg from the z_stream pointer if one is available.
* Remove many calls to set MemoryError exceptions.Jeremy Hylton2001-10-161-28/+4
| | | | | When PyString_FromStringAndSize() and _PyString_Resize() fail, they set an exception. There's no need to set a new exception.
* Reformat!Jeremy Hylton2001-10-161-586/+576
| | | | | | Consistently indent 4 spaces. Use whitespace around operators. Put braces in the right places.
* Partial patch from SF #452266, by Jason Petrone.Guido van Rossum2001-10-161-9/+10
| | | | | | 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.)
* [ #403753 ] zlib decompress; uncontrollable memory usageJeremy Hylton2001-10-161-10/+64
| | | | | | | | | | | | | Mostly by Toby Dickenson and Titus Brown. Add an optional argument to a decompression object's decompress() method. The argument specifies the maximum length of the return value. If the uncompressed data exceeds this length, the excess data is stored as the unconsumed_tail attribute. (Not to be confused with unused_data, which is a separate issue.) Difference from SF patch: Default value for unconsumed_tail is "" rather than None. It's simpler if the attribute is always a string.
* Must terminate the Pickler_members[] and Pickler_getsets with NULL.Jeremy Hylton2001-10-161-1/+3
|
* Removed useless code to count the number of calls into the profiler.Fred Drake2001-10-151-51/+177
| | | | | | | | | | | Added support for saving the names of the functions observed into the profile log. Added support for using the profiler to measure coverage without collecting timing information (which is the slow part). Coverage logs can also be substantially smaller than profiling logs where per-line information is being collected. Updated comments on the log format; corrected record type values in some of the record descriptions.
* Better fix for core dumps on recursive objects in fast mode.Jeremy Hylton2001-10-151-32/+64
| | | | | | | | | | | | | | | | | | | Raise ValueError when an object contains an arbitrarily nested reference to itself. (The previous fix just produced invalid pickles.) Solution is very much like Py_ReprEnter() and Py_ReprLeave(): fast_save_enter() and fast_save_leave() that tracks the fast_container limit and keeps a fast_memo of objects currently being pickled. The cost of the solution is moderately expensive for deeply nested structures, but it still seems to be faster than normal pickling, based on tests with deeply nested lists. Once FAST_LIMIT is exceeded, the new code is about twice as slow as fast-mode code that doesn't check for recursion. It's still twice as fast as the normal pickling code. In the absence of deeply nested structures, I couldn't measure a difference.
* Remove a couple of tp_xxx fields that you are not expected toGuido van Rossum2001-10-151-5/+0
| | | | initialize (or use or even know about :-).
* Fix a bunch of warnings reported by Skip.Guido van Rossum2001-10-151-8/+8
| | | | | | | To whoever who changed a bunch of (PyCFunction) casts to (PyNoArgsFunction) in PyMethodDef initializers: don't do that. The cast is to shut the compiler up. The compiler wants the function pointer initializer to be a PyCFunction.
* Very subtle syntax change: in a list comprehension, the testlist inGuido van Rossum2001-10-151-1/+9
| | | | | | | | | | | | | | | "for <var> in <testlist> may no longer be a single test followed by a comma. This solves SF bug #431886. Note that if the testlist contains more than one test, a trailing comma is still allowed, for maximum backward compatibility; but this example is not: [(x, y) for x in range(10), for y in range(10)] ^ The fix involved creating a new nonterminal 'testlist_safe' whose definition doesn't allow the trailing comma if there's only one test: testlist_safe: test [(',' test)+ [',']]