Commit Graph

7389 Commits

Author SHA1 Message Date
Victor Stinner
9a644b23cc Issue #9566: recv(), recvfrom(), send(), sendall() and sendto() methods
of socket.socket objects now truncate the input buffer to INT_MAX bytes on
Windows to avoid an integer overflow.

(sendall() still send the whole buffer.)
2013-06-24 23:47:41 +02:00
Victor Stinner
71765770a4 Issue #9566: _winapi.WriteFile() now truncates length to DWORD_MAX (4294967295) 2013-06-24 23:13:24 +02:00
Victor Stinner
bc8ccce729 Issue #9566: zlib: Explicit cast to unsigned int to fix a compiler warning on Windows x64 2013-06-24 23:02:51 +02:00
Victor Stinner
9a282975ef Issue #9566: _io: Use Py_SAFE_DOWNCAST for fix a compiler warning on Windows x64 2013-06-24 23:01:33 +02:00
Raymond Hettinger
b4f39eea49 merge 2013-06-23 15:47:03 -07:00
Raymond Hettinger
20b0f87e1d Misc improvements to collections.deque()
* Clarified comment on the impact of BLOCKLEN on deque_index
  (with a power-of-two, the division and modulo
   computations are done with a right-shift and bitwise-and).

* Clarified comment on the overflow check to note that
  it is general and not just applicable the 64-bit builds.

* In deque._rotate(), the "deque->" indirections are
  factored-out of the loop (loop invariant code motion),
  leaving the code cleaner looking and slightly faster.

* In deque._rotate(), replaced the memcpy() with an
  equivalent loop.  That saved the memcpy setup time
  and allowed the pointers to move in their natural
  leftward and rightward directions.

