Commit Graph

3571 Commits

Author SHA1 Message Date
Michael W. Hudson 3079391b8d Just remove the #include of signal.h. That it was C++-commented out
was a mistake of mine in updating patch #975056 (I think).
2004-10-14 13:27:14 +00:00
Neal Norwitz f7c8d9320b Use C89 style comment for old compilers 2004-10-14 03:48:30 +00:00
Martin v. Löwis 9171f02132 Synchronize with PyXML 1.79:
73: Restore support for Python 2.1.
74: Factor the previous change differently
79: Conditionalize usage of PyTuple_Pack.
2004-10-13 19:50:11 +00:00
Anthony Baxter 8a560dee72 Patch 977343, Solaris likes sys/loadavg.h. Added support for sys/loadavg.h
detection to configure &c.
2004-10-13 15:30:56 +00:00
Anthony Baxter 9ceaa72ebe Patch #975056 - fixes for restartable signals on *BSD. In addition,
a few remaining calls to signal() were converted to PyOS_setsig().
2004-10-13 14:48:50 +00:00
Raymond Hettinger dcb9d9467c Simplify delitem() code by calling rotate() directly instead of using
arguments passed through tuples.
2004-10-09 16:02:18 +00:00
Michael W. Hudson 8da2b01c3f This is Michiel de Hoon's patch, as attached to the bug report:
[ 1030629 ] PyOS_InputHook broken

with a couple of utterly inconsequential changes by me.
2004-10-07 13:46:33 +00:00
Raymond Hettinger db29e0fe8c SF patch #1035498: -m option to run a module as a script
(Contributed by Nick Coghlan.)
2004-10-07 06:46:25 +00:00
Raymond Hettinger c5fa992069 Armin's patch to prevent overflows. 2004-10-06 17:51:54 +00:00
Armin Rigo 974d757af1 Upon insertion, if memory runs out, the deque was left in a corrupted state.
deque_item(): a performance bug: the linked list of blocks was followed
from the left in most cases, because the test (i < (deque->len >> 1)) was
after "i %= BLOCKLEN".

deque_clear(): replaced a call to deque_len() with deque->len; not sure what
this call was here for, nor if all compilers under the sun would inline it.

deque_traverse(): I belive that it could be called by the GC when the deque
has leftblock==rightblock==NULL, because it is tracked before the first block
is allocated (though closely before).  Still, a C extension module subclassing
deque could provide its own tp_alloc that could trigger a GC collection after
the PyObject_GC_Track()...

deque_richcompare(): rewrote to cleanly check for end-of-iterations instead of
relying on deque.__iter__().next() to succeed exactly len(deque) times -- an
assumption which can break if deques are subclassed.  Added a test.

I wonder if the length should be explicitely bounded to INT_MAX, with
OverflowErrors, as in listobject.c.  On 64-bit machines, adding more than
INT_MAX in the deque will result in trouble.  (Note to anyone/me fixing
this: carefully check for overflows if len is close to INT_MAX in the
following functions: deque_rotate(), deque_item(), deque_ass_item())
2004-10-02 13:59:34 +00:00
Raymond Hettinger 880430e2a5 Replace structure member before decreffing. 2004-10-02 10:56:43 +00:00
Raymond Hettinger d1b3d88bf3 * Bulletproof the method for detecting mutations during iteration.
The previous approach was too easily fooled (a rotate() sufficed).

* Use it->counter to determine when iteration is complete.  The
  previous approach was too complex.

* Strengthen an assertion and add a comment here or there.
2004-10-02 00:43:13 +00:00
Raymond Hettinger 77e8bf1ca4 Restore the block length and add a comment. 2004-10-01 15:25:53 +00:00
Raymond Hettinger 4ca4c7c8cc Clarify the relationship between indices. 2004-10-01 15:14:39 +00:00
Raymond Hettinger 61f05fb96d * Elaborate on the invariant comments and make them more precise.
* Change the centering by one to make it possible to test the module
  with BLOCKLEN's as low as two.  Testing small blocks makes end-point
  errors surface more readily.
