Commit Graph

2276 Commits

Author SHA1 Message Date
Georg Brandl
af55db9cd8 Bug #1177964: make file iterator raise MemoryError on too big files
(backport from rev. 43506)
2006-03-31 20:31:05 +00:00
Anthony Baxter
cb9051a608 after discussions with perky, reverted fix for Bug #1379994: Builtin
unicode_escape and raw_unicode_escape codec now encodes backslash correctly.

This caused another issue for unicode repr strings being double-escaped
(SF Bug #1459029). Correct fix will be in 2.5, but is too risky for 2.4.3.

Added a testcase for #1459029.
2006-03-28 07:32:36 +00:00
Neal Norwitz
55dd2b41e0 Fix the refleak from test_unicode.
Backport 42973 (lots of whitespace changes intermixed):

 - Reindent a confusingly indented piece of code (no intended code changes
    there)
 - Add missing DECREFs of inner-scope 'temp' variable
 - Add various missing DECREFs by changing 'return NULL' into 'goto onError'
 - Avoid double DECREF when last _PyUnicode_Resize() fails

Coverity found one of the missing DECREFs, but oddly enough not the others.
2006-03-28 06:05:21 +00:00
Anthony Baxter
022a55c0d9 update - still some old .cvsignore files lying around 2006-03-23 02:26:07 +00:00
Georg Brandl
d9ca66f2b2 Backport: Fix missing NULL checks after PyTuple_New, PyList_New, PyDict_New 2006-03-17 19:04:15 +00:00
Neal Norwitz
9165680203 Backport 43022:
Fix and test (manually w/xx module) passing NULLs to PyObject_Str() and
PyObject_Unicode().  This problem was originally reported from Coverity
and addresses mail on python-dev "checkin r43015".

This inlines the conversion of the string to unicode and cleans
up/simplifies some code at the end of the PyObject_Unicode().

We really need a complete C API test module for all public APIs
and passing good and bad parameter values.
2006-03-14 06:10:22 +00:00
Georg Brandl
2f014f8d0b Fix bug found by Coverity: don't allow NULL argument to PyUnicode_CheckExact
(backport from rev. 43014)
2006-03-13 22:22:15 +00:00
Hye-Shik Chang
361cd4bd6c Backport r42894: SF #1444030 Fix several potential defects found
by Coverity.
2006-03-07 15:59:09 +00:00
Armin Rigo
0b61a45223 Backported from r41842. 2006-02-20 10:21:14 +00:00
Neal Norwitz
a3b5e99d8d Fix SF #1412837, compile failed with Watcom compiler 2006-01-24 06:08:23 +00:00
Neal Norwitz
7fb3aa7b3c Backport:
- Patch #1400181, fix unicode string formatting to not use the locale.
  This is how string objects work.  u'%f' could use , instead of .
  for the decimal point.  Now both strings and unicode always use periods.

This is the code that would break:

    import locale
    locale.setlocale(locale.LC_NUMERIC, 'de_DE')
    u'%.1f' % 1.0
    assert '1.0' == u'%.1f' % 1.0

I couldn't create a test case which fails, but this fixes the problem.
(tested in interpreter and reported fixed by others)
2006-01-10 06:05:57 +00:00
Hye-Shik Chang
cb92b45e41 Bug #1379994: Fix *unicode_escape codecs to encode r'\' as r'\\'
just like string codecs.
2005-12-17 04:38:31 +00:00
Walter Dörwald
cff983722a Backport checkin:
Fix leaked reference to None.
2005-11-28 22:16:22 +00:00
Neal Norwitz
c2b4acf494 Backport: SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc. 2005-10-20 04:16:45 +00:00
Guido van Rossum
b693c1cea0 - On 64-bit platforms, when __len__() returns a value that cannot be
represented as a C int, raise OverflowError.
(Will forward-port.)
2005-09-20 16:36:07 +00:00
Georg Brandl
39871c8927 backport patch [ 1118729 ] Error in representation of complex numbers(again) 2005-09-16 06:42:32 +00:00
Walter Dörwald
fd8e0170e2 Backport checkin:
SF bug #1251300: On UCS-4 builds the "unicode-internal" codec will now complain
about illegal code points. The codec now supports PEP 293 style error handlers.
(This is a variant of the patch by Nik Haldimann that detects truncated data)
2005-08-30 10:46:06 +00:00
Georg Brandl
66e75ac6e0 Disallow keyword arguments for type constructors that don't use them
(fixes #1119418).
2005-08-26 06:43:16 +00:00
Raymond Hettinger
9314d3261d SF bug #1242657: list(obj) can swallow KeyboardInterrupt
Fix over-aggressive PyErr_Clear().  The same code fragment appears in
various guises in list.extend(), map(), filter(), zip(), and internally
in PySequence_Tuple().
2005-08-21 11:09:58 +00:00
Raymond Hettinger
ab294199b7 Teach set modules to correctly compute s-=s and s^=s as the empty set. 2005-08-13 02:28:54 +00:00
Raymond Hettinger
787b4c5fea * SF bug #1257731: Fix logic in set.__contains__(), set.remove(),
and set.discard for handling keys that both inherite from set and
  define their own __hash__() function.

* Fixed O(n) performance issue with set.pop() which should have been
  an O(1) process.
2005-08-12 23:47:50 +00:00
Georg Brandl
7f94414485 backporting fix by tim_one:
"""
SF bug #1238681:  freed pointer is used in longobject.c:long_pow().

In addition, long_pow() skipped a necessary (albeit extremely unlikely
to trigger) error check when converting an int modulus to long.

Alas, I was unable to write a test case that crashed due to either
cause.
"""
2005-07-18 07:24:37 +00:00
Georg Brandl
b3d587184c Backport:
SF bug 1185883:  PyObject_Realloc can't safely take over a block currently
managed by C, because it's possible for the block to be smaller than the
new requested size, and at the end of allocated VM.  Trying to copy over
nbytes bytes to a Python small-object block can segfault then, and there's
no portable way to avoid this (we would have to know how many bytes
starting at p are addressable, and std C has no means to determine that).
2005-07-11 05:57:11 +00:00
Raymond Hettinger
8f7dce605f SF patch #1200018: Restore GC support to set objects
Reverts 1.26 and 1.27.
And adds cycle testing.
2005-06-19 05:53:15 +00:00
Anthony Baxter
d855c5888e fix int.__divmod__.__doc__ 2005-06-03 14:13:47 +00:00