summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* SF #1615701: make d.update(m) honor __getitem__() and keys() in dict subclassesRaymond Hettinger2007-02-071-1/+1
|
* Bug #1648179: set.update() not recognizing __iter__ overrides in dict ↵Raymond Hettinger2007-02-011-4/+4
| | | | subclasses.
* Fix crasher for when an object's __del__ creates a new weakref to itself.Brett Cannon2007-01-232-0/+14
| | | | | | Patch only fixes new-style classes; classic classes still buggy. Closes bug #1377858. Already backported.
* SF patch #1630975: Fix crash when replacing sys.stdout in sitecustomizeThomas Wouters2007-01-231-0/+2
| | | | | | | | | | | When running the interpreter in an environment that would cause it to set stdout/stderr/stdin's encoding, having a sitecustomize that would replace them with something other than PyFile objects would crash the interpreter. Fix it by simply ignoring the encoding-setting for non-files. This could do with a test, but I can think of no maintainable and portable way to test this bug, short of adding a sitecustomize.py to the buildsystem and have it always run with it (hmmm....)
* SF #1486663 -- Allow keyword args in subclasses of set() and frozenset().Raymond Hettinger2007-01-111-2/+2
|
* Minor change in int() docstring for proper spacing.Gustavo Niemeyer2007-01-101-1/+1
|
* Mention in the int() docstring that a base zero has meaning, asGustavo Niemeyer2007-01-101-2/+3
| | | | stated in http://docs.python.org/lib/built-in-funcs.html as well.
* For sets with cyclical reprs, emit an ellipsis instead of infinitely recursing.Raymond Hettinger2006-12-301-4/+24
|
* Typo fixAndrew M. Kuchling2006-12-221-1/+1
|
* Port Georg's dictobject.c fix keys that were tuples got unpacked on the way ↵Raymond Hettinger2006-12-081-1/+15
| | | | | | to setting a KeyError (svn revision 52535, sf bug 1576657).
* Port Armin's fix for a dict resize vulnerability (svn revision 46589, sf bug ↵Raymond Hettinger2006-12-081-6/+31
| | | | 1456209).
* Eliminate two redundant calls to PyObject_Hash().Raymond Hettinger2006-12-081-4/+23
|
* Patch [ 1586791 ] better error msgs for some TypeErrorsGeorg Brandl2006-11-193-14/+22
|
* Bug #1067760: Deprecate passing floats to file.seek.Martin v. Löwis2006-11-121-4/+17
|
* Correctly forward exception in instance_contains().Martin v. Löwis2006-11-081-4/+6
| | | | | Fixes #1591996. Patch contributed by Neal Norwitz. Will backport.
* Fix refleakNeal Norwitz2006-10-291-0/+1
|
* Bug #1576657: when setting a KeyError for a tuple key, make sure thatGeorg Brandl2006-10-291-3/+16
| | | | the tuple isn't used as the "exception arguments tuple".