2004-10-01 06:24:12 +00:00
Tim Peters 10c7e86454 deque_traverse(): If the deque had one block, and its rightindex was
BLOCKLEN-1, this assert-failed in a debug build, or went wild with a
NULL pointer in a release build.  Reported on c.l.py by Stefan Behnel.
2004-10-01 02:01:04 +00:00
Tim Peters d6e0032768 Typos in new comments. 2004-10-01 01:35:54 +00:00
Tim Peters d8768d3294 Document some reverse-engineered invariants and pragmatic hints. 2004-10-01 01:32:53 +00:00
Tim Peters 6f85356ff7 Definition consistency. 2004-10-01 01:04:50 +00:00
Tim Peters 1065f750cb Trimmed trailing whitespace. 2004-10-01 01:03:29 +00:00
Raymond Hettinger 4cda01e260 * Increase test coverage.
* Have groupby() be careful about decreffing structure members.
2004-09-28 04:45:28 +00:00
Raymond Hettinger 87de0ca741 Silence a compiler warning by supplying the correct argument type to
the htons() function.
2004-09-28 02:19:40 +00:00
Raymond Hettinger 855d9a985b Plug a leak and beef-up test coverage. 2004-09-28 00:03:54 +00:00
Armin Rigo b6aa856f25 Patch #1009075, bug #952953: allow execve with empty 2nd argument 2004-09-27 19:54:33 +00:00
Armin Rigo 9f90439817 Patch #1011240: SystemError generated by struct.pack('P', 'foo'). 2004-09-27 19:27:51 +00:00
Raymond Hettinger 9447874131 Add docstrings for regular expression objects and methods. 2004-09-24 04:31:19 +00:00
Tim Peters 528ca53b74 SF bug #1028306: date-datetime comparison
Treat comparing a date to a datetime like a mixed-type comparison.
2004-09-16 01:30:50 +00:00
Trent Mick 8ea5bdf784 Patch for compilation on IRIX from rwgk on http://python.org/sf/728330 2004-09-13 17:48:41 +00:00
Walter Dörwald 69652035bc SF patch #998993: The UTF-8 and the UTF-16 stateful decoders now support
decoding incomplete input (when the input stream is temporarily exhausted).
codecs.StreamReader now implements buffering, which enables proper
readline support for the UTF-16 decoders. codecs.StreamReader.read()
has a new argument chars which specifies the number of characters to
return. codecs.StreamReader.readline() and codecs.StreamReader.readlines()
have a new argument keepends. Trailing "\n"s will be stripped from the lines
if keepends is false. Added C APIs PyUnicode_DecodeUTF8Stateful and
PyUnicode_DecodeUTF16Stateful.
2004-09-07 20:24:22 +00:00
Trent Mick a708d6e3b0 Apply patch from http://python.org/sf/728330 to fix socket module compilation on Solaris 2.6, HP-UX 11, AIX 5.1 and (possibly) some IRIX versions. 2004-09-07 17:48:26 +00:00
Raymond Hettinger 9fd5e9a695 Remove redunandant assertions from last checkin. 2004-09-06 23:02:37 +00:00
Raymond Hettinger 658717ed11 SF #1022953: binascii.a2b_hqx("") raises SystemError
Several functions adopted the strategy of altering a full lengthed
string copy and resizing afterwards.  That would fail if the initial
string was short enough (0 or 1) to be interned.  Interning precluded
the subsequent resizing operation.

The solution was to make sure the initial string was at least two
characters long.

