| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
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__().
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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?
|
| |
|
|
|
|
| |
calls and fixing set/dict interoperability.
|
|
|
|
|
|
|
| |
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)
|
| |
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
the implementation for __reduce__ and __reduce_ex__ into two separate
functions. Fixes bug #931877. Will backport.
|
|
|
|
|
| |
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
__dict__ and __weakref__ are removed from the slots tuple earlier
in the code, in the loop that mangles slot names. Will backport.
|
|
|
|
| |
forms. This means complex(repr(x)) now works instead of raising a ValueError.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Will backport.
|
| |
|
| |
|
| |
|
|
|
|
| |
dict.
|
| |
|
|
|
|
| |
subclasses.
|
|
|
|
|
|
| |
Patch only fixes new-style classes; classic classes still buggy.
Closes bug #1377858. Already backported.
|
|
|
|
|
|
|
|
|
|
|
| |
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....)
|
| |
|
| |
|
|
|
|
| |
stated in http://docs.python.org/lib/built-in-funcs.html as well.
|
| |
|
| |
|
|
|
|
|
|
| |
to setting a KeyError (svn revision 52535, sf bug
1576657).
|
|
|
|
| |
1456209).
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Fixes #1591996. Patch contributed by Neal Norwitz.
Will backport.
|
| |
|
|
|
|
| |
the tuple isn't used as the "exception arguments tuple".
|