| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
changes from start of branch upto r22b2 were already merged, of course).
|
|
|
|
|
|
|
| |
pass the buffer length. Stop using it. It should be deprecated, but too
late in the release cycle to do that now.
New static format_float() does the same thing but requires passing the
buffer length too. Use it instead.
|
|
|
|
|
|
| |
const char* instead of char*. The change is conceptually correct, and
indirectly fixes a compiler wng introduced when somebody else innocently
passed a const char* to this function.
|
|
|
|
| |
PyOS_snprintf() for buffer overrun avoidance.
|
|
|
|
| |
for buffer overrun avoidance.
|
|
|
|
| |
overrun avoidance.
|
|
|
|
| |
sprintf() to PyOS_snprintf() for buffer overrun avoidance.
|
|
|
|
| |
buffer overrun avoidance.
|
|
|
|
|
|
|
| |
sprintf() to PyOS_snprintf() for buffer overrun avoidance.
complex_print(), complex_repr(), complex_str(): Call complex_to_buf()
passing in sizeof(buf).
|
|
|
|
|
| |
Also changed <>-style #includes to ""-style in some places where the
former didn't make sense.
|
| |
|
| |
|
|
|
|
|
|
|
| |
confusing error messages. If a new-style class has no sequence or
mapping behavior, attempting to use the indexing notation with a
non-integer key would complain that the sequence index must be an
integer, rather than complaining that the operation is not supported.
|
|
|
|
|
| |
This patch also does away with an incompatibility between Jython
and CPython.
|
|
|
|
|
|
| |
of multiple inheritance from a mix of new- and classic-style classes.
This is his patch, plus a start at some test cases from me. Will check
in more, plus a NEWS blurb, later tonight.
|
|
|
|
|
|
| |
supports the single-segment readable buffer interface.
Add documentation for this and other PyObject_XXXBuffer() calls.
|
| |
|
|
|
|
|
|
| |
object, so the "Metroworks only" section should not decref it in case
of error (the caller is responsible for decref'ing in case of error --
and does).
|
|
|
|
|
|
| |
If fopen() fails with EINVAL it means that the mode argument is
invalid. Return the mode in the error message instead of the
filename.
|
|
|
|
|
| |
run in an infinite loop no longer grows. Thanks to Neal Norwitz for
determining that test leaked!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
helping for types that defined tp_richcmp but not tp_compare, although
that's when it's most valuable, and strings moved into that category
since the fast path was first introduced. Now it helps for same-type
non-Instance objects that define rich or 3-way compares.
For all the edits here, the rest just amounts to moving the fast path from
do_richcmp into PyObject_RichCompare, saving a layer of function call
(measurable on my box!). This loses when NESTING_LIMIT is exceeded, but I
don't care about that (fast-paths are for normal cases, not pathologies).
Also added a tasteful <wink> label to get out of PyObject_RichCompare, as
the if/else nesting in this routine was getting incomprehensible.
|
|
|
|
| |
the internal comparison routines.
|
|
|
|
|
| |
from optimizing away mod's sign adjustment when mod == 0; so it got
the intended result only in the debug build.
|
|
|
|
|
|
|
| |
Try to ensure that divmod(-0.0, 1.0) -> (-0.0, +0.0) across platforms.
It always did on Windows, and still does. It didn't on Linux. Alas,
there's no platform-independent way to write a test case for this.
Bugfix candidate.
|
|
|
|
|
|
| |
presence of NaNs. So pass the issue on to the platform libm fabs();
after all, fabs() is a std C function because you can't implement it
correctly in portable C89.
|
|
|
|
|
|
|
| |
should just avoid calling it in the first place to avoid waiting for a repr
of a large object like a dict or list. The result of PyObject_Repr() was
being leaked as well.
Bugfix candidate!
|
|
|
|
|
|
| |
Partial fix.
float_abs(): ensure abs(-0.0) returns +0.0.
Bugfix candidate.
|
|
|
|
|
|
| |
[ #476557 ] Wrong error message for file.write(a, b)
Makes file.write a METH_VARARGS function.
|
|
|
|
|
|
| |
Jack Jansen on python-dev.
Add simple test case.
Move vereq() from test_descr to test_support (it's handy!).
|
|
|
|
| |
return the same as dir(None).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
XXX Remaining problems:
- The GC module doesn't know about these; I think it has its reasons
to disallow calling __del__, but for now, __del__ on new-style
objects is called when the GC module discards an object, for better
or for worse.
- The code to call a __del__ handler is really ridiculously
complicated, due to all the different debug #ifdefs. I've copied
this from the similar code in classobject.c, so I'm pretty sure I
did it right, but it's not pretty. :-(
- No tests yet.
|
| |
|
|
|
|
| |
PyObject_CallMethodObArgs() ---> PyObject_CallMethodObjArgs()
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
object.h: Added PyType_CheckExact macro.
typeobject.c, type_new():
+ Use the new macro.
+ Assert that the arguments have the right types rather than do incomplete
runtime checks "sometimes".
+ If this isn't the 1-argument flavor() of type, and there aren't 3 args
total, produce a "types() takes 1 or 3 args" msg before
PyArg_ParseTupleAndKeywords produces a "takes exactly 3" msg.
|
|
|
|
|
|
| |
+ Change keyword arg name from "x" to "items". People passing a mapping
object can stretch their imaginations <wink>.
+ Simplify the docstring text.
|
|
|
|
|
|
| |
the va_list until we are sure we have a format string and need to use it;
this avoid premature initialization and having to finalize it several
different places because of error returns.
|
|
|
|
|
|
| |
and functions: we only need to call PyObject_ClearWeakRefs() if the weakref
list is non-NULL. Since these objects are common but weakrefs are still
unusual, saving the call at deallocation time makes a lot of sense.
|
|
|
|
|
|
|
| |
PyObject_CallFunctionObArgs() and PyObject_CallMethodObArgs() have the
advantage that no format strings need to be parsed. The CallMethod
variant also avoids creating a new string object in order to retrieve
a method from an object as well.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
outer level, the iterator protocol is used for memory-efficiency (the
outer sequence may be very large if fully materialized); at the inner
level, PySequence_Fast() is used for time-efficiency (these should
always be sequences of length 2).
dictobject.c, new functions PyDict_{Merge,Update}FromSeq2. These are
wholly analogous to PyDict_{Merge,Update}, but process a sequence-of-2-
sequences argument instead of a mapping object. For now, I left these
functions file static, so no corresponding doc changes. It's tempting
to change dict.update() to allow a sequence-of-2-seqs argument too.
Also changed the name of dictionary's keyword argument from "mapping"
to "x". Got a better name? "mapping_or_sequence_of_pairs" isn't
attractive, although more so than "mosop" <wink>.
abstract.h, abstract.tex: Added new PySequence_Fast_GET_SIZE function,
much faster than going thru the all-purpose PySequence_Size.
libfuncs.tex:
- Document dictionary().
- Fiddle tuple() and list() to admit that their argument is optional.
- The long-winded repetitions of "a sequence, a container that supports
iteration, or an iterator object" is getting to be a PITA. Many
months ago I suggested factoring this out into "iterable object",
where the definition of that could include being explicit about
generators too (as is, I'm not sure a reader outside of PythonLabs
could guess that "an iterator object" includes a generator call).
- Please check my curly braces -- I'm going blind <0.9 wink>.
abstract.c, PySequence_Tuple(): When PyObject_GetIter() fails, leave
its error msg alone now (the msg it produces has improved since
PySequence_Tuple was generalized to accept iterable objects, and
PySequence_Tuple was also stomping on the msg in cases it shouldn't
have even before PyObject_GetIter grew a better msg).
|
| |
|
|
|
|
|
|
|
|
| |
of the if block where it was before. The name is only used inside
that if block, but the storage is referenced outside it via the 's'
variable.
(This patch was part of SF patch #474590 -- RISC OS support.)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The C-code in fileobject.readinto(buffer) which parses
the arguments assumes that size_t is interchangeable
with int:
size_t ntodo, ndone, nnow;
if (f->f_fp == NULL)
return err_closed();
if (!PyArg_Parse(args, "w#", &ptr, &ntodo))
return NULL;
This causes a problem on Alpha / Tru64 / OSF1 v5.1
where size_t is a long and sizeof(long) != sizeof(int).
The patch I'm proposing declares ntodo as an int. An
alternative might be to redefine w# to expect size_t.
[We can't change w# because there are probably third party modules
relying on it. GvR]
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
response to a message by Laura Creighton on c.l.py. E.g.
>>> 0+''
TypeError: unsupported operand types for +: 'int' and 'str'
(previously this did not mention the operand types)
>>> ''+0
TypeError: cannot concatenate 'str' and 'int' objects
|
|
|
|
|
|
|
|
|
|
| |
There really isn't a good reason for instance method objects to have
their own __dict__, __doc__ and __name__ properties that just delegate
the request to the function (callable); the default attribute behavior
already does this.
The test suite had to be fixed because the error changes from
TypeError to AttributeError.
|
|
|
|
|
| |
(formerly these were silently ignored). The only built-in methods
that take keyword arguments are __call__, __init__ and __new__.
|
| |
|