summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* 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
* SF 1193128: Let str.translate(None) be an identity transformationRaymond Hettinger2007-04-121-8/+16
|
* SF 1191699: Make slices picklableRaymond Hettinger2007-04-111-0/+10
|
* Add some missing NULL checks which trigger crashes on low-memory conditions.Georg Brandl2007-04-112-0/+10
| | | | Found by Victor Stinner. Will backport when 2.5 branch is unfrozen.
* Add a type.__init__() method that enforces the same signature asGuido van Rossum2007-03-231-1/+34
| | | | | | | | | type.__new__(), and then calls object.__init__(cls), just to be anal. This allows us to restore the code in string.py's _TemplateMetaclass that called super(...).__init__(name, bases, dct), which I commented out yesterday since it broke due to the stricter argument checking added to object.__init__().
* - Bug #1683368: The object.__init__() and object.__new__() methods areGuido van Rossum2007-03-231-12/+88
| | | | | | | | | | | | | now stricter in rejecting excess arguments. The only time when either allows excess arguments is when it is not overridden and the other one is. For backwards compatibility, when both are overridden, it is a deprecation warning (for now; maybe a Py3k warning later). When merging this into 3.0, the warnings should become errors. Note: without the change to string.py, lots of spurious warnings happen. What's going on there?
* Add test and fix for fromkeys() optional argument.Raymond Hettinger2007-03-211-2/+2
|
* Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() ↵Raymond Hettinger2007-03-202-2/+36
| | | | calls and fixing set/dict interoperability.
* Patch #1675423: PyComplex_AsCComplex() now tries to convert an objectGeorg Brandl2007-03-171-1/+48
| | | | | | | to complex using its __complex__() method before falling back to the __float__() method. Therefore, the functions in the cmath module now can operate on objects that define a __complex__() method. (backport)
* Remove warning: funcion declaration isn't a prototypeJeremy Hylton2007-03-161-2/+1
|
* Patch #1623563: allow __class__ assignment for classes with __slots__.Žiga Seilnacht2007-03-161-4/+27
| | | | | The old and the new class are still required to have the same slot names, but the order in which they are specified is not relevant.
* Patch #1462488: prevent a segfault in object_reduce_ex() by splittingŽiga Seilnacht2007-03-151-14/+47
| | | | | the implementation for __reduce__ and __reduce_ex__ into two separate functions. Fixes bug #931877. Will backport.
* Patch #1680015: Don't modify __slots__ tuple if it contains an unicodeŽiga Seilnacht2007-03-141-16/+20
| | | | | name. Remove a reference leak that happened if the name could not be converted to string. Will backport.
* Patch #1642844: comments to clarify the complexobject constructor.Georg Brandl2007-03-131-4/+25
|
* Typo and grammar fixes.Georg Brandl2007-03-131-3/+3
|
* Backport from Py3k branch:Georg Brandl2007-03-121-96/+169
| | | | | | | Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir. Had to change a few bits of the patch because classobjs and __methods__ are still in Py2.6.
* Patch #1675981: remove unreachable code from type.__new__() method.Žiga Seilnacht2007-03-111-7/+5
| | | | | __dict__ and __weakref__ are removed from the slots tuple earlier in the code, in the loop that mangles slot names. Will backport.
* Patch #1491866: change the complex() constructor to allow parthensized ↵Collin Winter2007-03-091-5/+25
| | | | forms. This means complex(repr(x)) now works instead of raising a ValueError.
* Fix SF #1676971, Complex OverflowError has a typoNeal Norwitz2007-03-091-1/+1
|
* Patch #1638879: don't accept strings with embedded NUL bytes in long().Georg Brandl2007-03-061-1/+18
|
* Add checking for a number of metaclass error conditions.Jeremy Hylton2007-02-271-32/+94
| | | | | | | | | | | | | | | | | | | | | | | We add some new rules that are required for preserving internal invariants of types. 1. If type (or a subclass of type) appears in bases, it must appear before any non-type bases. If a non-type base (like a regular new-style class) occurred first, it could trick type into allocating the new class an __dict__ which must be impossible. 2. There are several checks that are made of bases when creating a type. Those checks are now repeated when assigning to __bases__. We also add the restriction that assignment to __bases__ may not change the metaclass of the type. Add new tests for these cases and for a few other oddball errors that were no previously tested. Remove a crasher test that was fixed. Also some internal refactoring: Extract the code to find the most derived metaclass of a type and its bases. It is now needed in two places. Rewrite the TypeError checks in test_descr to use doctest. The tests now clearly show what exception they expect to see.
* whitespace normalizationJeremy Hylton2007-02-271-82/+82
|
* tabifyJeremy Hylton2007-02-271-97/+97
|
* Fix assertion.Jeremy Hylton2007-02-261-2/+2
|
* Do not copy free variables to locals in class namespaces.Jeremy Hylton2007-02-261-19/+75
| | | | | | | | | Fixes bug 1569356, but at the cost of a minor incompatibility in locals(). Add test that verifies that the class namespace is not polluted. Also clarify the behavior in the library docs. Along the way, cleaned up the dict_to_map and map_to_dict implementations and added some comments that explain what they do.
* Backport from Py3k branch: fix refleak in PyString_Format.Georg Brandl2007-02-261-1/+5
|
* Variation of patch # 1624059 to speed up checking if an object is a subclassNeal Norwitz2007-02-259-9/+30
| | | | | | | | | | | | | | | | | | of some of the common builtin types. Use a bit in tp_flags for each common builtin type. Check the bit to determine if any instance is a subclass of these common types. The check avoids a function call and O(n) search of the base classes. The check is done in the various Py*_Check macros rather than calling PyType_IsSubtype(). All the bits are set in tp_flags when the type is declared in the Objects/*object.c files because PyType_Ready() is not called for all the types. Should PyType_Ready() be called for all types? If so and the change is made, the changes to the Objects/*object.c files can be reverted (remove setting the tp_flags). Objects/typeobject.c would also have to be modified to add conditions for Py*_CheckExact() in addition to each the PyType_IsSubtype check.
* Whitespace only changesNeal Norwitz2007-02-251-3/+2
|
* Add more details when releasing interned stringsNeal Norwitz2007-02-251-1/+8
|
* Fixup set/dict interoperability.Raymond Hettinger2007-02-191-0/+11
|
* Extend work on revision 52962: Eliminate redundant calls to PyObject_Hash().Raymond Hettinger2007-02-192-7/+50
|
* Patch #1397848: add the reasoning behind no-resize-on-shrinkage.Martin v. Löwis2007-02-151-0/+20
|
* Bug #1653736: Properly discard third argument to slot_nb_inplace_power.Martin v. Löwis2007-02-091-1/+7
| | | | Will backport.
* Bypass set specific optimizations for set and frozenset subclasses.Raymond Hettinger2007-02-081-7/+7
|
* Do not let overflows in enumerate() and count() pass silently.Raymond Hettinger2007-02-081-0/+6
|
* Silence compiler warningRaymond Hettinger2007-02-071-1/+1
|
* Bug #1575169: operator.isSequenceType() now returns False for subclasses of ↵Raymond Hettinger2007-02-071-0/+2
| | | | dict.