Commit Graph

91652 Commits

Author SHA1 Message Date
Victor Stinner ce179bf6ba Add _PyBytesWriter_WriteBytes() to factorize the code 2015-10-09 12:57:22 +02:00
Victor Stinner ad7715891e _PyBytesWriter: simplify code to avoid "prealloc" parameters
Substract preallocate bytes from min_size before calling
_PyBytesWriter_Prepare().
2015-10-09 12:38:53 +02:00
Victor Stinner 53926a1ce2 _PyBytesWriter: rename size attribute to min_size 2015-10-09 12:37:03 +02:00
Victor Stinner fa7762ec06 Issue #25349: Optimize bytes % args using the new private _PyBytesWriter API
* Thanks to the _PyBytesWriter API, output smaller than 512 bytes are allocated
  on the stack and so avoid calling _PyBytes_Resize(). Because of that, change
  the default buffer size to fmtcnt instead of fmtcnt+100.
* Rely on _PyBytesWriter algorithm to overallocate the buffer instead of using
  a custom code. For example, _PyBytesWriter uses a different overallocation
  factor (25% or 50%) depending on the platform to get best performances.
* Disable overallocation for the last write.
* Replace C loops to fill characters with memset()
* Add also many comments to _PyBytes_Format()
* Remove unused FORMATBUFLEN constant
* Avoid the creation of a temporary bytes object when formatting a floating
  point number (when no custom formatting option is used)
* Fix also reference leaks on error handling
* Use Py_MEMCPY() to copy bytes between two formatters (%)
2015-10-09 11:48:06 +02:00
Raymond Hettinger bd5f0e8c1c Hoist constant expression out of the inner loop. 2015-10-09 01:34:08 -04:00
Raymond Hettinger 5098b58381 Make comparison more consistent 2015-10-09 00:42:47 -04:00
Raymond Hettinger 7836a27ceb Issue #25298: Add lock and rlock weakref tests (Contributed by Nir Soffer). 2015-10-09 00:03:51 -04:00
Victor Stinner b3653a3458 Issue #25318: cleanup code _PyBytesWriter
Rename "stack buffer" to "small buffer".

Add also an assertion in _PyBytesWriter_GetPos().
2015-10-09 03:38:24 +02:00
Victor Stinner 3fa36ff5e4 Issue #25318: Fix backslashreplace()
Fix code to estimate the needed space.
2015-10-09 03:37:11 +02:00
Victor Stinner 797485e101 Issue #25318: Avoid sprintf() in backslashreplace()
Rewrite backslashreplace() to be closer to PyCodec_BackslashReplaceErrors().

Add also unit tests for non-BMP characters.
2015-10-09 03:17:30 +02:00
Victor Stinner b13b97d3b8 Issue #25318: Fix compilation error
Replace "#if Py_DEBUG" with "#ifdef Py_DEBUG".
2015-10-09 02:52:16 +02:00
Victor Stinner 0016507c16 Issue #25318: Move _PyBytesWriter to bytesobject.c
Declare also the private API in bytesobject.h.
2015-10-09 01:53:21 +02:00
Victor Stinner e7bf86cd7d Optimize backslashreplace error handler
Issue #25318: Optimize backslashreplace and xmlcharrefreplace error handlers in
UTF-8 encoder. Optimize also backslashreplace error handler for ASCII and
Latin1 encoders.

Use the new _PyBytesWriter API to optimize these error handlers for the
encoders. It avoids to create an exception and call the slow implementation of
the error handler.
2015-10-09 01:39:28 +02:00
Victor Stinner fdfbf78114 Issue #25318: Add _PyBytesWriter API
Add a new private API to optimize Unicode encoders. It uses a small buffer
allocated on the stack and supports overallocation.

Use _PyBytesWriter API for UCS1 (ASCII and Latin1) and UTF-8 encoders. Enable
overallocation for the UTF-8 encoder with error handlers.