See comparative timings at:  http://pastebin.com/p0RJnT5N
2013-06-23 15:44:33 -07:00
Christian Heimes
5b2f18411b Issue #11016: Don't define macros and constants that are already set by pyport.h 2013-06-24 00:13:14 +02:00
Christian Heimes
99d6135a15 Define S_IFMT and S_IFLNK in pyport.h so posixmodule.c can use named constants instead
of arbitrary looking numbers.
2013-06-23 23:56:05 +02:00
Christian Heimes
9975877f46 Check for correct macro, code uses S_ISDIR(). 2013-06-23 23:52:40 +02:00
Christian Heimes
91e8b8180d Check for correct macro, code uses S_ISDIR(). 2013-06-23 23:51:44 +02:00
Victor Stinner
1ce46d99db Issue #11016: Detect integer conversion on conversion from Python int to C mode_t 2013-06-23 22:57:43 +02:00
Christian Heimes
858c947155 Fix a typo in S_ISDIR, S_ISCHR, S_ISBLK and S_ISREG.
Add extra braces to S_IS*() macros
2013-06-23 22:57:02 +02:00
Victor Stinner
8cfd67cfe7 (Merge 3.3) Issue #18135: Fix a possible integer overflow in
ssl.SSLSocket.write() and in ssl.SSLContext.load_cert_chain() for strings and
passwords longer than 2 gigabytes.
2013-06-23 15:09:26 +02:00
Victor Stinner
9ee0203057 Issue #18135: Fix a possible integer overflow in ssl.SSLSocket.write()
and in ssl.SSLContext.load_cert_chain() for strings and passwords longer
than 2 gigabytes.
2013-06-23 15:08:23 +02:00
Victor Stinner
4569cd5eab _ssl.c: strip trailing spaces 2013-06-23 14:58:43 +02:00
Victor Stinner
c6ebd16a20 Issue #11016: Try to fix compilaton of the new _stat.c module on Windows 2013-06-23 01:49:42 +02:00
Andrew Kuchling
0e03d6f2e9 Merge from 3.3 2013-06-22 19:27:59 -04:00
Andrew Kuchling
da30acf50b Closes #18220: expand itertools.islice docstring to 2 lines 2013-06-22 19:20:54 -04:00
Andrew Kuchling
446a39f78f Close #18285: add 'repeat' parameter to docstring for product 2013-06-22 19:04:11 -04:00
Christian Heimes
c77d9f38c2 Issue #11016: Add C implementation of the stat module as _stat 2013-06-22 21:05:02 +02:00
Andrew Kuchling
6ce8d17d02 Merge from 3.3 2013-06-22 14:57:45 -04:00
Andrew Kuchling
9290dd14b0 #18113: avoid segfault if Py_XDECREF triggers code that calls set_panel_userptr again
Problem noted & original patch by Serhiy Storchaka; I tweaked the patch a bit.
2013-06-22 14:50:56 -04:00
Andrew Kuchling
3468d25a80 Merge from 3.3 2013-06-21 08:07:35 -04:00
Andrew Kuchling
b003ffa0ab Closes #18239: correct description of count() in module docstring 2013-06-21 07:58:35 -04:00
Brett Cannon
83358c9f13 Grammatical mistake in a comment 2013-06-20 21:30:32 -04:00
Benjamin Peterson
15a7d2e8d6 merge 3.3 (#18248) 2013-06-19 09:01:58 -07:00
Benjamin Peterson
19886b8adc fix libffi build on AIX (closes #18248) 2013-06-19 09:01:42 -07:00
Christian Heimes
262e7f389c fixed libffi on PPC without __NO_FPRS__
ISO C90 forbids mixed declarations and code
2013-06-19 02:43:19 +02:00
Christian Heimes
2f13f546e6 fixed libffi on PPC without __NO_FPRS__
ISO C90 forbids mixed declarations and code
2013-06-19 02:40:38 +02:00
Christian Heimes
71515510d8 Issue #18259: Declare sethostname in socketmodule.c for AIX 2013-06-19 02:07:20 +02:00
Christian Heimes
d2774c7d09 Issue #18259: Declare sethostname in socketmodule.c for AIX 2013-06-19 02:06:29 +02:00
Christian Heimes
360b89ca5e Fix for r84195: add HAVE_ALLOCA_H to configure and only include alloca.h if it's available 2013-06-18 13:22:37 +02:00
Christian Heimes
f0400baba8 Fix for r84195: add HAVE_ALLOCA_H to configure and only include alloca.h if it's available 2013-06-18 13:22:17 +02:00
Victor Stinner
8f0aae54ba (Merge 3.3) ctypes: AIX needs an explicit #include <alloca.h> to get alloca() 2013-06-17 22:02:14 +02:00
Victor Stinner
43b2639fe2 ctypes: AIX needs an explicit #include <alloca.h> to get alloca() 2013-06-17 22:01:53 +02:00
Christian Heimes
9a5395ae2b Issue #18147: Add diagnostic functions to ssl.SSLContext().
get_ca_list() lists all loaded CA certificates and cert_store_stats() returns
amount of loaded X.509 certs, X.509 CA certs and CRLs.
2013-06-17 15:44:12 +02:00
Andrew Kuchling
f567727abc Merge with 3.3 2013-06-16 13:02:55 -04:00
Andrew Kuchling
c7b6c50f29 Describe 'surrogateescape' in the documentation.
Also, improve some docstring descriptions of the 'errors' parameter.

Closes #14015.
2013-06-16 12:58:48 -04:00
Andrew Kuchling
8a2a902f88 Merge with 3.3 2013-06-15 15:10:08 -04:00
Andrew Kuchling
53e5ea7951 #18113: Objects associated to a curses.panel object with set_userptr() were leaked.
Reported by Atsuo Ishimoto.
2013-06-15 14:04:04 -04:00
Victor Stinner
36f01ad9ac Revert changeset 6661a8154eb3: Issue #3329: Add new APIs to customize memory allocators
The new API require more discussion.
2013-06-15 03:37:01 +02:00
Victor Stinner
4d7056258b Issue #3329: Add new APIs to customize memory allocators
* Add a new PyMemAllocators structure
* New functions:

  - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree(): GIL-free memory
    allocator functions
  - PyMem_GetRawAllocators(), PyMem_SetRawAllocators()
  - PyMem_GetAllocators(), PyMem_SetAllocators()
  - PyMem_SetupDebugHooks()
  - _PyObject_GetArenaAllocators(), _PyObject_SetArenaAllocators()

* Add unit test for PyMem_Malloc(0) and PyObject_Malloc(0)
* Add unit test for new get/set allocators functions
* PyObject_Malloc() now falls back on PyMem_Malloc() instead of malloc() if
  size is bigger than SMALL_REQUEST_THRESHOLD, and PyObject_Realloc() falls
  back on PyMem_Realloc() instead of realloc()
* PyMem_Malloc() and PyMem_Realloc() now always call malloc() and realloc(),
  instead of calling PyObject_Malloc() and PyObject_Realloc() in debug mode
2013-06-15 00:37:46 +02:00
Christian Heimes
200bb1b08c Simplify return value of ssl.get_default_verify_paths
prefix function with PySSL_, too. Other module level functions have a prefix, too.
2013-06-14 15:14:29 +02:00
Christian Heimes
75b8426698 fixd refleak 2013-06-10 10:47:22 +02:00
Ronald Oussoren
36451f076b (3.3->default) Ensure that the fix for #17269 also works on OSX 10.4
AI_NUMERICSERV isn't defined on OSX 10.4.
2013-06-10 10:37:12 +02:00
Ronald Oussoren
a822d36675 Ensure that the fix for #17269 also works on OSX 10.4
AI_NUMERICSERV isn't defined on OSX 10.4.
2013-06-10 10:36:28 +02:00
Christian Heimes
46bebee25f Issue #17134: Add ssl.enum_cert_store() as interface to Windows' cert store. 2013-06-09 19:03:31 +02:00
Christian Heimes
142ec2c014 get_default_verify_paths doesn't belong inside the ifdef block 2013-06-09 18:29:54 +02:00
Christian Heimes
6d7ad13a45 Issue #18143: Implement ssl.get_default_verify_paths() in order to debug
the default locations for cafile and capath.
2013-06-09 18:02:55 +02:00
Richard Oudkerk
ac0ad884d1 Issue #17931: Resolve confusion on Windows between pids and process handles. 2013-06-05 23:29:30 +01:00