Mark Dickinson
e453e4c007
Issue 16280: Drop questionable special-casing of null pointer in PyLong_FromVoidPtr.
2012-10-18 22:18:42 +01:00
Mark Dickinson
5cb65917e1
Issue #16277 : merge fix from 3.3
2012-10-18 19:53:45 +01:00
Mark Dickinson
44362a88ad
Issue #16277 : merge fix from 3.2
2012-10-18 19:53:28 +01:00
Mark Dickinson
91044799f7
Issue #16277 : in PyLong_FromVoidPtr, add missing branch for sizeof(void*) <= sizeof(long).
2012-10-18 19:21:43 +01:00
Christian Heimes
743e0cd6b5
Issue #16166 : Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified
...
endianess detection and handling.
2012-10-17 23:52:17 +02:00
Eric Snow
42da889fec
merge for issue #16160 : Subclass support now works for types.SimpleNamespace.
2012-10-16 22:45:49 -07:00
Eric Snow
547298c94c
Close #16160 : Subclass support now works for types.SimpleNamespace. Thanks to RDM for noticing.
2012-10-16 22:35:38 -07:00
Antoine Pitrou
cfc22b4a9b
Issue #15958 : bytes.join and bytearray.join now accept arbitrary buffer objects.
2012-10-16 21:07:23 +02:00
Chris Jerdonek
4a7df9aba9
Issue #14783 : Merge changes from 3.3.
2012-10-07 15:02:16 -07:00
Chris Jerdonek
042fa653ab
Issue #14783 : Merge changes from 3.2.
2012-10-07 14:56:27 -07:00
Chris Jerdonek
83fe2e1c22
Issue #14783 : Improve int() docstring and also str(), range(), and slice().
...
This commit rewrites the docstring for int() to incorporate the documentation
changes made in issue #16036 . It also switches the docstrings for int(),
str(), range(), and slice() to use multi-line signatures.
2012-10-07 14:48:36 -07:00
Armin Ronacher
74b38b190f
Issue #16148 : Small improvements and cleanup. Added version information
...
to docs.
2012-10-07 10:29:32 +02:00
Victor Stinner
4c63a972d1
Cleanup PyUnicode_FromFormatV() for zero padding
...
Skip the "0" instead of parsing it twice: detect zero padding and then parsed
as a digit of the width.
2012-10-06 23:55:33 +02:00
Victor Stinner
15a1136547
Issue #16147 : PyUnicode_FromFormatV() doesn't need anymore to allocate a buffer
...
on the heap to format numbers.
2012-10-06 23:48:20 +02:00
Victor Stinner
ff5a848db5
Issue #16147 : PyUnicode_FromFormatV() now raises an error if the argument of
...
'%c' is not in the range(0x110000).
2012-10-06 23:05:45 +02:00
Victor Stinner
3921e90c5a
Issue #16147 : PyUnicode_FromFormatV() now detects integer overflow when parsing
...
width and precision
2012-10-06 23:05:00 +02:00
Victor Stinner
e215d960be
Issue #16147 : Rewrite PyUnicode_FromFormatV() to use _PyUnicodeWriter API
...
* Simplify the code: replace 4 steps with one unique step using the
_PyUnicodeWriter API. PyUnicode_Format() has the same design. It avoids to
store intermediate results which require to allocate an array of pointers on
the heap.
* Use the _PyUnicodeWriter API for speed (and its convinient API):
overallocate the buffer to reduce the number of "realloc()"
* Implement "width" and "precision" in Python, don't rely on sprintf(). It
avoids to need of a temporary buffer allocated on the heap: only use a small
buffer allocated in the stack.
* Add _PyUnicodeWriter_WriteCstr() function
* Split PyUnicode_FromFormatV() into two functions: add
unicode_fromformat_arg().
* Inline parse_format_flags(): the format of an argument is now only parsed
once, it's no more needed to have a subfunction.
* Optimize PyUnicode_FromFormatV() for characters between two "%" arguments:
search the next "%" and copy the substring in one chunk, instead of copying
character per character.
2012-10-06 23:03:36 +02:00
Mark Dickinson
cf46d62fcb
Issue #16096 : port fix from 3.3
2012-10-06 18:50:19 +01:00
Mark Dickinson
fc9adb62fb
Issue #16096 : Fix signed overflow in Objects/longobject.c. Thanks Serhiy Storchaka.
2012-10-06 18:50:02 +01:00
Mark Dickinson
ff9c54aca2
Issue #16096 : Merge fixes from 3.3.
2012-10-06 18:05:14 +01:00
Mark Dickinson
c04ddff290
Issue #16096 : Fix several occurrences of potential signed integer overflow. Thanks Serhiy Storchaka.
2012-10-06 18:04:49 +01:00
Christian Heimes
b70e8a1958
and another one
2012-10-06 17:16:39 +02:00
Christian Heimes
6314d164c9
move var declaration to top of block to fix compilation on Windows, fixes a7ec0a1b0f7c
2012-10-06 17:13:29 +02:00
Armin Ronacher
23c5bb4030
Fixed a missing incref introduced by a7ec0a1b0f7c
2012-10-06 14:30:32 +02:00
Armin Ronacher
226b1db0e2
Added notimplemented_dealloc for better error reporting
2012-10-06 14:28:58 +02:00
Armin Ronacher
aa9a79d279
Issue #16148 : implemented PEP 424
2012-10-06 14:03:24 +02:00
Victor Stinner
8c6db45d3e
In debug mode, unicode_write_cstr() now checks that non-ASCII characters are
...
not written into an ASCII string
2012-10-06 00:40:45 +02:00
Ezio Melotti
080a2c087e
#16127 : merge with 3.3.
2012-10-05 03:34:02 +03:00
Ezio Melotti
e7f90375b1
#16127 : remove outdated references to narrow builds. Patch by Serhiy Storchaka.
2012-10-05 03:33:31 +03:00
Victor Stinner
1929407406
Fix PyUnicode_Format(): return NULL if PyUnicode_READY(uformat) failed
...
This error cannot occur in practice: PyUnicode_FromObject() always return
a "ready" string.
2012-10-05 00:09:33 +02:00
Victor Stinner
770e19e0cc
Optimize unicode_compare(): use memcmp() when comparing two UCS1 strings
2012-10-04 22:59:45 +02:00
Victor Stinner
90db9c47dc
Enable also ptr==ptr optimization in PyUnicode_Compare()
...
It was already implemented in PyUnicode_RichCompare()
2012-10-04 21:53:50 +02:00
Victor Stinner
9cc98c93a7
long_to_decimal_string_internal() doesn't need to write the final NULL character
2012-10-04 02:43:02 +02:00
Victor Stinner
aa7712711d
unicode_result_wchar(): move the assert() to the "#ifdef Py_DEBUG" block
2012-10-04 02:32:58 +02:00
Victor Stinner
a4708231e6
Split the huge PyUnicode_Format() function (+540 lines) into subfunctions
2012-10-04 02:19:54 +02:00
Victor Stinner
a049443fab
PyUnicode_Format(): disable overallocation when we are writing the last part
...
of the output string
2012-10-03 23:03:46 +02:00
Victor Stinner
afffce489b
Unicode: resize_compact() and resize_inplace() fills also the Unicode strings
...
with invalid bytes in debug mode, as done by PyUnicode_New()
2012-10-03 23:03:17 +02:00
Victor Stinner
c89d28fdfc
Issue #15609 : Fix refleak introduced by my last optimization
2012-10-02 12:54:07 +02:00
Victor Stinner
621ef3d84f
Issue #15609 : Optimize str%args for integer argument
...
- Use _PyLong_FormatWriter() instead of formatlong() when possible, to avoid
a temporary buffer
- Enable the fast path when width is smaller or equals to the length,
and when the precision is bigger or equals to the length
- Add unit tests!
- formatlong() uses PyUnicode_Resize() instead of _PyUnicode_FromASCII()
to resize the output string
2012-10-02 00:33:47 +02:00
Benjamin Peterson
b8350f1c7d
upgrade to UCD 6.2
2012-09-29 13:47:39 -04:00
Ezio Melotti
0e1af282b8
Fix typo.
2012-09-28 16:43:40 +03:00
Mark Dickinson
7c95bb35e4
Issue #16060 : Fix a double DECREF in int() implementation. Thanks Serhiy Storchaka.
2012-09-27 19:38:59 +01:00
Antoine Pitrou
a1f7655fa7
Issue #15379 : Fix passing of non-BMP characters as integers for the charmap decoder (already working as unicode strings).
...
Patch by Serhiy Storchaka.
2012-09-23 20:00:04 +02:00
Antoine Pitrou
6f80f5d444
Issue #15379 : Fix passing of non-BMP characters as integers for the charmap decoder (already working as unicode strings).
...
Patch by Serhiy Storchaka.
2012-09-23 19:55:21 +02:00
Mark Dickinson
5710c2a3e8
Issue 15959: Merge from 3.2.
2012-09-20 21:30:34 +01:00
Mark Dickinson
c286e58044
Issue 15959: Fix type mismatch for quick{_neg}_int_allocs. Thanks Serhiy Storchaka.
2012-09-20 21:29:28 +01:00
Antoine Pitrou
ca8aa4acf6
Issue #15144 : Fix possible integer overflow when handling pointers as integer values, by using Py_uintptr_t instead of size_t.
...
Patch by Serhiy Storchaka.
2012-09-20 20:56:47 +02:00
Trent Nelson
da064d0745
Silence compiler warnings on Solaris 10 via explicit (void *) casts.
2012-09-18 22:00:25 -04:00
Trent Nelson
ab02db23b1
Silence compiler warnings on Solaris 10 via explicit (void *) casts.
...
(Compiler: Solaris Studio 12.3)
2012-09-18 21:58:03 -04:00
Christian Heimes
7ae251a025
Fix out of bounds read in long_new() for empty bytes with an explicit base. int(b'', somebase) calls PyLong_FromString() with char* of length 1 but the function accesses the first argument at offset 1. CID 715359
2012-09-12 15:32:06 +02:00