summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Optimize dict.fromkeys() with dict inputs. Useful for resetting bag/muliset ↵Raymond Hettinger2007-11-071-0/+19
| | | | counts for example.
* Add missing "return NULL" in overflow check in PyObject_Repr().Guido van Rossum2007-11-061-0/+1
|
* Backport fixes for the code that decodes octal escapes (and for PyStringGuido van Rossum2007-10-292-7/+12
| | | | | | | also hex escapes) -- this was reaching beyond the end of the input string buffer, even though it is not supposed to be \0-terminated. This has no visible effect but is clearly the correct thing to do. (In 3.0 it had a visible effect after removing ob_sstate from PyString.)
* Fix the overflow checking of list_repeat.Armin Rigo2007-10-171-4/+7
| | | | | | Introduce overflow checking into list_inplace_repeat. Backport candidate, possibly.
* Remove file-level typedefs that were inconsistently used throughout the file.Brett Cannon2007-10-101-105/+103
| | | | | | Just move over to the public API names. Closes issue1238.
* Coverity #151: Remove deadcode.Neal Norwitz2007-10-041-13/+0
| | | | All this code already exists above starting at line 653.
* enumerate() is no longer bounded to using sequences shorter than LONG_MAX. ↵Raymond Hettinger2007-10-031-6/+49
| | | | The possibility of overflow was sending some newsgroup posters into a tizzy.
* Fix error introduced by r58288; if a tuple is length 0 return its repr andBrett Cannon2007-09-301-4/+4
| | | | don't worry about any self-referring tuples.
* tuple.__repr__ did not consider a reference loop as it is not possible fromBrett Cannon2007-09-302-0/+18
| | | | | | | | | | Python code; but it is possible from C. object.__str__ had the issue of not expecting a type to doing something within it's tp_str implementation that could trigger an infinite recursion, but it could in C code.. Both found thanks to BaseException and how it handles its repr. Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at coming up with a solution.
* Patch # 188 by Philip Jenvey.Guido van Rossum2007-09-221-0/+1
| | | | | Make tell() mark CRLF as a newline. With unit test.
* Issue #1772851. Alters long.__hash__ from being *almost* completelyFacundo Batista2007-09-191-0/+8
| | | | | | | predictable to being completely predictable. The value of hash(n) is unchanged for any n that's small enough to be representable as an int, and also unchanged for the vast majority of long integers n of reasonable size.
* Properly indent two lines. (Spotted because it caused merge conflicts in theThomas Wouters2007-09-181-2/+2
| | | | py3k branch ;)
* Add a bunch of GIL release/acquire points in tp_print implementations and forBrett Cannon2007-09-1711-7/+66
| | | | | | PyObject_Print(). Closes issue #1164.
* Generators had their throw() method allowing string exceptions. That's aBrett Cannon2007-09-111-4/+1
| | | | | | | no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in.
* Patch # 1026 by Benjamin Aranguren (with Alex Martelli):Guido van Rossum2007-09-101-0/+40
| | | | | | | | Backport abc.py and isinstance/issubclass overloading to 2.6. I had to backport test_typechecks.py myself, and make one small change to abc.py to avoid duplicate work when x.__class__ and type(x) are the same.
* Fix a possible segfault from recursing too deep to get the repr of a list.Brett Cannon2007-09-101-0/+3
| | | | Closes issue #1096.
* Fix a crasher where Python code managed to infinitely recurse in C code withoutBrett Cannon2007-09-073-10/+34
| | | | | | | ever going back out to Python code in PyObject_Call(). Required introducing a static RuntimeError instance so that normalizing an exception there is no reliance on a recursive call that would put the exception system over the recursion check itself.
* Set startinpos before calling the error handler.Walter Dörwald2007-08-301-0/+1
|
* Rewrap line.Walter Dörwald2007-08-301-1/+2
|
* Improve extended slicing support in builtin types and classes. Specifically:Thomas Wouters2007-08-286-15/+261
| | | | | | | | | | | | | | | | | | | | - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality.
* Revert accidental checkins from last commit.Georg Brandl2007-08-211-32/+6
|
* Demand version 2.5.1 since 2.5 has a bug with codecs.open context managers.Georg Brandl2007-08-211-6/+32
|
* Move another variable declaration up.Walter Dörwald2007-08-171-2/+2
|
* Move variable declaration up.Walter Dörwald2007-08-171-6/+6
|
* Backport r57105 and r57145 from the py3k branch: UTF-32 codecs.Walter Dörwald2007-08-171-0/+266
|
* Bug #1763149: use proper slice syntax in docstring.Georg Brandl2007-07-292-4/+4
| | | | (backport)
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-2131-611/+557
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Patch #1673759: add a missing overflow check when formatting floatsGeorg Brandl2007-07-122-2/+4
| | | | with %G.
* Add T_PYSSIZET in structmember.h: This can be used forWalter Dörwald2007-06-131-166/+102
| | | | | | | | | Py_ssize_t members. Simplify the implementation of UnicodeError objects: start and end attributes are now stored directly as Py_ssize_t members, which simplifies various get and set functions.
* Fix a bug when there was a newline in the string expandtabs was called on.Neal Norwitz2007-06-112-4/+16
| | | | | | This also catches another condition that can overflow. Will backport.
* Prevent expandtabs() on string and unicode objects from causing a segfault whenNeal Norwitz2007-06-092-6/+28
| | | | | | | a large width is passed on 32-bit platforms. Found by Google. It would be good for people to review this especially carefully and verify I don't have an off by one error and there is no other way to cause overflow.
* Bug #1733488: Fix compilation of bufferobject.c on AIX.Martin v. Löwis2007-06-081-1/+1
| | | | Will backport to 2.5.
* Add the new function object attribute names from py3k.Neal Norwitz2007-05-271-3/+10
|
* Whitespace cleanupNeal Norwitz2007-05-231-1/+1
|
* Add -3 option to the interpreter to warn about features that areNeal Norwitz2007-05-232-2/+13
| | | | | | | deprecated and will be changed/removed in Python 3.0. This patch is mostly from Anthony. I tweaked some format and added a little doc.
* Stop using METH_OLDARGS implicitlyNeal Norwitz2007-05-221-1/+1
|
* Complete deprecation of BaseException.message. Some subclasses were directlyBrett Cannon2007-05-171-10/+0
| | | | accessing the message attribute instead of using the descriptor.
* Port rev 55353 from Guido:Neal Norwitz2007-05-161-1/+1
| | | | | | | Add what looks like a necessary call to PyErr_NoMemory() when PyMem_MALLOC() fails. Will backport.
* Fix a bug in test_c_api() that caused a negative refcount.Guido van Rossum2007-05-101-3/+3
|
* As per Armin Rigo's suggestion, remove special handing from intobject.c to ↵Kristján Valur Jónsson2007-05-072-8/+15
| | | | deal with the peculiarities of classobject's implementation of the number protocol. The nb_long method of classobject now falls back to nb_int if there is no __long__ attribute present.
* Deprecate BaseException.message as per PEP 352.Brett Cannon2007-05-051-8/+34
|
* Fix problems in x64 build that were discovered by the testsuite:Kristján Valur Jónsson2007-05-032-1/+5
| | | | | | | | | | | | - Reenable modules on x64 that had been disabled aeons ago for Itanium. - Cleared up confusion about compilers for 64 bit windows. There is only Itanium and x64. Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above. - Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms. - Fixed thread_nt.h. The emulated InterlockedCompareExchange function didn´t work on x64, probaby due to the lack of a "volatile" specifier. Anyway, win95 is no longer a target platform. - Itertools module used wrong constant to check for overflow in count() - PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member. - PyLong_FromSsize_t() incorrectly specified that the operand were unsigned. With these changes, the x64 passes the testsuite, for those modules present.
* Remove dead code. This code couldn't be reached because earlier inNeal Norwitz2007-05-031-12/+1
| | | | the function there is another check for z != Py_None.
* Fix for #1303614 and #1174712:Armin Rigo2007-05-021-4/+85
| | | | | | | - __dict__ descriptor abuse for subclasses of built-in types - subclassing from both ModuleType and another built-in types Thanks zseil for the patch.
* Export function sanitize_the_mode from fileobject.c as ↵Kristján Valur Jónsson2007-04-261-8/+7
| | | | _PyFile_SanitizeMode(). Use this function in posixmodule.c when implementing fdopen(). This fixes test_subprocess.py for a VisualStudio 2005 compile.
* Fix a usage of the dangerous pattern decref - modify field - incref.Armin Rigo2007-04-191-2/+3
|
* Revert r53997 as perArmin Rigo2007-04-191-94/+32
| | | | | | | | | http://mail.python.org/pipermail/python-dev/2007-March/071796.html . I've kept a couple of still-valid extra tests in test_descr, but didn't bother to sort through the new comments and refactorings added in r53997 to see if some of them could be kept. If so, they could go in a follow-up check-in.
* Silence a compiler warning about incompatible pointer types.Brett Cannon2007-04-191-1/+1
|
* When __slots__ are set to a unicode string, make it work the same asNeal Norwitz2007-04-141-1/+1
| | | | setting a plain string, ie don't expand to single letter identifiers.
* Fix a bug when using the __lltrace__ opcode tracer, and a problem sith ↵Kristján Valur Jónsson2007-04-131-2/+2
| | | | signed chars in frameobject.c which can occur with opcodes > 127