Added tests to verify that all binascii functions do not crater when
given an empty string argument.
2004-09-06 22:58:37 +00:00
Raymond Hettinger 8158e84930 Fix erroneous docstring comment. 2004-09-06 07:04:09 +00:00
Gregory P. Smith 442c9fc376 SF bug 1017405: the keys() values() and items() DB methods were
ignoring their transaction (txn) argument.
2004-09-04 01:36:59 +00:00
Gustavo Niemeyer 0506c64086 Fixing bug #817234, which made SRE get into an infinite loop on
empty final matches with finditer(). New test cases included
for this bug and for #581080.
2004-09-03 18:11:59 +00:00
Raymond Hettinger 75ccea3777 SF patch #1020188: Use Py_CLEAR where necessary to avoid crashes
(Contributed by Dima Dorfman)
2004-09-01 07:02:44 +00:00
Andrew M. Kuchling 4e699d5f95 Remove mpz, rotor, xreadlines modules 2004-08-31 13:50:12 +00:00
Andrew M. Kuchling 57269d0c7c Remove mpz, rotor, xreadlines modules 2004-08-31 13:37:25 +00:00
Anthony Baxter 1a4ddaecc7 SF patch #1007189, multi-line imports, for instance:
"from blah import (foo, bar
baz, bongo)"
2004-08-31 10:07:13 +00:00
Tim Peters d311538a93 win32_urandom(): There's no need to copy the generated byte string, so
don't.
2004-08-30 17:36:46 +00:00
Tim Peters 9b279a8df4 win32_urandom(): pass the function name to PyArg_ParseTuple, for better
error msgs.
2004-08-30 17:10:53 +00:00
Tim Peters 51eba6115d win32_urandom(): Raise ValueError if the argument is negative. 2004-08-30 17:08:02 +00:00
Tim Peters 4ad8217ae9 win32_urandom(): Rewrite to Python C standards (hard tabs, function name
in first column, no parens around return value).
2004-08-30 17:02:04 +00:00
Martin v. Löwis dc3883f671 Patch #934711: Expose platform-specific entropy. 2004-08-29 15:46:35 +00:00
Raymond Hettinger 6ab78cd0c0 SF feature request #992967: array.array objects should support sequences.
Made the constructor accept general iterables.
2004-08-29 07:50:43 +00:00
Brett Cannon 269ab628d7 Fix the spelling of Fredrik Lundh's last name (unless there really is a
"Fredrik Lund" who contributed the code in question).
2004-08-27 05:00:22 +00:00
Dave Cole e8bbfe4e63 Patch #1015012. Improve markup and punctuation in libsocket.tex 2004-08-26 00:51:16 +00:00
Dave Cole 3203efb55f Patch #1014930. Expose current parse location to XMLParser. 2004-08-26 00:37:31 +00:00
Martin v. Löwis b92b7ed9d6 Back out 1.289, which breaks platforms needing addrinfo.h, and
1.293, 1.298, and 1.300, which have tried to fix this for specific
platforms.
2004-08-25 06:24:58 +00:00
Neal Norwitz 1fa040ba73 SF #1015517, get readline to compile with older compilers 2004-08-25 01:20:18 +00:00
Mark Hammond eb619bb80b Fix for [ 1010677 ] thread Module Breaks PyGILState_Ensure(),
and a test case.
When booting a new thread, use the PyGILState API to manage the GIL.
2004-08-24 22:24:08 +00:00
Dave Cole 07fda7e3a0 Updated the socketpair() docstring and documentation to explain that the
default famility is AF_UNIX if defined for the platform, otherwise the
default is AF_INET.
2004-08-23 05:16:23 +00:00
Dave Cole 0fc8575412 Removed unnecessary calls to signal() to ignore SIGPIPE. SIGPIPE is ignored
in initsigs() inside pythonrun.c.
2004-08-23 04:54:53 +00:00
Tim Peters 037b3ee44e Patch 1012740: cStringIO's truncate doesn't
truncate() left the stream position unchanged, which meant the
"truncated" data didn't go away:

>>> io.write('abc')
>>> io.truncate(0)
>>> io.write('xyz')
>>> io.getvalue()
'abcxyz'

Patch by Dima Dorfman.
2004-08-21 06:55:43 +00:00
Martin v. Löwis 701abe745b Fail fatally if strdup fails. 2004-08-20 06:26:59 +00:00
Hye-Shik Chang f5a149a6b6 Bug #1005737, #1007249: Fix several build problems and warnings
found on legacy C compilers of HP-UX, IRIX and Tru64.  (Reported
by roadkill, Richard Townsend, Maik Hertha and Minsik Kim)
2004-08-19 17:49:56 +00:00
Martin v. Löwis 4d4dfb7a2b Patch #1011822: Display errno/strerror for inaccessible files. 2004-08-19 11:07:49 +00:00
Martin v. Löwis 78a8acc55b Patch #914291: Restore locale while readline is running. 2004-08-18 13:34:00 +00:00
Michael W. Hudson 0ccff074cd This is Mark Russell's patch:
[ 1009560 ] Fix @decorator evaluation order

From the description:

Changes in this patch:

- Change Grammar/Grammar to require
newlines between adjacent decorators.

- Fix order of evaluation of decorators
in the C (compile.c) and python
(Lib/compiler/pycodegen.py) compilers

- Add better order of evaluation check
to test_decorators.py (test_eval_order)

