| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
out whether __del__ exists, without executing any Python-level code.
|
|
|
|
|
| |
mwh pointed out that the error message did not
make sense if obtained by rearranging the bases.
|
|
|
|
|
| |
an OverflowError instead of a TypeError to be consistent
with "%c" % 256. See SF patch #710127.
|
|
|
|
|
|
|
|
| |
instead of raising a TypeError. (From SF patch #710127)
Add tests to verify this is fixed.
Add various tests for '%c' % int.
|
| |
|
|
|
|
|
| |
generalize to take a callback function and a void * data argument.
This might come in handy later... :-)
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Arranged that all the objects exposed by __builtin__ appear in the list
of all objects. I basically peed away two days tracking down a mystery
leak in sys.gettotalrefcount() in a ZODB app (== tons of code), because
the object leaking the references didn't appear in the sys.getobjects(0)
list. The object happened to be False. Now False is in the list, along
with other popular & previously missing leak candidates (like None).
Alas, we still don't have a choke point covering *all* Python objects,
so the list of all objects may still be incomplete.
|
|
|
|
|
|
| |
__contains__().
Bugfix candidate.
|
|
|
|
|
|
|
| |
_Py_AddToAllObjects() that simply inserts an object at the front of
the doubly-linked list of all objects. Changed PyType_Ready() (the
closest thing we've got to a choke point for type objects) to call
that.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
a doubly-linked list, exposed by sys.getobjects(). Unfortunately, it's not
really all live objects, and it seems my fate to bump into programs where
sys.gettotalrefcount() keeps going up but where the reference leaks aren't
accounted for by anything in the list of all objects.
This patch helps a little: if COUNT_ALLOCS is also defined, from now on
type objects will also appear in this list, provided at least one object
of a type has been allocated.
|
| |
|
|
|
|
|
| |
refactoring to get all the duplicates of this delicate code out of the
cPickle and struct modules.
|
|
|
|
|
|
| |
to more accurately describe what the function does.
Suggested by Thomas Wouters.
|
|
|
|
| |
Factors out the common case of returning self.
|
|
|
|
| |
Clarify error message for mro conflicts.
|
|
|
|
| |
Contributed by Hye-Shik Chang.
|
|
|
|
|
| |
classes defined by Python code using a class statement) is now
exported from object.h as PyHeapTypeObject. (SF patch #696193.)
|
|
|
|
| |
(contributed by Michael Stone.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
constructor, when passed a single complex argument, returns the
argument unchanged. This should be done only for the complex base
class; a complex subclass should of course cast the value to the
subclass in this case.
The fix also revealed a segfault in complex_getnewargs(): the argument
for the Py_BuildValue() format code "D" is the *address* of a
Py_complex struct, not the value. (This corroborated by the API
documentation.)
I expect this needs to be backported to 2.2.3.
|
|
|
|
| |
The PyIter_Check is already performed by PyObject_GetIter.
|
|
|
|
|
| |
On a 64-bit machine, a dictionary could contain duplicate int/long keys
if the value was > 2**32.
|
|
|
|
|
|
|
| |
This still falls back to helpers in copy_reg for:
- pickle protocols < 2
- calculating the list of slot names (done only once per class)
- the __newobj__ function (which is used as a token but never called)
|
|
|
|
|
|
|
|
| |
the PyInt_AsLong function, and this returns a long, the value is first
retrieved with PyLong_AsLong, but afterwards overwritten by a call to
PyInt_AS_LONG.
Fixes SF #690253.
|
|
|
|
|
|
|
|
|
|
| |
Don't access tp_descr_{get,set} of a descriptor without checking the
flag bits of the descriptor's type. While we know that the main type
(the type of the object whose attribute is being accessed) has all the
right flag bits (or else PyObject_Generic{Get,Set}Attr wouldn't be
called), we don't know that for its class attributes!
Will backport to 2.2.
|
|
|
|
|
| |
if it exists in preference over __reduce__. Now Tim can go implement this
in cPickle.c.
|
| |
|
|
|
|
|
|
|
|
| |
using super() for an instance in a metaclass situation. Because the
class was a metaclass, the instance was a class, and hence the
PyType_Check() branch was taken. But this branch didn't apply. Make
it so that if this branch doesn't apply, the other branch is still
tried. All tests pass.
|
| |
|
| |
|
|
|
|
| |
tp_as_number directly.
|
|
|
|
| |
now have tp_as_number. Check for nb_int or nb_float.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the optional proto 2 slot state.
pickle.py, load_build(): CAUTION: Noted that cPickle's
load_build and pickle's load_build really don't do the same
things with the state, and didn't before this patch either.
cPickle never tries to do .update(), and has no backoff if
instance.__dict__ can't be retrieved. There are no tests
that can tell the difference, and part of what cPickle's
load_build() did looked accidental to me, so I don't know
what the true intent is here.
pickletester.py, test_pickle.py: Got rid of the hack for
exempting cPickle from running some of the proto 2 tests.
dictobject.c, PyDict_Next(): documented intended use.
|
|
|
|
|
|
|
| |
This changes the default __new__ to refuse arguments iff tp_init is the
default __init__ implementation -- thus making it a TypeError when you
try to pass arguments to a constructor if the class doesn't override at
least __init__ or __new__.
|
|
|
|
|
|
|
|
| |
folded; this will change in Python 2.4. On a 32-bit machine, this
happens for 0x80000000 through 0xffffffff, and for octal constants in
the same value range. No warning is issued if an explicit base is
given, *or* if the string contains a sign (since in those cases no
sign folding ever happens).
|
|
|
|
| |
now be a proxy for an X instance, as long as issubclass(x.__class__, X).
|
| |
|
|
|
|
|
| |
instance, as long as x.__class__ is X or a subclass thereof.
Did a little cleanup of PyObject_IsInstance() too.
|
| |
|
|
|
|
| |
types -- Python types already inherited this.
|
|
|
|
|
|
| |
descr_check(); it wasn't useful. Change the type argument of the
various _get() methods to PyObject * because the call signature of
tp_descr_get doesn't guarantee its type.
|
|
|
|
|
| |
in the light of weird args, and (c) not to expect None (which is now
changed to NULL by slot_tp_descr_get()).
|
|
|
|
|
| |
now, it was only called once, and its existence merely obfuscates the
control flow.
|
|
|
|
|
|
|
| |
when Python code calls a descriptor's __get__ method. It should
translate None to NULL in both argument positions, and insist that at
least one of the argument positions is not NULL after this
transformation.
|
|
|
|
|
|
| |
was used. This simplifies some logic in copy_reg.py (used by
pickling). It also broke a test, but this was rewritten to test the
new feature. :-)
|
| |
|
|
|
|
|
|
| |
When subclassing from an int but not overriding __new__,
long values were not converted properly. Try to convert
longs into an int.
|
| |
|