unicode_encode_ucs1(): initialize collend to collstart+1 to not check the
current character twice, we already know that it is not ASCII.
2015-10-09 00:33:49 +02:00
Steve Dower 08ec6d9611 Fix missing import in libregrtest. 2015-10-08 11:34:07 -07:00
Steve Dower 6e8d6ed2f4 Merge from 3.5 2015-10-08 10:00:55 -07:00
Steve Dower 5ae56919ab Issue #25089: Adds logging to installer for case where launcher is not selected on upgrade. 2015-10-08 09:55:49 -07:00
Steve Dower 666e6e1b4b Merge from 3.5 2015-10-08 09:06:39 -07:00
Steve Dower 3cc6da2b07 Removes deprecated -n option from buildbot script. 2015-10-08 09:06:17 -07:00
Steve Dower 12c2945ccf Issue #23919: Prevents assert dialogs appearing in the test suite. 2015-10-08 09:05:36 -07:00
Steve Dower 12ee7448f8 Issue #23919: Prevents assert dialogs appearing in the test suite. 2015-10-08 08:56:06 -07:00
Berker Peksag b6c9572fa9 Sort module names in whatsnew/3.6.rst 2015-10-08 13:58:49 +03:00
Berker Peksag 960e848f0d Issue #16099: RobotFileParser now supports Crawl-delay and Request-rate
extensions.

Patch by Nikolay Bogoychev.
2015-10-08 12:27:06 +03:00
Berker Peksag 2137dc1573 Issue #16802: Document fileno parameter of socket.socket()
Patch by Henrik Heimbuerger and Bar Harel.
2015-10-08 06:34:57 +03:00
Berker Peksag ce88d82ec2 Issue #16802: Document fileno parameter of socket.socket()
Patch by Henrik Heimbuerger and Bar Harel.
2015-10-08 06:34:31 +03:00
Berker Peksag 24a610984d Issue #16802: Document fileno parameter of socket.socket()
Patch by Henrik Heimbuerger and Bar Harel.
2015-10-08 06:34:01 +03:00
Martin Panter c2432f6edb One more typo in a comment 2015-10-07 11:15:15 +00:00
Martin Panter 585a6acfef Merge typo fixes from 3.5 2015-10-07 11:13:55 +00:00
Martin Panter ec1aa5c2a1 More typos in 3.5 documentation and comments 2015-10-07 11:03:53 +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
Martin Panter 6568714366 Issue #25286: Merge dictionary view glossary from 3.5 2015-10-07 10:04:49 +00:00
Martin Panter 397625e432 Issue #25286: Update dictionary view link; patch by Akira Li 2015-10-07 10:03:20 +00:00
Martin Panter 446977c080 Issue #25286: Merge dictionary view glossary from 3.4 into 3.5 2015-10-07 10:01:04 +00:00
Martin Panter 85b8f45515 Issue #25286: Dictionary views are not sequences
Also change glossary heading from view
2015-10-07 09:56:46 +00:00
Berker Peksag 6f038ada5b Add a versionadded directive for reopenIfNeeded() 2015-10-07 07:54:23 +03:00
Benjamin Peterson 3c5f003023 make configure executable 2015-10-06 21:17:02 -07:00
Raymond Hettinger 6bb7b91e94 merge 2015-10-06 23:08:11 -04:00
Raymond Hettinger 848f2b595d Backport early-out 91259f061cfb to reduce the cost of bb1a2944bcb6 2015-10-06 23:06:17 -04:00
Benjamin Peterson cdae2cb88a merge 3.5 (closes #24806) 2015-10-06 19:42:46 -07:00
Benjamin Peterson 59dc696821 merge 3.4 (#24806) 2015-10-06 19:42:02 -07:00
Benjamin Peterson bd6c41a185 prevent unacceptable bases from becoming bases through multiple inheritance (#24806) 2015-10-06 19:36:54 -07:00
Zachary Ware 4d17a6acee Issue #25097: Merge with 3.5 2015-10-06 15:29:09 -05:00
Zachary Ware 479ac6654c Issue #25097: Merge with 3.4 2015-10-06 15:28:56 -05:00
Zachary Ware 106ddf07b3 Issue #25097: Re-raise any other pywin32 error 2015-10-06 15:28:43 -05:00
Zachary Ware c456861f99 Issue #25097: Merge with 3.5 2015-10-06 15:23:16 -05:00
Zachary Ware af34b248d1 Issue #25097: Merge with 3.4 2015-10-06 15:22:41 -05:00
Zachary Ware 22226c5595 Issue #25097: fix Windows error number access 2015-10-06 15:22:13 -05:00
Alexander Belopolsky 68713e41a5 Closes issue #12006: Add ISO 8601 year, week, and day directives to strptime.
This commit adds %G, %V, and %u directives to strptime.  Thanks Ashley Anderson
for the implementation.
2015-10-06 13:29:56 -04:00
Serhiy Storchaka fc632e3912 Merge with 3.5. 2015-10-06 18:52:52 +03:00