- Update the decorator documentation in
the reference manual (improve description
of evaluation order and update syntax
description)

and the comment:

Used Brett's evaluation order (see
http://mail.python.org/pipermail/python-dev/2004-August/047835.html)

(I'm checking this in for Anthony who was having problems getting SF to
talk to him)
2004-08-17 17:29:16 +00:00
Skip Montanaro 6c06cd5ff9 fix a couple problems with the last patch picked up by Michael Hudson 2004-08-16 16:15:13 +00:00
Skip Montanaro e5069019e7 Add get_history_item and replace_history_item functions to the readline
module.  Closes patch #675551.  My apologies to Michal Vitecek for taking so
long to process this.
2004-08-15 14:32:06 +00:00
Johannes Gijsbers 8d3b9dd09c Quote \r\n correctly, remove random indentation (patch #1009384). Thanks
Cherniavsky Beni!
2004-08-15 12:23:10 +00:00
Fred Drake 39689c5c6a make exception propogation more efficient; this avoids having Expat parse
the remaining data in the buffer (which it had done happily without reporting
any results)

this depends on a new feature in Expat added in 1.95.8
2004-08-13 03:12:57 +00:00
Martin v. Löwis 0cb3c63503 Patch #1005568: Use _SC_PAGESIZE on Irix.
Backported to 2.3.
2004-08-12 13:26:56 +00:00
Jason Tishler c246cb76e6 Bug #1001857: socketmodule does not build under cygwin
Restore clean building under Cygwin.
2004-08-09 13:25:59 +00:00
Dave Cole 331708b226 Patch #1003700: Add socketpair function to socket module. 2004-08-09 04:51:41 +00:00
Tim Peters ec8c5a9311 Bug 1003471: Python 1.5.2 security vulnerability still present in 2.3.4
That's the title of the report, but the hole was probably plugged since
Python 2.0.  See corresponding checkin to PC/getpathp.c:  a crucial
precondition for joinpath() was neither documented nor verified, and there
are so many callers with so many conditional paths that no "eyeball
analysis" is satisfactory.  Now Python dies with a fatal error if the
precondition isn't satisfied, instead of allowing a buffer overrun.

NOT TESTED!  The Windows version of the patch was, but not this one.  I
don't feel like waiting for someone to notice the patch I attached to the
bug report.  If it doesn't compile, sorry, but fix it <wink>.  If it
does compile, it's "obviously correct".
2004-08-08 01:00:47 +00:00
Andrew M. Kuchling e5dd162a07 [Bug #923315] Produce correct result on AIX 2004-08-07 17:21:27 +00:00
Fred Drake 283b670f6b add constants for many error values added over the past couple of
years
2004-08-04 22:28:16 +00:00
Michael W. Hudson 5910d81c97 Add a missing decref -- PyErr_SetObject increfs the 'object'! 2004-08-04 14:59:00 +00:00
Michael W. Hudson 7d6cc5b303 Fix a leak of a reference on None. 2004-08-04 14:33:28 +00:00
Hye-Shik Chang e9ddfbb412 SF #989185: Drop unicode.iswide() and unicode.width() and add
unicodedata.east_asian_width().  You can still implement your own
simple width() function using it like this:
    def width(u):
        w = 0
        for c in unicodedata.normalize('NFC', u):
            cwidth = unicodedata.east_asian_width(c)
            if cwidth in ('W', 'F'): w += 2
            else: w += 1
        return w
2004-08-04 07:38:35 +00:00
Tim Peters 51fa3b740f Tkapp_New(): Rewrite in C so it compiles again. 2004-08-04 02:16:48 +00:00
Martin v. Löwis 1fa649f2d5 Patch #986929: Add support for wish -sync and -use options. 2004-08-03 18:45:31 +00:00
Fred Drake f901abdd62 allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
(closes SF bug #658254, patch #663482)
2004-08-03 17:58:55 +00:00
Martin v. Löwis 0b49e02e03 Patch #977074: Move Encode/Decode to the top so gcc can inline them. 2004-08-03 13:08:07 +00:00
Michael W. Hudson 0bb8454ed4 Fix the reference count errors revealed by the test suite... 2004-08-03 11:31:31 +00:00
Raymond Hettinger cbcff93d49 Restore compilation on MSVC++ 6.0 2004-08-03 08:52:46 +00:00
Armin Rigo a41276956d SF bug #808756: refleaks in _hotshot.c. 2004-08-03 08:33:55 +00:00
Fred Drake 31d485c0f5 update to Expat 1.95.8 2004-08-03 07:06:22 +00:00
Mark Hammond a57ec93b93 Fix [ 1001018 ]: Windows: setdefaulttimeout causes unnecessary timeouts on
connect error
2004-08-03 05:06:26 +00:00
Michael W. Hudson c9f510aed2 Any call to insort_{left,right} with a non-list leaked a reference to None
(or to whatever the 'insert' method chose to return).
2004-08-02 13:24:54 +00:00
Anthony Baxter c2a5a63654 PEP-0318, @decorator-style. In Guido's words:
"@ seems the syntax that everybody can hate equally"
Implementation by Mark Russell, from SF #979728.
2004-08-02 06:10:11 +00:00
Neal Norwitz 014f103705 SF bug #999776, zlib home page wrong
Backport candidate.
2004-07-29 03:55:56 +00:00
Hye-Shik Chang eb34110190 Remove CJKCodecs implementation of UTF-7 and UTF-8 codec which
aren't intended to be part of Python distributiuon.  This was
accidently imported on mass converting from standalone version of
CJKCodecs.
2004-07-28 09:36:52 +00:00
Martin v. Löwis b600fe90a7 Switch arguments to memset (kudos to MSVC C4318 for finding that) 2004-07-27 15:03:53 +00:00
Martin v. Löwis 544f1195b1 Patch #995766: Keyword argument support in cPickle. 2004-07-27 05:22:33 +00:00
Gustavo Niemeyer 7bd33c5e22 This change implements the following gettext features, as
discussed recently in python-dev:

In _locale module:

- bind_textdomain_codeset() binding

In gettext module:

- bind_textdomain_codeset() function
- lgettext(), lngettext(), ldgettext(), ldngettext(),
  which return translated strings encoded in
  preferred system encoding, if
  bind_textdomain_codeset() was not used.
- Added equivalent functionality in translate()
  function and catalog classes.

Every change was also documented.
2004-07-22 18:44:01 +00:00
Neal Norwitz dc8e1942dd Fix SF #994580, typo in time.tzsets docstring. Backport candidate 2004-07-20 22:34:37 +00:00
Martin v. Löwis 81aec4bb80 Patch #984654: Add more address family constants. 2004-07-19 17:01:20 +00:00
Martin v. Löwis 8fbefe2874 Patch #993173: Enable audioop on 64-bit platforms. 2004-07-19 16:42:20 +00:00
Raymond Hettinger e9c89e8308 Silence a GCC unused variable warning in debug builds. 2004-07-19 00:10:24 +00:00
Hye-Shik Chang 64a9e38f35 Replace an extern magic to assigning declared pointer from array's.
And unifdef(1) compatibility blocks.
2004-07-18 15:02:45 +00:00
Hye-Shik Chang ca455e8bc9 Remove unused CNS-11643 mapping which shouldn't merged into main Python
yet.
2004-07-18 08:35:43 +00:00
Tim Peters 182b5aca27 Whitespace normalization, via reindent.py. 2004-07-18 06:16:08 +00:00
Tim Peters 91380d5f28 Repair MS compiler warning about signed-vs-unsigned mismatch. The plane
and width clearly don't need to be signed.
2004-07-18 04:34:33 +00:00
Tim Peters 7c7b3da46e Added a comment explaining the extern ugliness. 2004-07-18 04:26:10 +00:00
Tim Peters 0f27166e6a Changed the "predefinitions" of codec_list and mapping_list from static
to extern.  It's not legal C to say

     static whatever[];

because the size isn't given.  Presumably this is a gcc extension.
2004-07-18 04:20:15 +00:00
Hye-Shik Chang 2bb146f2f4 Bring CJKCodecs 1.1 into trunk. This completely reorganizes source
and installed layouts to make maintenance simple and easy.  And it
also adds four new codecs; big5hkscs, euc-jis-2004, shift-jis-2004
and iso2022-jp-2004.
2004-07-18 03:06:29 +00:00
Raymond Hettinger 67115a2b02 Apply VISIT macro. 2004-07-15 21:32:18 +00:00