| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Replace:
PyObject_CallFunctionObjArgs(callable, NULL)
with:
_PyObject_CallNoArg(callable)
|
|\ |
|
| |
| |
| |
| | |
Patch by Soumya Sharma.
|
|/
|
|
| |
Thanks to Georg Brandl for the patch.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
This avoids possible buffer overreads when int(), float(), compile(), exec()
and eval() are passed bytes-like objects. Similar code is removed from the
complex() constructor, where it was not reachable.
Patch by John Leitch, Serhiy Storchaka and Martin Panter.
|
|\ \
| |/
| |
| | |
and PyObject_AsWriteBuffer().
|
| |
| |
| |
| | |
and PyObject_AsWriteBuffer().
|
|\ \
| |/
| |
| | |
number by (nan+0j).
|
| |
| |
| |
| | |
number by (nan+0j).
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The PyObject_INIT() macros returns obj:
../cpython/Objects/methodobject.c:32:23: warning: expression result unused [-Wunused-value]
PyObject_INIT(op, &PyCFunction_Type);
^~
../cpython/Include/objimpl.h:139:69: note: expanded from macro 'PyObject_INIT'
( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
^
1 warning generated.
|
| |
|
|\ |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Add also min_char attribute to _PyUnicodeWriter structure (currently unused)
* _PyUnicodeWriter_Init() has no more argument (except the writer itself):
min_length and overallocate must be set explicitly
* In error handlers, only enable overallocation if the replacement string
is longer than 1 character
* CJK decoders don't use overallocation anymore
* Set min_length, instead of preallocating memory using
_PyUnicodeWriter_Prepare(), in many decoders
* _PyUnicode_DecodeUnicodeInternal() checks for integer overflow
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and str.format(args)
* Formatting string, int, float and complex use the _PyUnicodeWriter API. It
avoids a temporary buffer in most cases.
* Add _PyUnicodeWriter_WriteStr() to restore the PyAccu optimization: just
keep a reference to the string if the output is only composed of one string
* Disable overallocation when formatting the last argument of str%args and
str.format(args)
* Overallocation allocates at least 100 characters: add min_length attribute
to the _PyUnicodeWriter structure
* Add new private functions: _PyUnicode_FastCopyCharacters(),
_PyUnicode_FastFill() and _PyUnicode_FromASCII()
The speed up is around 20% in average.
|
|
|
|
|
| |
I had to move the static identifier code from unicodeobject.h to object.h in
order for this to work.
|
| |
|
|
|
|
| |
The macro was introduced in #12724.
|
|
|
|
|
| |
PyOS_snprintf() to avoid temporary buffer allocated on the stack and a
conversion from bytes to Unicode.
|
|
|
|
| |
tests to check both str and repr, which are the same for complex.
|
|
|
|
|
|
| |
types. Added a new API function, PyUnicode_TransformDecimalToASCII(),
which transforms non-ASCII decimal digits in a Unicode string to their
ASCII equivalents.
|
| |
|
| |
|
| |
|
|
|
|
| |
(And similarly for complex numbers.)
|
|
|
|
|
|
| |
(instances of int, float, complex, decimal.Decimal and
fractions.Fraction) that makes it easy to maintain the invariant that
hash(x) == hash(y) whenever x and y have equal value.
|
|
|
|
|
|
|
|
|
|
| |
objects. (1) The comparison could incorrectly return True in some cases
(2**53+1 == complex(2**53) == 2**53), breaking transivity of equality.
(2) The comparison raised an OverflowError for large integers, leading
to unpredictable exceptions when combining integers and complex objects
in sets or dicts.
Patch by Meador Inge.
|
|
|
|
|
|
|
|
|
|
| |
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
|
|
|
|
| |
TypeError.
|
|
|
|
|
|
|
|
|
|
| |
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78319 | ezio.melotti | 2010-02-22 18:30:58 +0200 (Mon, 22 Feb 2010) | 1 line
#7482: clarify error message in case of division by zero of float and complex numbers.
........
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77292 | benjamin.peterson | 2010-01-03 18:43:01 -0600 (Sun, 03 Jan 2010) | 1 line
do correct lookup of the __complex__ method
........
r77293 | benjamin.peterson | 2010-01-03 19:00:47 -0600 (Sun, 03 Jan 2010) | 1 line
factor out __complex__ lookup code to fix another case
........
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76561 | mark.dickinson | 2009-11-28 12:30:36 +0000 (Sat, 28 Nov 2009) | 5 lines
Include ieeefp.h (when available) in pyport.h instead of individually in
Objects/floatobject.c and Objects/complexobject.c. This should silence
compiler warnings about implicit declaration of the 'finite' function
on Solaris.
........
|
| |
|
| |
|
|
|
|
| |
number support (was broken anyway)
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72718 | mark.dickinson | 2009-05-17 11:38:30 +0100 (Sun, 17 May 2009) | 4 lines
Issue #6044: remove confusing wording from complex -> integer and
complex -> float conversion error messages.
........
|
|
|
|
| |
precision of 12 when using the empty presentation type. This more closely matches str()'s behavior and reduces surprises when adding alignment flags to an empty format string. Patch by Mark Dickinson.
|
|
|
|
|
|
|
|
|
|
| |
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72253 | mark.dickinson | 2009-05-03 21:59:48 +0100 (Sun, 03 May 2009) | 2 lines
Eliminate some locale-dependent calls to isspace and tolower.
........
|
|
|
|
| |
PyOS_double_to_string, and deprecate PyOS_ascii_strtod and PyOS_ascii_atof.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
svn+ssh://pythondev@svn.python.org/python/trunk
........
r71963 | mark.dickinson | 2009-04-26 15:00:08 +0100 (Sun, 26 Apr 2009) | 2 lines
Reset errno before both calls to PyOS_ascii_strtod, not just one.
........
|
|
|
|
|
|
|
|
|
|
| |
svn+ssh://pythondev@svn.python.org/python/trunk
........
r71869 | mark.dickinson | 2009-04-25 10:47:00 +0100 (Sat, 25 Apr 2009) | 2 lines
Fix typo in complex parsing code; expand tests.
........
|
|
|
|
|
| |
match for 2.7 and 3.1, and that 3.1 continues to
accept complex('j') and complex('4-j')
|
|
|
|
|
| |
nans and infs are no longer given special treatment; as a result,
repr(complex(z)) recovers z for any complex number z.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Addresses the float -> string conversion, using David Gay's code which
was added in Mark Dickinson's checkin r71663.
Also addresses these, which are intertwined with the short repr
changes:
- Issue #5772: format(1e100, '<') produces '1e+100', not '1.0e+100'
- Issue #5515: 'n' formatting with commas no longer works poorly
with leading zeros.
- PEP 378 Format Specifier for Thousands Separator: implemented
for floats.
|