Commit graph

9201 commits

Author SHA1 Message Date
Raymond Hettinger
1286d14500 Improve variable names and constant expressions 2015-10-14 23:16:57 -07:00
Victor Stinner
f9c9a3fedf Refactor binascii.rledecode_hqx()
Rewrite the code to handle the output buffer.
2015-10-14 15:20:07 +02:00
Victor Stinner
1bfe930585 Issue #25384: Fix binascii.rledecode_hqx()
Fix usage of _PyBytesWriter API. Use the new _PyBytesWriter_Resize() function
instead of _PyBytesWriter_Prepare().
2015-10-14 15:02:35 +02:00
Victor Stinner
eaaaf136d2 Issue #25384: Use _PyBytesWriter API in binascii
This API avoids a final call to _PyBytes_Resize() for output smaller than 512
bytes.

Small optimization: disable overallocation in binascii.rledecode_hqx() for the
last write.
2015-10-13 10:51:47 +02:00
Victor Stinner
f7d2471260 Merge 3.5 (sys.setrecursionlimit) 2015-10-13 00:16:07 +02:00
Victor Stinner
50856d5ae7 sys.setrecursionlimit() now raises RecursionError
Issue #25274: sys.setrecursionlimit() now raises a RecursionError if the new
recursion limit is too low depending at the current recursion depth. Modify
also the "lower-water mark" formula to make it monotonic. This mark is used to
decide when the overflowed flag of the thread state is reset.
2015-10-13 00:11:21 +02:00
Victor Stinner
358af13526 Issue #25353: Optimize unicode escape and raw unicode escape encoders to use
the new _PyBytesWriter API.
2015-10-12 22:36:57 +02:00
Raymond Hettinger
965362e92d Minor fixup. maxlen is already known. 2015-10-11 22:52:54 -07:00
Raymond Hettinger
d96db09b57 Refactor the deque trim logic to eliminate the two separate trim functions. 2015-10-11 22:34:48 -07:00
Raymond Hettinger
6b1e113f9f Hoist the deque->maxlen lookup out of the inner-loop. 2015-10-11 09:43:50 -07:00
Victor Stinner
e84c976568 Issue #25357: Add an optional newline paramer to binascii.b2a_base64().
base64.b64encode() uses it to avoid a memory copy.
2015-10-11 11:01:02 +02:00
Victor Stinner
bc5b80bac1 Close #24784: Fix compilation without thread support
Add "#ifdef WITH_THREAD" around cals to:

* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
2015-10-11 09:54:42 +02:00
Victor Stinner
92f0113701 Close #24784: Fix compilation without thread support
Add "#ifdef WITH_THREAD" around cals to:

* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
2015-10-11 09:54:42 +02:00
Raymond Hettinger
a7f63009d6 Minor tweak. Make the maxlen comparisons a little more clear and consistent. 2015-10-10 23:56:02 -04:00
Benjamin Peterson
90ccccf9ed merge 3.5 (#25371) 2015-10-10 19:32:41 -07:00
Benjamin Peterson
e5df40727c merge 3.4 (#25371) 2015-10-10 19:32:33 -07:00
Benjamin Peterson
b397e3b526 add a missing comma (closes #25371) 2015-10-10 19:32:20 -07:00
Serhiy Storchaka
0d554d7ef1 Issue #24164: Objects that need calling `__new__` with keyword arguments,
can now be pickled using pickle protocols older than protocol version 4.
2015-10-10 22:42:18 +03:00
Martin Panter
a6d5038226 Issue #22413: Merge StringIO doc from 3.5 2015-10-10 10:20:25 +00:00
Martin Panter
f264416093 Issue #22413: Remove comment made out of date by Argument Clinic 2015-10-10 10:17:57 +00:00
Martin Panter
994815e1d7 Issue #22413: Merge StringIO doc from 3.4 into 3.5 2015-10-10 10:15:21 +00:00
Martin Panter
cfad54344f Issue #22413: Document newline effect on StringIO initializer and getvalue
Also add to comment in the C code.
2015-10-10 03:01:20 +00:00
Martin Panter
585a6acfef Merge typo fixes from 3.5 2015-10-07 11:13:55 +00:00
Martin Panter
3f930dcd87 Merge typo fixes from 3.4 into 3.5 2015-10-07 11:01:47 +00:00
Martin Panter
9955a373a8 Various minor typos in documentation and comments 2015-10-07 10:26:23 +00:00
Raymond Hettinger
848f2b595d Backport early-out 91259f061cfb to reduce the cost of bb1a2944bcb6 2015-10-06 23:06:17 -04:00
Raymond Hettinger
0443ac2860 Eliminate unnecessary test 2015-10-05 22:52:37 -04:00
Raymond Hettinger
fd265f4a18 Factor out common iterator finalization code 2015-10-02 23:17:33 -07:00
Berker Peksag
6585501113 Issue #25290: Fix typo in csv.reader() docstring
Patch by Johannes Niediek.
2015-10-02 19:26:14 +03:00
Berker Peksag
987f215141 Issue #25290: Fix typo in csv.reader() docstring
Patch by Johannes Niediek.
2015-10-02 19:25:53 +03:00
Berker Peksag
e2382c598c Issue #25290: Fix typo in csv.reader() docstring
Patch by Johannes Niediek.
2015-10-02 19:25:32 +03:00
Serhiy Storchaka
5dbe245ef2 Issue #24483: C implementation of functools.lru_cache() now calculates key's
hash only once.
2015-10-02 12:47:59 +03:00
Serhiy Storchaka
b9d98d532c Issue #24483: C implementation of functools.lru_cache() now calculates key's
hash only once.
2015-10-02 12:47:11 +03:00
Raymond Hettinger
0d30940dd2 Add fast paths to deque_init() for the common cases 2015-09-30 23:15:02 -07:00
Raymond Hettinger
38031143fb Add an early-out for deque_clear() 2015-09-29 22:45:05 -07:00
Serhiy Storchaka
11c715f12e Issue #25262. Added support for BINBYTES8 opcode in Python implementation of
unpickler.  Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8
opcodes no longer silently ignored on 32-bit platforms in C implementation.
2015-09-29 22:13:01 +03:00
Serhiy Storchaka
525faaeffc Issue #25262. Added support for BINBYTES8 opcode in Python implementation of
unpickler.  Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8
opcodes no longer silently ignored on 32-bit platforms in C implementation.
2015-09-29 22:12:29 +03:00
Serhiy Storchaka
e060619d4b Issue #25262. Added support for BINBYTES8 opcode in Python implementation of
unpickler.  Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8
opcodes no longer silently ignored on 32-bit platforms in C implementation.
2015-09-29 22:10:07 +03:00
Alexander Belopolsky
365ba8f6c1 Closes issue #23600: Wrong results from tzinfo.fromutc(). 2015-09-27 22:32:15 -04:00
Alexander Belopolsky
edc6885b3f Closes issue #23600: Wrong results from tzinfo.fromutc(). 2015-09-27 22:31:45 -04:00
Alexander Belopolsky
5d27ed858a merge 2015-09-27 22:13:28 -04:00
Alexander Belopolsky
d19b5042ff Closes issue #23600: Wrong results from tzinfo.fromutc(). 2015-09-27 21:56:53 -04:00
Alexander Belopolsky
c58c2cb392 Closes issue #23600: Wrong results from tzinfo.fromutc(). 2015-09-27 21:56:09 -04:00
Alexander Belopolsky
c79447b267 Closes issue #23600: Wrong results from tzinfo.fromutc(). 2015-09-27 21:41:55 -04:00
Serhiy Storchaka
a6c5d53eec Issue #25203: Failed readline.set_completer_delims() no longer left the
module in inconsistent state.
2015-09-27 22:38:33 +03:00
Serhiy Storchaka
36aff2db4a Issue #25203: Failed readline.set_completer_delims() no longer left the
module in inconsistent state.
2015-09-27 22:38:01 +03:00
Serhiy Storchaka
1138439376 Issue #25203: Failed readline.set_completer_delims() no longer left the
module in inconsistent state.
2015-09-27 22:34:59 +03:00
Benjamin Peterson
eca7172c3c merge 3.5 2015-09-27 02:14:29 -07:00
Benjamin Peterson
a18bd0e0f0 merge 3.4 2015-09-27 02:14:23 -07:00
Benjamin Peterson
3c0769d478 fix spacing 2015-09-27 02:13:40 -07:00