Commit Graph

8984 Commits

Author SHA1 Message Date
Serhiy Storchaka 9a6e201f7d Issue #15133: _tkinter.tkapp.getboolean() now supports Tcl_Obj and always
returns bool.  tkinter.BooleanVar now validates input values (accepted bool,
int, str, and Tcl_Obj).  tkinter.BooleanVar.get() now always returns bool.
2015-04-04 12:43:01 +03:00
Serhiy Storchaka f8aa133cce Issue #23338: Fixed formatting ctypes error messages on Cygwin.
Patch by Makoto Kato.
2015-04-04 10:06:58 +03:00
Serhiy Storchaka 2e229e025c Issue #23338: Fixed formatting ctypes error messages on Cygwin.
Patch by Makoto Kato.
2015-04-04 10:05:48 +03:00
Serhiy Storchaka 92e8af67a8 Issue #23492: Argument Clinic now generates argument parsing code with
PyArg_Parse instead of PyArg_ParseTuple if possible.
2015-04-04 00:12:11 +03:00
Serhiy Storchaka 1009bf18b3 Issue #23501: Argumen Clinic now generates code into separate files by default. 2015-04-03 23:53:51 +03:00
Larry Hastings 0759f84d62 Issue #23500: Argument Clinic is now smarter about generating the "#ifndef"
(empty) definition of the methoddef macro: it's only generated once, even
if Argument Clinic processes the same symbol multiple times, and it's emitted
at the end of all processing rather than immediately after the first use.
2015-04-03 13:09:02 -07:00
Serhiy Storchaka 45ec3288d0 Removed trailing whitespaces in miscalenous files. 2015-04-03 19:42:32 +03:00
Victor Stinner 4e3cfa46dc Issue #23853: Cleanup _ssl.c
* Rename check_socket_and_wait_for_timeout() to PySSL_select()
* PySSL_select() is now clearly splitted betwen poll() and select()
* Add empty lines for readability
2015-04-02 21:28:28 +02:00
Victor Stinner 10550cdb8a Issue #23834: Simplify timeout handling
* Use the new _PyTime_FromSeconds() function to set the timeout to -1 second
  for socket.settimeout(None). It avoids a special case in internal_select()
  because of a rounding issue: -1 nanosecond is rounded to 0 millisecond which
  means non-blocking, instead of blocking.
* Check if the interval the negative in sock_call_ex() instead of doing the
  check in internal_select(). sock_call_ex() remembers if the socket has a
  timeout or not, which avoids a race condition if the timeout is modified in a
  different thread.
2015-04-03 13:22:27 +02:00
Victor Stinner 13019fdef3 Issue #22117: Add a new _PyTime_FromSeconds() function
Fix also _Py_InitializeEx_Private(): initialize time before initializing
import, import_init() uses the _PyTime API (for thread locks).
2015-04-03 13:10:54 +02:00
Serhiy Storchaka 4c7dc48ea5 Issue #16840: Tkinter now supports 64-bit integers added in Tcl 8.4 and
arbitrary precision integers added in Tcl 8.5.
2015-04-02 18:49:14 +03:00
Serhiy Storchaka ea134da929 Issue #16840: Tkinter now supports 64-bit integers added in Tcl 8.4 and
arbitrary precision integers added in Tcl 8.5.
2015-04-02 18:46:50 +03:00
Victor Stinner 8e44aa5ae4 Issue #23834: Fix socket.sendto(), use the C Py_ssize_t type to store the
result of sendto() instead of the C int type.
2015-04-02 17:16:08 +02:00
Victor Stinner 33f96f1800 Merge 3.4 (_posixsubprocess) 2015-04-02 16:25:01 +02:00
Victor Stinner e7c749238e Issue #23851: close() must not be retried when it fails with EINTR
See the PEP 475 for the rationale.
2015-04-02 16:24:46 +02:00
Victor Stinner a135cb8143 Issue #23618: Ooops, remove abort() added for debug purpose 2015-04-02 15:17:12 +02:00
Victor Stinner 38aec7525e Issue #23618: Fix sock_connect_impl(), set the socket error code
sock_call_ex() gets the socket error code when the socket function fails.
sock_connect_impl() didn't set the error correctly.
2015-04-02 14:37:20 +02:00
Victor Stinner 81c41dbfcc Issue #23618: socket.socket.connect() now waits until the connection completes
instead of raising InterruptedError if the connection is interrupted by
signals, signal handlers don't raise an exception and the socket is blocking or
has a timeout.

socket.socket.connect() still raise InterruptedError for non-blocking sockets.
2015-04-02 11:50:57 +02:00
Victor Stinner 35bee932e4 Issue #23618: Don't declare recvmsg/sendmsg helper functions on Windows 2015-04-02 12:28:07 +02:00
Serhiy Storchaka b452f41cc8 Issue #21526: Fixed support of new boolean type in Tcl 8.5. 2015-04-02 10:58:40 +03:00
Serhiy Storchaka f7de3dd02d Issue #21526: Tkinter now supports new boolean type in Tcl 8.5. 2015-04-02 10:35:57 +03:00
Victor Stinner ff444e828e Issue #23834: Fix sock_call(), set deadline_initialized to recompute the timeout 2015-04-02 03:22:49 +02:00
Victor Stinner 02f32ab47e Issue #23834: Modify socket.sendall() to reuse sock_call() with
sock_send_impl()
2015-04-01 22:53:26 +02:00
Victor Stinner 31bf2d5073 Issue #23834: Add sock_call() helper function
The BEGIN_SELECT_LOOP and END_SELECT_LOOP macros of socketmodule.c don't handle
EINTR. Functions using these macros use an inner loop to handle EINTR, but they
don't recompute the timeout.

This changes replaces the two macros with a new sock_call() function which
takes a function as a parameter. sock_call() recomputes the timeout, handle
false positive and handle EINTR.
2015-04-01 21:57:09 +02:00
Victor Stinner c7489a5595 Issue #23836: Fix the faulthandler module to handle reentrant calls
to its signal handlers.

Use also _Py_write_noraise() instead of write() to retry write() if it is
interrupted by a signal (fail with EINTR).

faulthandler.dump_traceback() also calls PyErr_CheckSignals() to call the
Python signal handler if a signal was received.
2015-04-01 18:48:58 +02:00
Victor Stinner 185fd33a17 Issue #23836: Use _Py_write_noraise() to retry on EINTR in child_exec() of
_posixsubprocess
2015-04-01 18:35:53 +02:00
Victor Stinner e72fe3995b Issue #23836: Use _Py_write_noraise() to retry on EINTR in trip_signal() of
signalmodule.c
2015-04-01 18:35:22 +02:00
Benjamin Peterson 81541f4480 merge 3.4 2015-04-01 12:37:34 -04:00
Victor Stinner 62d1c70eff Issue #22117, issue #23485: Fix _PyTime_AsMilliseconds() and
_PyTime_AsMicroseconds() rounding.

Add also unit tests.
2015-04-01 17:47:07 +02:00
Benjamin Peterson 4fd929b431 remove assignment in conditional 2015-04-01 11:16:40 -04:00
Victor Stinner a772662423 Issue #23618: Fix EINTR handling on Windows
Windows uses WSAEINTR error code, not EINTR, for socket functions.
2015-04-01 11:09:43 +02:00
Victor Stinner 70a46f635f Issue #23618: Enhance EINTR handling in socket.connect()
Call PyErr_CheckSignals() immediatly if connect() or select() fails with EINTR
in internal_connect().

Refactor also the code to limit indentaton and make it more readable.
2015-03-31 22:03:59 +02:00
Victor Stinner ee699e9d2b Issue #23618: Fix EINTR handling in socket.connect()
Call PyErr_CheckSignals() if connect(), select() or getsockopt() failed with
EINTR.
2015-03-31 21:28:42 +02:00
Victor Stinner c4e819a54f Issue #23618: Cleanup internal_connect() in socketmodule.c
On Windows, it looks like using the C type socklen_t for getsockopt() (instead
of int) is fine, it was already used in socket.getsockopt().
2015-03-31 21:23:10 +02:00
Raymond Hettinger 41290a68ba Issue 23793: Add deque support for __add__(), __mul__(), and __imul__(). 2015-03-31 08:12:23 -07:00
Victor Stinner b6c15bcad3 Issue #23618: Refactor internal_connect()
On Windows, internal_connect() now reuses internal_connect_select() and always
calls getsockopt().
2015-03-31 16:35:35 +02:00
Victor Stinner dd88d3db45 Issue #23618: Refactor internal_connect()
The function now returns the error code instead of using the global errno
(POSIX) or WSAGetLastError() (Windows).

internal_connect() now returns errno if getsockopt() fails.
2015-03-31 16:08:22 +02:00
Victor Stinner 1bb0aef4d1 Issue #22117: Fix integer overflow check in socket_parse_timeout() on Windows 2015-03-31 16:31:19 +02:00
Victor Stinner dd83bd2f9c Issue #23618: Fix internal_connect_select() 2015-03-31 14:24:47 +02:00
Victor Stinner 416f2e66ca Issue #23618: internal_connect_select() now waits also for error events 2015-03-31 13:56:29 +02:00
Victor Stinner e6951c6c8a Issue #23618: Refactor internal_select() to prepare socket.connect() for EINTR 2015-03-31 13:50:44 +02:00
Victor Stinner 391fa713f7 Issue #23618: Refactor the _socket module
* Inline internal_select() function
* Rename internal_select_ex() internal_select()
2015-03-31 13:15:31 +02:00
Serhiy Storchaka 58e4134a1c Issue #23611: Serializing more "lookupable" objects (such as unbound methods
or nested classes) now are supported with pickle protocols < 4.
2015-03-31 14:07:24 +03:00
Serhiy Storchaka 72e731cc03 Issue #13583: sqlite3.Row now supports slice indexing.
Tests by Jessica McKellar.
2015-03-31 13:33:11 +03:00
Serhiy Storchaka 80d84c89ee Merge heads 2015-03-31 13:18:35 +03:00
Serhiy Storchaka d5d818d40b Issue #18473: Fixed 2to3 and 3to2 compatible pickle mappings.
Fixed ambigious reverse mappings.  Added many new mappings.  Import mapping
is no longer applied to modules already mapped with full name mapping.

Added tests for compatible pickling and unpickling and for consistency of
_compat_pickle mappings.
2015-03-31 13:17:10 +03:00
Serhiy Storchaka bfe1824d08 Issue #18473: Fixed 2to3 and 3to2 compatible pickle mappings.
Fixed ambigious reverse mappings.  Added many new mappings.  Import mapping
is no longer applied to modules already mapped with full name mapping.

Added tests for compatible pickling and unpickling and for consistency of
_compat_pickle mappings.
2015-03-31 13:12:37 +03:00
Victor Stinner 45ca48b03d Issue #23485: select.devpoll.poll() is now retried when interrupted by a signal 2015-03-31 12:10:33 +02:00
Victor Stinner 4448c08451 Issue #23485: select.kqueue.control() is now retried when interrupted by a signal 2015-03-31 11:48:34 +02:00
Victor Stinner 41eba224de Issue #23485: select.epoll.poll() is now retried when interrupted by a signal 2015-03-30 21:59:21 +02:00
Victor Stinner 3c7d6e0693 Issue #23485: select.poll.poll() is now retried when interrupted by a signal 2015-03-30 21:38:00 +02:00
Victor Stinner 6aa446cf03 PEP 475: on EINTR, retry the function even if the timeout is equals to zero
Retry:

* signal.sigtimedwait()
* threading.Lock.acquire()
* threading.RLock.acquire()
* time.sleep()
2015-03-30 21:33:51 +02:00
Victor Stinner f70e1ca0fc Issue #23485: select.select() is now retried automatically with the recomputed
timeout when interrupted by a signal, except if the signal handler raises an
exception. This change is part of the PEP 475.

The asyncore and selectors module doesn't catch the InterruptedError exception
anymore when calling select.select(), since this function should not raise
InterruptedError anymore.
2015-03-30 21:16:11 +02:00
Victor Stinner e134a7fe36 Issue #23752: _Py_fstat() is now responsible to raise the Python exception
Add _Py_fstat_noraise() function when a Python exception is not welcome.
2015-03-30 10:09:31 +02:00
Serhiy Storchaka 2e1c4e5db2 Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances. 2015-03-30 10:00:40 +03:00
Serhiy Storchaka 04d09ebd39 Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances. 2015-03-30 09:58:41 +03:00
Serhiy Storchaka 7901b48a1f Issue #23171: csv.Writer.writerow() now supports arbitrary iterables. 2015-03-30 09:09:54 +03:00
Victor Stinner a695f83f0d Issue #22117: Remove _PyTime_ROUND_DOWN and _PyTime_ROUND_UP rounding methods
Use _PyTime_ROUND_FLOOR and _PyTime_ROUND_CEILING instead.
2015-03-30 03:57:14 +02:00
Victor Stinner 869e1778c0 Issue #22117: Replace usage of _PyTime_ROUND_UP with _PyTime_ROUND_CEILING
All these functions only accept positive timeouts, so this change has no effect
in practice.
2015-03-30 03:49:14 +02:00
Victor Stinner bcdd777d3c Issue #22117: Add _PyTime_ROUND_CEILING rounding method for timestamps
Add also more tests for ROUNd_FLOOR.
2015-03-30 03:52:49 +02:00
Victor Stinner 520bddf79a Issue #23752: When built from an existing file descriptor, io.FileIO() now only
calls fstat() once. Before fstat() was called twice, which was not necessary.
2015-03-30 03:21:06 +02:00
Victor Stinner ea9c0dd2c2 Issue #22117: Fix usage of _PyTime_AsTimeval()
Add _PyTime_AsTimeval_noraise() function. Call it when it's not possible (or
not useful) to raise a Python exception on overflow.
2015-03-30 02:51:13 +02:00
Victor Stinner 160e819a1d Issue #23694: Fix usage of _Py_open() in the _posixsubprocess module
Don't call _Py_open() from _close_open_fds_safe() because it is call just after
fork(). It's not good to play with locks (the GIL) between fork() and exec().

Use instead _Py_open_noraise() which doesn't touch to the GIL.
2015-03-30 02:18:31 +02:00
Victor Stinner e4a994d617 Issue #22117: Fix rounding of fromtimestamp() methods of datetime.datetime and
datetime.time: round towards minus infinity ("floor") instead of rounding
towards zero ("down").
2015-03-30 01:10:14 +02:00
Victor Stinner dca028b86a Issue #22117: Fix os.utime(), it now rounds the timestamp towards minus
infinity (-inf) instead of rounding towards zero.

Replace _PyTime_ROUND_DOWN with _PyTime_ROUND_FLOOR.
2015-03-30 01:02:57 +02:00
Victor Stinner 09e5cf28ae Issue #22117: Use the _PyTime_t API in _datetime.datetime() constructor
* Remove _PyTime_gettimeofday()
* Add _PyTime_GetSystemClock()
2015-03-30 00:09:18 +02:00
Serhiy Storchaka 07360df481 Issue #14260: The groupindex attribute of regular expression pattern object
now is non-modifiable mapping.
2015-03-30 01:01:48 +03:00
Serhiy Storchaka bfbfc8deb2 Removed unintentional trailing spaces in text files. 2015-03-29 19:12:58 +03:00
Victor Stinner 02937aab13 Issue #22117: Add the new _PyTime_ROUND_FLOOR rounding method for the datetime
module. time.clock_settime() now uses this rounding method instead of
_PyTime_ROUND_DOWN to handle correctly dates before 1970.
2015-03-28 05:02:39 +01:00
Victor Stinner b3b4544070 Issue #22117: Use the _PyTime_t API for time.clock_settime()
Remove also the now unused _PyTime_AddDouble() function.
2015-03-28 04:09:41 +01:00
Victor Stinner c337838af7 Issue #22117: Use the new _PyTime_t API in the select module 2015-03-28 05:07:51 +01:00
Victor Stinner f5faad2bf0 Issue #22117: The thread module uses the new _PyTime_t timestamp API
Add also a new _PyTime_AsMicroseconds() function.

threading.TIMEOUT_MAX is now be smaller: only 292 years instead of 292,271
years on 64-bit system for example. Sorry, your threads will hang a *little
bit* shorter. Call me if you want to ensure that your locks wait longer, I can
share some tricks with you.
2015-03-28 03:52:05 +01:00
Victor Stinner e245231fab Issue #22117: Fix ssl to use _PyTime_t API on sock_timeout
I didn't notice that the ssl module uses private attributes of socket objects.
2015-03-28 03:00:46 +01:00
Victor Stinner 71694d5c8c Issue #22117: The socket module uses _PyTime_t timestamp for timeouts 2015-03-28 01:18:54 +01:00
Victor Stinner 95e9cef6f0 Issue #22117: Write unit tests for _PyTime_AsTimeval()
* _PyTime_AsTimeval() now ensures that tv_usec is always positive
* _PyTime_AsTimespec() now ensures that tv_nsec is always positive
* _PyTime_AsTimeval() now returns an integer on overflow instead of raising an
  exception
2015-03-28 01:26:47 +01:00
Victor Stinner b7df3144ef Issue #23618, #22117: refactor socketmodule.c
Move Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS inside internal_select_ex() to
prepare a switch to the _PyTime_t type and retry syscall on EINTR.
2015-03-27 22:59:32 +01:00
Victor Stinner 34dc0f46ae Issue #22117: The signal modules uses the new _PyTime_t API
* Add _PyTime_AsTimespec()
* Add unit tests for _PyTime_AsTimespec()
2015-03-27 18:19:03 +01:00
Victor Stinner 7181dec3f1 Issue #22117: The gc module now uses _PyTime_t timestamp 2015-03-27 17:47:53 +01:00
Victor Stinner a47b881d86 Issue #22117: time.time() now uses the new _PyTime_t API
* Add _PyTime_GetSystemClockWithInfo()
2015-03-27 18:16:17 +01:00
Victor Stinner 4bfb460d88 Issue #22117: time.monotonic() now uses the new _PyTime_t API
* Add _PyTime_FromNanoseconds()
* Add _PyTime_AsSecondsDouble()
* Add unit tests for _PyTime_AsSecondsDouble()
2015-03-27 22:27:24 +01:00
Victor Stinner 992c43fec9 Issue #22117: Fix rounding in _PyTime_FromSecondsObject()
* Rename _PyTime_FromObject() to _PyTime_FromSecondsObject()
* Add _PyTime_AsNanosecondsObject() and _testcapi.pytime_fromsecondsobject()
* Add unit tests
2015-03-27 17:12:45 +01:00
Victor Stinner cb29f0177c Issue #22117: Add a new Python timestamp format _PyTime_t to pytime.h
In practice, _PyTime_t is a number of nanoseconds. Its C type is a 64-bit
signed number. It's integer value is in the range [-2^63; 2^63-1]. In seconds,
the range is around [-292 years; +292 years]. In term of Epoch timestamp
(1970-01-01), it can store a date between 1677-09-21 and 2262-04-11.

The API has a resolution of 1 nanosecond and use integer number. With a
resolution on 1 nanosecond, 64-bit IEEE 754 floating point numbers loose
precision after 194 days. It's not the case with this API. The drawback is
overflow for values outside [-2^63; 2^63-1], but these values are unlikely for
most Python modules, except of the datetime module.

New functions:

- _PyTime_GetMonotonicClock()
- _PyTime_FromObject()
- _PyTime_AsMilliseconds()
- _PyTime_AsTimeval()

This change uses these new functions in time.sleep() to avoid rounding issues.

The new API will be extended step by step, and the old API will be removed step
by step. Currently, some code is duplicated just to be able to move
incrementally, instead of pushing a large change at once.
2015-03-27 13:31:18 +01:00
Serhiy Storchaka 632a77e6a3 Issue #22364: Improved some re error messages using regex for hints. 2015-03-25 21:03:47 +02:00
Serhiy Storchaka 7665be6087 Issue #21802: The reader in BufferedRWPair now is closed even when closing
writer failed in BufferedRWPair.close().
2015-03-24 23:21:57 +02:00
Victor Stinner 19276f184f Issue #23654: Fix faulthandler._stack_overflow() for the Intel C Compiler (ICC)
Issue #23654: Turn off ICC's tail call optimization for the stack_overflow
generator. ICC turns the recursive tail call into a loop.

Patch written by Matt Frank.
2015-03-23 21:20:27 +01:00
Steve Dower 2ea51c98db Closes #9445: Removes detection of GetFinalPathNameByHandle 2015-03-20 21:49:12 -07:00
Steve Dower ef42dae7fa Issue #23765: Remove IsBadStringPtr calls in ctypes
Also renames a local to avoid warnings about shadowing
2015-03-24 23:28:54 -07:00
Raymond Hettinger fef9c1b368 Fix typo 2015-03-24 21:12:57 -07:00
Raymond Hettinger 8dbbae2e52 Minor code and comment cleanups. 2015-03-24 21:01:50 -07:00
Serhiy Storchaka 8be6be427d Issue #21802: The reader in BufferedRWPair now is closed even when closing
writer failed in BufferedRWPair.close().
2015-03-24 23:23:28 +02:00
Victor Stinner 91afbb6088 Issue #23753: Move _Py_wstat() from Python/fileutils.c to Modules/getpath.c
I expected more users of _Py_wstat(), but in practice it's only used by
Modules/getpath.c. Move the function because it's not needed on Windows.
Windows uses PC/getpathp.c which uses the Win32 API (ex: GetFileAttributesW())
not the POSIX API.
2015-03-24 12:16:28 +01:00
Victor Stinner f329878e74 Issue #23753: Python doesn't support anymore platforms without stat() or
fstat(), these functions are always required.

Remove HAVE_STAT and HAVE_FSTAT defines, and stop supporting DONT_HAVE_STAT and
DONT_HAVE_FSTAT.
2015-03-24 10:27:50 +01:00
Raymond Hettinger 551350a79f Improve and fix-up comments. 2015-03-24 00:19:53 -07:00
Raymond Hettinger 0f1451c8c0 Issue 23744: Minor speed-up for deque.__bool__(). 2015-03-23 23:23:55 -07:00
Victor Stinner d1f3a002c3 Merge 3.4 (faulthandler ICC) 2015-03-23 21:21:00 +01:00
Serhiy Storchaka f07a4b663d Issue #21526: Tkinter now supports new boolean type in Tcl 8.5. 2015-03-23 00:47:45 +02:00
Victor Stinner efde146b0c Issue #23571: _Py_CheckFunctionResult() now gives the name of the function
which returned an invalid result (result+error or no result without error) in
the exception message.

Add also unit test to check that the exception contains the name of the
function.

Special case: the final _PyEval_EvalFrameEx() check doesn't mention the
function since it didn't execute a single function but a whole frame.
2015-03-21 15:04:43 +01:00
Raymond Hettinger 6921c13bbb Minor nit. Make the rotate() success/fail tests consistent. 2015-03-21 02:03:40 -07:00
Raymond Hettinger ac13ad6a32 For safety, wait to decref deleted values until the deque state has been restored. 2015-03-21 01:53:16 -07:00
Raymond Hettinger 0f6f94778a Fix minor formatting nits and remove unnecessary comment. 2015-03-21 01:42:10 -07:00
Raymond Hettinger 32ea16577d Issue 23704: Add index(), copy(), and insert() to deques. Register deques as a MutableSequence. 2015-03-21 01:37:37 -07:00
Raymond Hettinger 39dadf7abf Issue 23705: Improve the performance of __contains__ checks for deques. 2015-03-20 16:38:56 -07:00
Serhiy Storchaka 17d3a58e39 Issue #22832: Tweaked parameter names for fcntl module to better match
official POSIX documentation.  Updated the documenttion for Python 3.
Patch by Alex Shkop.
2015-03-20 20:04:21 +02:00
Victor Stinner a453cd8d85 Issue #23715: signal.sigwaitinfo() and signal.sigtimedwait() are now retried
when interrupted by a signal not in the *sigset* parameter, if the signal
handler does not raise an exception. signal.sigtimedwait() recomputes the
timeout with a monotonic clock when it is retried.

Remove test_signal.test_sigwaitinfo_interrupted() because sigwaitinfo() doesn't
raise InterruptedError anymore if it is interrupted by a signal not in its
sigset parameter.
2015-03-20 12:54:28 +01:00
Victor Stinner f50e187724 Fix compiler warnings: comparison between signed and unsigned numbers 2015-03-20 11:32:24 +01:00
Victor Stinner fbd6f9ed12 Issue #23696: Chain ZipImportError to the OSError 2015-03-20 10:52:25 +01:00
Victor Stinner 99953006df Issue #23709, #23001: ossaudiodev now uses Py_ssize_t for sizes instead of int
The module is now also "SSIZE_T clean" (for PyArg_Parse...() functions) since
it switched to Py_buffer ("y*" argument format).
2015-03-20 10:37:34 +01:00
Victor Stinner 716a74ea22 Issue #23001: Fix typo 2015-03-20 10:24:18 +01:00
Serhiy Storchaka 8490f5acfe Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and
codecs, that accepted only read-only bytes-like object now accept writable
bytes-like object too.
2015-03-20 09:00:36 +02:00
Victor Stinner 0eac13052c Issue #23646: Fix test_threading on Windows 2015-03-20 03:06:12 +01:00
Victor Stinner 9a8089b32a Issue #23646: Enhance precision of time.sleep() and socket timeout when
interrupted by a signal

Add a new _PyTime_AddDouble() function and remove _PyTime_ADD_SECONDS() macro.
The _PyTime_ADD_SECONDS only supported an integer number of seconds, the
_PyTime_AddDouble() has subsecond resolution.
2015-03-20 01:42:20 +01:00
Victor Stinner 4fa99cdb4c Issue #23709: The ossaudiodev module now retries read/write when interrupted by
a signal (PEP 475).

Use he new _Py_read() and _Py_write() functions.
2015-03-20 00:27:28 +01:00
Victor Stinner 54799672da Issue #23708: select.devpoll now retries its internal write() when interrupted
by a signal (EINTR).

Modify devpoll_flush() to use _Py_write() instead of calling directly write().
2015-03-19 23:33:09 +01:00
Victor Stinner 66aab0c4b5 Issue #23708: Add _Py_read() and _Py_write() functions to factorize code handle
EINTR error and special cases for Windows.

These functions now truncate the length to PY_SSIZE_T_MAX to have a portable
and reliable behaviour. For example, read() result is undefined if counter is
greater than PY_SSIZE_T_MAX on Linux.
2015-03-19 22:53:20 +01:00
Victor Stinner 79d68f929d Issue #23646: If time.sleep() is interrupted by a signal, the sleep is now
retried with the recomputed delay, except if the signal handler raises an
exception (PEP 475).

Modify also test_signal to use a monotonic clock instead of the system clock.
2015-03-19 21:54:09 +01:00
Serhiy Storchaka 009b811d67 Removed unintentional trailing spaces in non-external and non-generated C files. 2015-03-18 21:53:15 +02:00
Victor Stinner cb7e5f6f08 Merge 3.4 (tracemalloc typo) 2015-03-18 16:05:32 +01:00
Victor Stinner 444f124fcf _tracemalloc.c: Fix typo 2015-03-18 16:05:18 +01:00
Victor Stinner e371b3d21a Fix compiler warning in mmapmodule.c (compare signed/unsigned integers) 2015-03-18 15:04:34 +01:00
Victor Stinner 5200f55024 Issue #19428: Handle PyMarshal_Read*() errors in run_pyc_file()
Detect also earlier PyMarshal_Read*() errors in zipimport.
2015-03-18 13:56:25 +01:00
Victor Stinner e42ccd2bfd Issue #23694: Enhance _Py_fopen(), it now raises an exception on error
* If fopen() fails, OSError is raised with the original filename object.
* The GIL is now released while calling fopen()
2015-03-18 01:39:23 +01:00
Victor Stinner a555cfcb73 Issue #23694: Enhance _Py_open(), it now raises exceptions
* _Py_open() now raises exceptions on error. If open() fails, it raises an
  OSError with the filename.
* _Py_open() now releases the GIL while calling open()
* Add _Py_open_noraise() when _Py_open() cannot be used because the GIL is not
  held
2015-03-18 00:22:14 +01:00
Victor Stinner f024d263b4 Issue #23685: Fix usage of PyMODINIT_FUNC in _json, _scproxy, nis, pyexpat
_codecs_cn, _codecs_hk, _codecs_iso2022, _codecs_jp, _codecs_kr and _codecs_tw
modules.

pyexpat.c doesn't need to redeclare PyMODINIT_FUNC, it's already declared in
Include/pyport.h.
2015-03-17 17:48:27 +01:00
Victor Stinner 0c2fd89777 Revert changeset d927047b1d8eb87738676980a24930d053ba2150
Sorry, it was a mistake, the patch is still under review: issue #23646.
2015-03-17 10:49:17 +01:00
Serhiy Storchaka a60c2fe480 Issue #23641: Cleaned out legacy dunder names from tests and docs.
Fixed 2 to 3 porting bug in pynche.ColorDB.
2015-03-12 21:56:08 +02:00
Victor Stinner 945c82eea3 test 2015-03-12 16:19:01 +01:00
Serhiy Storchaka c2ccce791c Issue #23641: Cleaned out legacy dunder names from tests and docs.
Fixed 2 to 3 porting bug in pynche.ColorDB.
Added few tests for __truediv__, __floordiv__ and __matmul__.
2015-03-12 22:01:30 +02:00
Victor Stinner 95bb714ff7 Issue #23566: enable(), register(), dump_traceback() and dump_traceback_later()
functions of faulthandler now accept file descriptors. Patch by Wei Wu.
2015-03-12 15:32:03 +01:00
Steve Dower 8acde7dcce Issue #23524: Change back to using Windows errors for _Py_fstat instead of the errno shim. 2015-03-07 18:14:07 -08:00
Victor Stinner 35a97c0bed Issue #22524: Fix os.scandir() for platforms which don't have a d_type field in
the dirent structure (ex: OpenIndiana).
2015-03-08 02:59:09 +01:00
Victor Stinner 6036e4431d Issue #22524: New os.scandir() function, part of the PEP 471: "os.scandir()
function -- a better and faster directory iterator". Patch written by Ben
Hoyt.
2015-03-08 01:58:04 +01:00
Victor Stinner 4a7cc88472 Issue #23571: PyObject_Call(), PyCFunction_Call() and call_function() now
raise a SystemError if a function returns a result and raises an exception.
The SystemError is chained to the previous exception.

Refactor also PyObject_Call() and PyCFunction_Call() to make them more readable.

Remove some checks which became useless (duplicate checks).

Change reviewed by Serhiy Storchaka.
2015-03-06 23:35:27 +01:00
Steve Dower d81431f587 Issue #23524: Replace _PyVerify_fd function with calling _set_thread_local_invalid_parameter_handler on every thread. 2015-03-06 14:47:02 -08:00
Ned Deily e37a1946c7 Fix regression introduced by changeset 7c6e3358221a that caused compile
errors of _testcapimodule.c with older versions of gcc.
2015-03-05 15:47:10 -08:00
Serhiy Storchaka caa01f861c Fixed GCC version testing. 2015-03-05 23:42:24 +02:00
Victor Stinner a4c727131e Fix "GCC diagnostic" in socketmodule.c
Fix regression of changeset 7c6e3358221a on GCC < 4.4. The _socket module
cannot be compiled on "x86 FreeBSD 7.2 3.x" buildbot anymore.
2015-03-05 14:04:03 +01:00
Benjamin Peterson de8eca4638 merge 3.4 2015-03-04 22:50:25 -05:00
Benjamin Peterson 990fcaac3c expose X509_V_FLAG_TRUSTED_FIRST 2015-03-04 22:49:41 -05:00
Benjamin Peterson b64ae7bf2d merge 3.4 (#23476) 2015-03-04 22:11:48 -05:00
Benjamin Peterson fdb1971587 enable X509_V_FLAG_TRUSTED_FIRST when possible (closes #23476) 2015-03-04 22:11:12 -05:00
Antoine Pitrou 0bfd0a4048 Issue #23576: Avoid stalling in SSL reads when EOF has been reached in the SSL layer but the underlying connection hasn't been closed. 2015-03-04 20:54:57 +01:00
Antoine Pitrou f7f3b0a14a Issue #23576: Avoid stalling in SSL reads when EOF has been reached in the SSL layer but the underlying connection hasn't been closed. 2015-03-04 20:51:55 +01:00
Victor Stinner 9672da7bb4 Issue #23285: Fix handling of EINTR in fileio.c
Fix handling of EINTR: don't return None if PyErr_CheckSignals() raised an
exception.

Initialize also the length outside the loop to only initialize it once.
2015-03-04 18:40:10 +01:00
Raymond Hettinger 87e691240b Minor neatening-up. Make assignments in same order a struct fields. Line-up comments. 2015-03-02 23:32:02 -08:00
Raymond Hettinger f9d9c79aa8 Switch the state variable to unsigned for defined wrap-around behavior. 2015-03-02 22:47:46 -08:00
Raymond Hettinger 30c9074b96 Minor beautification. Move struct definitions to the top. Fix-up a comment. 2015-03-02 22:31:35 -08:00
Raymond Hettinger f30f5b9ba6 Minor code beautification. Replace macro with in-lineable functions. 2015-03-02 22:23:37 -08:00
Raymond Hettinger 3c186ba441 Beautify and better document the use of the size_t cast for bounds checking. 2015-03-02 21:45:02 -08:00
Benjamin Peterson 83d8fc265a merge 3.4 (#23367) 2015-03-02 11:18:56 -05:00
Benjamin Peterson 5061e67f0f merge 3.3 (#23367) 2015-03-02 11:18:40 -05:00
Benjamin Peterson b779bfba45 fix possible overflow bugs in unicodedata (closes #23367) 2015-03-02 11:17:05 -05:00
Steve Dower 3e96f324dc Issue #23451: Update pyconfig.h for Windows to require Vista headers and remove unnecessary version checks. 2015-03-02 08:01:10 -08:00
Alexander Belopolsky e49af34151 Issue #7830: Flatten nested functools.partial. 2015-03-01 15:08:17 -05:00
Alexander Belopolsky e2e178e081 Closes issue #22791: Improved datetime from timestamp methods documentation.
Original patch by Akira Li.
2015-03-01 14:52:07 -05:00
Raymond Hettinger 7f9ea7543e Issue #23553: Use an unsigned cast to tighten-up the bounds checking logic. 2015-03-01 00:38:00 -08:00
Serhiy Storchaka 90295b450c Merge heads 2015-03-01 10:03:46 +02:00
Raymond Hettinger c20830804d Need a (size_t) cast instead of (unsigned) to be big enough for a Py_ssize_t. 2015-02-28 23:29:16 -08:00
Serhiy Storchaka 50adb9fc32 Issue #20204: Added the __module__ attribute to _tkinter classes. 2015-03-01 09:07:10 +02:00
Serhiy Storchaka efdc16f978 Issue #20204: Added the __module__ attribute to _tkinter classes. 2015-03-01 09:06:29 +02:00
Raymond Hettinger a473b9da15 Use unsigned division and modulo for item assignment as well. 2015-02-28 17:49:47 -08:00
Raymond Hettinger 63d1ff2a0b Convert one more division to unsigned arithmetic to speed-up deque_item(). 2015-02-28 07:41:30 -08:00
Raymond Hettinger 7e8c7956a7 Line missed in last checkin 2015-02-27 16:59:29 -08:00
Raymond Hettinger da2850f932 Since the index is always non-negative, use faster unsigned division and modulo. 2015-02-27 12:42:54 -08:00
Raymond Hettinger daf57f25e5 Bump the blocksize up from 62 to 64 to speed up the modulo calculation.
Remove the old comment suggesting that it was desireable to have
blocksize+2 as a multiple of the cache line length.  That would
have made sense only if the block structure start point was always
aligned to a cache line boundary.  However, the memory allocations
are 16 byte aligned, so we don't really have control over whether
the struct spills across cache line boundaries.
2015-02-26 23:21:29 -08:00
Serhiy Storchaka b48af340b9 Silenced minor GCC warnings. 2015-02-26 15:27:57 +02:00
Antoine Pitrou e71258a0e6 Issue #15955: Add an option to limit the output size in bz2.decompress().
Patch by Nikolaus Rath.
2015-02-26 13:08:07 +01:00
Steve Dower f63dab5a84 Back-out wcstok deprecation suppression and updates calls to use wcstok_s. 2015-02-25 20:48:01 -08:00
Serhiy Storchaka 06a13f81ea Issue #23152: Move declarations back to posixmodule.c.
Declarations of Windows-specific auxilary functions need Windows types
from windows.h.  Instead of including windows.h in Python.h and making
it available to all Windows users, it is simpler and safer just move
declarations to the single file that needs them.
2015-02-22 21:34:54 +02:00
Serhiy Storchaka 12ebbc74f1 Issue #23152: Move declaration into a header and exclude from stable API. 2015-02-22 19:39:36 +02:00
Steve Dower bf1f376b3e Issue #23152: Renames time_t_to_FILE_TIME to _Py_time_t_to_FILE_TIME, removes unused struct win32_stat and return value 2015-02-21 15:26:02 -08:00
Steve Dower a2af1a5a5a Issue #23152: Renames attribute_data_to_stat to _Py_attribute_data_to_stat 2015-02-21 10:04:10 -08:00
Steve Dower f2f373f593 Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
2015-02-21 08:44:05 -08:00
Serhiy Storchaka df80706f14 Issue #23215: Multibyte codecs with custom error handlers that ignores errors
consumed too much memory and raised SystemError or MemoryError.
Original patch by Aleksi Torhamo.
2015-02-21 01:21:08 +02:00
Serhiy Storchaka a1543cdcd6 Issue #23215: Multibyte codecs with custom error handlers that ignores errors
consumed too much memory and raised SystemError or MemoryError.
Original patch by Aleksi Torhamo.
2015-02-21 01:19:58 +02:00
Serhiy Storchaka 254dd59068 Issue #5700: io.FileIO() called flush() after closing the file.
flush() was not called in close() if closefd=False.
2015-02-21 00:35:53 +02:00
Serhiy Storchaka a3712a9a6c Issue #5700: io.FileIO() called flush() after closing the file.
flush() was not called in close() if closefd=False.
2015-02-21 00:35:09 +02:00
Serhiy Storchaka 79d8f3f123 Regenerated Argument Clinic checksums. 2015-02-20 12:46:11 +02:00
Raymond Hettinger 7a4f43a8dd Improve struct cache locality by bring commonly accessed fields close together. 2015-02-20 00:50:04 -08:00
Serhiy Storchaka 483405bcca Issue #22883: Got rid of outdated references to PyInt and PyString in comments. 2015-02-17 10:14:30 +02:00
Serhiy Storchaka 3584056ca5 Shoould be Py_MIN, not Py_MAX. 2015-02-16 20:54:03 +02:00
Serhiy Storchaka 26861b0b29 Issue #23450: Fixed possible integer overflows. 2015-02-16 20:52:17 +02:00
Serhiy Storchaka 4d0d982985 Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows.  Added few missed PyErr_NoMemory().
2015-02-16 13:33:32 +02:00
Serhiy Storchaka 1a1ff29659 Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows.  Added few missed PyErr_NoMemory().
2015-02-16 13:28:22 +02:00
Serhiy Storchaka 53fa8b2a4b Fixed few compiler warnings. 2015-02-16 09:40:12 +02:00
Serhiy Storchaka c86ca26d32 Issue #23096: Pickle representation of floats with protocol 0 now is the same
for both Python and C implementations.
2015-02-15 14:18:32 +02:00
Berker Peksag 9ab1cc4fe4 Issue #13637: Improve exception message of a2b_* functions.
Patch by Vajrasky Kok.
2015-02-15 00:31:26 +02:00
Berker Peksag 3cd30c2cee Issue #13637: Improve exception message of a2b_* functions.
Patch by Vajrasky Kok.
2015-02-15 00:31:00 +02:00
Victor Stinner cf40a9e640 Issue #23450: Fix signal.set_wakeup_fd() on Windows
Detect integer overflow on the file descriptor of the socket on 64-bit Python.
2015-02-12 16:34:54 +01:00
Victor Stinner 385efb4d99 Merge 3.4 (faulthandler) 2015-02-11 14:23:46 +01:00
Victor Stinner 7a5567a92c Issue #23433: Fix faulthandler._stack_overflow()
Fix undefined behaviour: don't compare pointers. Use Py_uintptr_t type instead
of void*. It fixes test_faulthandler on Fedora 22 which now uses GCC 5.
2015-02-11 14:23:35 +01:00
Raymond Hettinger eb6b554fbc Update copyright. 2015-02-10 22:37:22 -06:00
Benjamin Peterson 5ef01e9b93 merge 3.4 (#23361) 2015-02-09 21:00:00 -05:00
Benjamin Peterson 22ef9f722e merge 3.3 (#23361) 2015-02-09 20:58:52 -05:00
Benjamin Peterson 8ce6806498 add overflow checking (closes #23361) 2015-02-09 20:58:12 -05:00
Charles-François Natali 6e6c59b508 Issue #23285: PEP 475 -- Retry system calls failing with EINTR. 2015-02-07 13:27:50 +00:00
Serhiy Storchaka 6cfb61f163 Issue #23392: Added tests for marshal C API that works with FILE*. 2015-02-06 09:00:44 +02:00
Serhiy Storchaka b51813403f Issue #23392: Added tests for marshal C API that works with FILE*. 2015-02-06 08:58:56 +02:00
Stefan Krah a7559c04e0 Issue #14203: Temporary fix for the compile failure on Windows. 2015-02-03 22:27:21 +01:00
Stefan Krah 650c1e818d Issue #14203: Remove obsolete support for view==NULL in bytesiobuf_getbuffer()
and array_buffer_getbuf().
2015-02-03 21:43:23 +01:00
Serhiy Storchaka 38c30e6c8e Issue #15381: Fixed a bug in BytesIO.write().
It was expected that string_size == PyBytes_GET_SIZE(buf) if the buffer is
shared, but truncate() and __setstate__() can set string_size without
unsharing the buffer.
2015-02-03 18:51:58 +02:00
Stefan Krah 5178d91be0 Issue #14203: Remove obsolete support for view==NULL in PyBuffer_FillInfo()
and bytearray_getbuffer().  Both functions now raise BufferError in that
case.
2015-02-03 16:57:21 +01:00
Serhiy Storchaka b9765eec5c Issue #15381: Try to fix refcount bug. Empty and 1-byte buffers are always shared. 2015-02-03 14:57:49 +02:00
Serhiy Storchaka 87d0b45485 Issue #15381: Optimized io.BytesIO to make less allocations and copyings. 2015-02-03 11:30:10 +02:00
Serhiy Storchaka 83e802796c Issue #22818: Splitting on a pattern that could match an empty string now
raises a warning.  Patterns that can only match empty strings are now
rejected.
2015-02-03 11:04:19 +02:00
Serhiy Storchaka 32ca3dcb97 Issue #23099: Closing io.BytesIO with exported buffer is rejected now to
prevent corrupting exported buffer.
2015-02-03 09:30:51 +02:00
Serhiy Storchaka c057c3859c Issue #23099: Closing io.BytesIO with exported buffer is rejected now to
prevent corrupting exported buffer.
2015-02-03 02:00:18 +02:00
Serhiy Storchaka 7a27c97216 Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
Used PyMem_New to check overflow.
2015-02-03 01:50:31 +02:00
Serhiy Storchaka b5e8e57555 Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
Used PyMem_New to check overflow.
2015-02-03 01:35:10 +02:00
Serhiy Storchaka dee948b359 Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
Used PyMem_New to check overflow.
2015-02-03 01:34:09 +02:00
Serhiy Storchaka 3dd3e26680 Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:25:42 +02:00
Serhiy Storchaka 4fdb68491e Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:21:08 +02:00
Raymond Hettinger 0e259f18f7 Optimization guides suggest copying memory in an ascending direction when possible. 2015-02-01 22:53:41 -08:00
Benjamin Peterson 5d0bb852a2 merge 3.4 (#23364, #23363) 2015-02-01 21:36:01 -05:00
Benjamin Peterson c468b537cd merge 3.3 (#23364, #23363) 2015-02-01 21:35:34 -05:00
Benjamin Peterson 0eaabf1c05 check for overflows in permutations() and product() (closes #23363, closes #23364) 2015-02-01 21:34:07 -05:00
Benjamin Peterson 38d9772622 merge 3.4 (#23365) 2015-02-01 21:11:54 -05:00
Benjamin Peterson f635dc32b1 merge 3.3 (#23365) 2015-02-01 21:11:39 -05:00
Benjamin Peterson 6f082297b2 check for overflow in combinations_with_replacement (closes #23365) 2015-02-01 21:10:47 -05:00
Benjamin Peterson 4db56d5002 merge 3.4 (#23366) 2015-02-01 21:01:43 -05:00
Benjamin Peterson 819c4e9bc4 merge 3.3 (#23366) 2015-02-01 21:00:15 -05:00
Benjamin Peterson 4b40eeb339 detect overflow in combinations (closes #23366) 2015-02-01 20:59:00 -05:00
Benjamin Peterson 71cf91cc09 merge 3.4 (#23369) 2015-02-01 18:00:19 -05:00
Benjamin Peterson 3675cd9db1 merge 3.3 (#23369) 2015-02-01 17:59:49 -05:00
Benjamin Peterson e3bfe19358 fix possible overflow in encode_basestring_ascii (closes #23369) 2015-02-01 17:53:53 -05:00
Stefan Krah 2e6658b4a7 Merge from 3.4. 2015-02-01 19:19:49 +01:00
Stefan Krah 7213fcc27e Issue #23370: Fix off-by-one error for non-contiguous buffers. 2015-02-01 16:19:23 +01:00
Stefan Krah 363af44a4a Issue #22445: PyBuffer_IsContiguous() now implements precise contiguity
tests, compatible with NumPy's NPY_RELAXED_STRIDES_CHECKING compilation
flag.  Previously the function reported false negatives for corner cases.
2015-02-01 14:53:54 +01:00
Gregory P. Smith bd4976bbd3 Always #define _PyLong_FromDev as we always need it to compile rather than
only defining it when HAVE_MKNOD && HAVE_MAKEDEV are true.

This "oops" issue reported by John E. Malmberg on core-mentorship.
(what kinds of systems don't HAVE_MKNOD && HAVE_MAKEDEV?)
2015-01-28 16:08:07 -08:00
Gregory P. Smith 702dada2c5 Always #define _PyLong_FromDev as we always need it to compile rather than
only defining it when HAVE_MKNOD && HAVE_MAKEDEV are true.

This "oops" issue reported by John E. Malmberg on core-mentorship.
(what kinds of systems don't HAVE_MKNOD && HAVE_MAKEDEV?)
2015-01-28 16:07:52 -08:00
Benjamin Peterson c54de47759 ifdef our way to compatibility with old openssl (closes #23335) 2015-01-28 12:06:39 -05:00
Benjamin Peterson 07f0515667 disable ALPN on LibreSSL, which has a large version number, but not ALPN support (closes #23329) 2015-01-27 11:10:18 -05:00
Victor Stinner 3bf8684c5e Merge 3.4 (asyncio) 2015-01-26 22:43:52 +01:00
Victor Stinner 498b1f62db asyncio, _overlapped.ConnectPipe(): release the GIL 2015-01-26 22:43:39 +01:00
Victor Stinner c27a8afcb0 Merge 3.4 (asyncio) 2015-01-26 22:31:03 +01:00
Victor Stinner 41063d2a59 asyncio, Tulip issue 204: Fix IocpProactor.recv()
If ReadFile() fails with ERROR_BROKEN_PIPE, the operation is not pending: don't
register the overlapped.

I don't know if WSARecv() can fail with ERROR_BROKEN_PIPE. Since
Overlapped.WSARecv() already handled ERROR_BROKEN_PIPE, let me guess that it
has the same behaviour than ReadFile().
2015-01-26 22:30:49 +01:00
Serhiy Storchaka 47efb4a5dc Issue #19361: JSON decoder now raises JSONDecodeError instead of ValueError. 2015-01-26 13:16:30 +02:00
Steve Dower 7d0e0c9f7b Closes #23253: Delay-load ShellExecute 2015-01-24 08:18:24 -08:00
Benjamin Peterson 8861502e07 prefer server alpn ordering over the client's 2015-01-23 17:30:26 -05:00
Benjamin Peterson cca2732a82 add support for ALPN (closes #20188) 2015-01-23 16:35:37 -05:00
Victor Stinner 5da0549154 Merge 3.4 (asyncio) 2015-01-22 23:50:34 +01:00
Victor Stinner 2b77c5467f asyncio, Tulip issue 204: Fix IocpProactor.accept_pipe()
Overlapped.ConnectNamedPipe() now returns a boolean: True if the pipe is
connected (if ConnectNamedPipe() failed with ERROR_PIPE_CONNECTED), False if
the connection is in progress.

This change removes multiple hacks in IocpProactor.
2015-01-22 23:50:03 +01:00
Victor Stinner 58c85144db Merge 3.4 (asyncio) 2015-01-22 22:55:31 +01:00
Victor Stinner 7ffa2c5fdd Issue #23293, asyncio: Rewrite IocpProactor.connect_pipe()
Add _overlapped.ConnectPipe() which tries to connect to the pipe for
asynchronous I/O (overlapped): call CreateFile() in a loop until it doesn't
fail with ERROR_PIPE_BUSY. Use an increasing delay between 1 ms and 100 ms.

Remove Overlapped.WaitNamedPipeAndConnect() which is no more used.
2015-01-22 22:55:08 +01:00
Victor Stinner 91d11bbb2d Merge 3.4 (asyncio) 2015-01-21 23:40:19 +01:00
Victor Stinner d0a28dee78 Issue #23095, asyncio: Rewrite _WaitHandleFuture.cancel()
This change fixes a race conditon related to _WaitHandleFuture.cancel() leading
to Python crash or "GetQueuedCompletionStatus() returned an unexpected event"
logs. Before, the overlapped object was destroyed too early, it was possible
that the wait completed whereas the overlapped object was already destroyed.
Sometimes, a different overlapped was allocated at the same address, leading to
unexpected completition.

_WaitHandleFuture.cancel() now waits until the wait is cancelled to clear its
reference to the overlapped object. To wait until the cancellation is done,
UnregisterWaitEx() is used with an event instead of UnregisterWait().

To wait for this event, a new _WaitCancelFuture class was added. It's a
simplified version of _WaitCancelFuture. For example, its cancel() method calls
UnregisterWait(), not UnregisterWaitEx(). _WaitCancelFuture should not be
cancelled.

The overlapped object is kept alive in _WaitHandleFuture until the wait is
unregistered.

Other changes:

* Add _overlapped.UnregisterWaitEx()
* Remove fast-path in IocpProactor.wait_for_handle() to immediatly set the
  result if the wait already completed. I'm not sure that it's safe to
  call immediatly UnregisterWaitEx() before the completion was signaled.
* Add IocpProactor._unregistered() to forget an overlapped which may never be
  signaled, but may be signaled for the next loop iteration. It avoids to
  block forever IocpProactor.close() if a wait was cancelled, and it may also
  avoid some "... unexpected event ..." warnings.
2015-01-21 23:39:51 +01:00
Zachary Ware b4826c3fd1 Merge with 3.4 (closes #23280) 2015-01-20 14:11:38 -06:00
Zachary Ware b176d40398 Issue #23280: Fix docstrings for binascii.(un)hexlify 2015-01-20 13:59:46 -06:00
Antoine Pitrou 3b225d8bfb Issue #23248: Update ssl error codes from latest OpenSSL git master. 2015-01-18 17:40:17 +01:00
Antoine Pitrou 173ad83b07 Issue #23248: Update ssl error codes from latest OpenSSL git master. 2015-01-18 17:39:32 +01:00
Serhiy Storchaka 82e07b92b3 Issue #23181: More "codepoint" -> "code point". 2015-01-18 11:33:31 +02:00
Serhiy Storchaka d3faf43f9b Issue #23181: More "codepoint" -> "code point". 2015-01-18 11:28:37 +02:00
Serhiy Storchaka acdb7c158a Issue #23098: 64-bit dev_t is now supported in the os module. 2015-01-18 11:17:39 +02:00
Serhiy Storchaka b2653b344e Issue #23098: 64-bit dev_t is now supported in the os module. 2015-01-18 11:12:11 +02:00
Antoine Pitrou 26795baaa8 Issue #15955: Add an option to limit output size when decompressing LZMA data.
Patch by Nikolaus Rath and Martin Panter.
2015-01-17 16:22:18 +01:00
Benjamin Peterson 610bc6a211 merge 3.4 (#23221) 2015-01-13 09:20:31 -05:00
Benjamin Peterson 82f34ada45 fix instances of consecutive articles (closes #23221)
Patch by Karan Goel.
2015-01-13 09:17:24 -05:00
Antoine Pitrou dc3eaa80d4 Issue #23206: Make ``json.dumps(..., ensure_ascii=False)`` as fast as the default case of ``ensure_ascii=True``. Patch by Naoki Inada. 2015-01-11 16:41:01 +01:00
Mark Dickinson cc8617b93a Issue #21092: Merge from 3.4. 2015-01-11 13:22:44 +00:00
Mark Dickinson dfe0b2326b Issue #21902: Replace incorrect 'hyperbolic arc sine' (etc.) with 'inverse hyperbolic sine' (etc.). Remove meaningless reference to radians. 2015-01-11 13:08:05 +00:00
Mark Dickinson a5d0c7c2fd Issue #23185: add math.inf and math.nan constants. 2015-01-11 11:55:29 +00:00
Benjamin Peterson baf7c1e546 use SSL_get_session 2015-01-07 11:32:00 -06:00
Benjamin Peterson 4cb17812d9 expose the client's cipher suites from the handshake (closes #23186) 2015-01-07 11:14:26 -06:00
Nick Coghlan 582acb75e9 Merge issue 19548 changes from 3.4 2015-01-07 00:37:01 +10:00
Nick Coghlan b9fdb7a452 Issue 19548: update codecs module documentation
- clarified the distinction between text encodings and other codecs
- clarified relationship with builtin open and the io module
- consolidated documentation of error handlers into one section
- clarified type constraints of some behaviours
- added tests for some of the new statements in the docs
2015-01-07 00:22:00 +10:00
Victor Stinner fcfed19913 Issue #21356: Make ssl.RAND_egd() optional to support LibreSSL. The
availability of the function is checked during the compilation. Patch written
by Bernard Spil.
2015-01-06 13:54:58 +01:00
Antoine Pitrou bc26646505 Issue #23143: Remove compatibility with OpenSSLs older than 0.9.8.
(now the hashlib module)
2015-01-03 23:21:21 +01:00
Antoine Pitrou 5e8430d02c Issue #23143: Remove compatibility with OpenSSLs older than 0.9.8.
(the last 0.9.7 release was in 2007)
2015-01-03 23:17:23 +01:00
Benjamin Peterson 98beb7599e merge 3.4 (#23093) 2014-12-21 21:00:51 -06:00
Benjamin Peterson 10e76b67c9 allow more operations to work on detached streams (closes #23093)
Patch by Martin Panter.
2014-12-21 20:51:50 -06:00
Steve Dower 2a8ef68028 Issue #22733: MSVC ffi_prep_args doesn't handle 64-bit arguments properly 2014-12-17 06:31:44 -08:00
Serhiy Storchaka 707b5ccde5 Issue #22783: Pickling now uses the NEWOBJ opcode instead of the NEWOBJ_EX
opcode if possible.
2014-12-16 19:43:46 +02:00
Serhiy Storchaka 01bdd9a980 Issue #15513: Added a __sizeof__ implementation for pickle classes. 2014-12-16 19:40:58 +02:00
Serhiy Storchaka 5bbd231f27 Issue #15513: Added a __sizeof__ implementation for pickle classes. 2014-12-16 19:39:08 +02:00
Benjamin Peterson e32467cf6a allow ssl module to compile if openssl doesn't support SSL 3 (closes #22935)
Patch by Kurt Roeckx.
2014-12-05 21:59:35 -05:00
Serhiy Storchaka b757c83ec6 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:25:22 +02:00
Serhiy Storchaka 56a6d855e2 Removed duplicated words in in comments and docs. 2014-12-01 18:28:43 +02:00
Benjamin Peterson 7243b574e5 don't require OpenSSL SNI to pass hostname to ssl functions (#22921)
Patch by Donald Stufft.
2014-11-23 17:04:34 -06:00
Steve Dower 65e4cb10d9 Issue #22919: Windows build updated to support VC 14.0 (Visual Studio 2015), which will be used for the official 3.5 release. 2014-11-22 12:54:57 -08:00
Benjamin Peterson 22293df016 merge 3.4 (#22935) 2014-12-05 22:11:33 -05:00
Victor Stinner cbc18f328c Issue #9647: os.confstr() ensures that the second call to confstr() returns the
same length.
2014-12-05 22:51:51 +01:00
Serhiy Storchaka 92bf919ed0 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:26:10 +02:00
Serhiy Storchaka 4954f9fcab Issue #17401: Output the closefd attribute as boolean. 2014-12-02 23:39:56 +02:00
Antoine Pitrou 6cd5eda0dd Fix uninitialized variable after #22676. 2014-12-02 00:20:03 +01:00
Serhiy Storchaka 83000a490a Removed duplicated words in in comments and docs. 2014-12-01 18:30:14 +02:00
Victor Stinner beeb512fe1 Issue #21356: Make ssl.RAND_egd() optional to support LibreSSL. The
availability of the function is checked during the compilation.

Patch written by Bernard Spil.
2014-11-28 13:28:25 +01:00
Ned Deily 8007cbc4d5 Issue 22940: fixes to editline support 2014-11-26 13:02:33 -08:00
Benjamin Peterson d1e22ba7db only support append_history if readline has it 2014-11-26 14:35:12 -06:00
Benjamin Peterson 33f8f15bdd add readline.append_history_file (closes #22940)
patch by "bru"
2014-11-26 13:58:16 -06:00
Benjamin Peterson f9284ae8ed merge 3.4 (#22921) 2014-11-23 17:06:39 -06:00
Nick Coghlan d600951748 Issue #22869: Split pythonrun into two modules
- interpreter startup and shutdown code moved to a new
  pylifecycle.c module
- Py_OptimizeFlag moved into the new module with the other
  global flags
2014-11-20 21:39:37 +10:00
Benjamin Peterson 994c7f76a3 merge 3.4 (#22849) 2014-11-12 10:23:35 -05:00
Benjamin Peterson 6c14f23100 fix possible double free in TextIOWrapper.__init__ (closes #22849) 2014-11-12 10:19:46 -05:00
Serhiy Storchaka 5a8dacf9c6 Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian
platforms.
2014-11-10 11:25:50 +02:00
Serhiy Storchaka d915b0847d Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian
platforms.
2014-11-10 10:42:26 +02:00
Brett Cannon b7299ddbc7 Issue 20152, 22821: Port the fcntl module to Argument Clinic.
Along the way, fix an argumrnt to fcntl.fcntl to be an int instead of
a long.

Thanks to Serhiy Storchaka for reviewing my Clinic patch and for
writing the patch to fix the long/int issue.
2014-11-09 20:22:01 -05:00
Benjamin Peterson 8726f2b89c merge 3.4 2014-11-06 00:53:18 -05:00
Benjamin Peterson abd1c97bd2 fix test where sizeof(long) != sizeof(int) 2014-11-06 00:52:58 -05:00
Steve Dower 5c2939cc41 Issue #20160: broken ctypes calling convention on MSVC / 64-bit Windows (large structs) Patch by mattip 2014-11-05 19:30:30 -08:00
Victor Stinner ce43f38ace Issue #20597: Remove unused definition of PATH_MAX on Windows, MAXPATHLEN is
now preferred. Patch written by Jeffrey Armstrong.
2014-11-05 15:11:34 +01:00
Steve Dower b7fa201113 Issue #20160: broken ctypes calling convention on MSVC / 64-bit Windows (large structs) Patch by mattip 2014-11-04 21:21:22 -08:00
Antoine Pitrou d39e199a0d Issue #22773: fix failing test with old readline versions due to issue #19884. 2014-11-04 14:53:01 +01:00
Antoine Pitrou 7e8b8678f1 Issue #22773: fix failing test with old readline versions due to issue #19884. 2014-11-04 14:52:10 +01:00
Serhiy Storchaka 4b8f8949b4 Issue #17381: Fixed handling of case-insensitive ranges in regular expressions.
Added new opcode RANGE_IGNORE.
2014-10-31 12:36:56 +02:00
Georg Brandl 587bac1a0a merge with 3.4 2014-10-28 22:24:52 +01:00
Georg Brandl e48ec212e8 Fix typo. 2014-10-28 22:24:46 +01:00
Antoine Pitrou fce60eaf15 Issue #22676: Make the pickling of global objects which don't have a __module__ attribute less slow. 2014-10-23 22:47:50 +02:00
Victor Stinner f427a14156 Issue #22592: Drop support of the Borland C compiler to build Python
The distutils module still supports it to build extensions.
2014-10-22 12:33:23 +02:00
Robert Collins 933430ab69 Issue #17401: document closefd in io.FileIO docs and add to repr
closefd was documented in the open docs but not the matching FileIO
class documented. Further, closefd, part of the core state for the
object was not shown.

In review it was noted that the open docs are a little confusing about
the interaction between closefd and paths, so tweaked them at the same
time.
2014-10-18 13:32:43 +13:00
Brett Cannon b0fc490307 Issue #20152: Convert the cmath module to Argument Clinic. 2014-10-14 17:37:02 -04:00
Larry Hastings dfbeb160de Issue #22615: Argument Clinic now supports the "type" argument for the
int converter.  This permits using the int converter with enums and
typedefs.
2014-10-13 10:39:41 +01:00
R David Murray 9755174464 Merge: #13096: Fix segfault in CTypes POINTER handling of large values. 2014-10-12 13:56:37 -04:00
R David Murray 817905b239 #13096: Fix segfault in CTypes POINTER handling of large values.
Patch by Meador Inge.
2014-10-12 13:54:48 -04:00
Georg Brandl bfd7881aa6 #22568: merge with 3.4 2014-10-12 08:45:26 +02:00
Georg Brandl e1a7d9dbf5 Closes #22568: fix UTIME_TO_* macros in posixmodule for rare cases. 2014-10-12 08:45:15 +02:00
Benjamin Peterson 588dad0308 merge 3.4 (closes #22605) 2014-10-10 20:58:43 -04:00
Benjamin Peterson 682124ccc3 prevent passing NULL to memcpy (closes #22605)
Patch by Jakub Wilk.
2014-10-10 20:58:30 -04:00
Brett Cannon 1eb32c2045 Issue #20152: Port the array module to Argument Clinic. 2014-10-10 16:26:45 -04:00
Serhiy Storchaka 5aa47443c6 Issue #22584: Got rid of character tables in _sre.c and use standard macros
Py_TOLOWER, Py_ISSPACE, etc.
2014-10-10 11:10:46 +03:00
Victor Stinner d42c4282b9 Closes #22579: Fix posixmodule.c to support any C compiler on Windows 2014-10-10 00:09:47 +02:00
Victor Stinner aad627f2f9 Merge 3.4 2014-10-09 22:16:15 +02:00
Victor Stinner fc6a90a92e Issue #22588: Fix typo in _testcapi.test_incref_decref_API() 2014-10-09 22:15:41 +02:00
Victor Stinner 67e2e6d600 (Merge 3.4) Issue #22568: Fix compilation of posixmodule.c with Open Watcom:
rename "utime" variable to "ut" to avoid conflict with the C utime() function.
Patch written by Jeffrey Armstrong.
2014-10-09 13:53:45 +02:00
Victor Stinner 484df0075a Issue #22568: Fix compilation of posixmodule.c with Open Watcom: rename "utime"
variable to "ut" to avoid conflict with the C utime() function. Patch written
by Jeffrey Armstrong.
2014-10-09 13:52:31 +02:00
Serhiy Storchaka 78184af9b5 Issue #21715: Extracted shared complicated code in the _io module to new
_PyErr_ChainExceptions() function.
2014-10-08 22:32:50 +03:00
Serhiy Storchaka e2bd2a7186 Issue #21715: Extracted shared complicated code in the _io module to new
_PyErr_ChainExceptions() function.
2014-10-08 22:31:52 +03:00
Antoine Pitrou 94262ebc9c Issue #22462: Fix pyexpat's creation of a dummy frame to make it appear in exception tracebacks.
Initial patch by Mark Shannon.
2014-10-08 20:02:40 +02:00
Antoine Pitrou 0ddbf4795f Issue #22462: Fix pyexpat's creation of a dummy frame to make it appear in exception tracebacks.
Initial patch by Mark Shannon.
2014-10-08 20:00:09 +02:00
Antoine Pitrou b1fdf47ff5 Issue #21965: Add support for in-memory SSL to the ssl module.
Patch by Geert Jansen.
2014-10-05 20:41:53 +02:00
R David Murray 861470c836 #16518: Bring error messages in harmony with docs ("bytes-like object")
Some time ago we changed the docs to consistently use the term 'bytes-like
object' in all the contexts where bytes, bytearray, memoryview, etc are used.
This patch (by Ezio Melotti) completes that work by changing the error
messages that previously reported that certain types did "not support the
buffer interface" to instead say that a bytes-like object is required.  (The
glossary entry for bytes-like object references the discussion of the buffer
protocol in the docs.)
2014-10-05 11:47:01 -04:00
Victor Stinner f4e4b83824 (Merge 3.4) Issue #22290: Fix error handling in the _posixsubprocess module.
* Don't call the garbage collector with an exception set: it causes an
  assertion to fail in debug mode.
* Enhance also error handling if allocating an array for the executable list
  failed.
* Add an unit test for 4 different errors in the _posixsubprocess module.
2014-10-05 17:25:48 +02:00
Victor Stinner 8f437aac06 Issue #22290: Fix error handling in the _posixsubprocess module.
* Don't call the garbage collector with an exception set: it causes an
  assertion to fail in debug mode.
* Enhance also error handling if allocating an array for the executable list
  failed.
* Add an unit test for 4 different errors in the _posixsubprocess module.
2014-10-05 17:25:19 +02:00
Georg Brandl 54eec2d0af merge with 3.4 2014-10-02 08:35:31 +02:00
Georg Brandl 41ea1f4f26 Closes #19342: improve docstrings in grp module. 2014-10-02 08:34:41 +02:00
Victor Stinner 6b8e0ed562 (Merge 3.4) faulthandler: test_gil_released() now uses _sigsegv() instead of
_read_null(), because _read_null() cannot be used on AIX. On AIX, reading from
NULL is allowed: the first page of memory is a mapped read-only on AIX.

_read_null() and _sigabrt() don't accept parameters.
2014-09-30 13:55:30 +02:00
Victor Stinner 5083828d65 faulthandler: test_gil_released() now uses _sigsegv() instead of _read_null(),
because _read_null() cannot be used on AIX. On AIX, reading from NULL is
allowed: the first page of memory is a mapped read-only on AIX.
2014-09-30 13:54:14 +02:00
Victor Stinner 9db521c4a8 faulthandler: _sigsegv() and _sigabrt() don't accept parameters 2014-09-30 13:49:09 +02:00
Victor Stinner 7a39912dda faulthandler: suppress crash reporter directly in test functions written to
crash.
2014-09-30 13:40:12 +02:00
Victor Stinner ec39e26881 (Merge 3.4) Issue #22396: On 32-bit AIX platform, don't expose
os.posix_fadvise() nor os.posix_fallocate() because their prototypes in system
headers are wrong.
2014-09-30 12:35:58 +02:00
Victor Stinner d6b176905d Issue #22396: On 32-bit AIX platform, don't expose os.posix_fadvise() nor
os.posix_fallocate() because their prototypes in system headers are wrong.
2014-09-30 12:20:05 +02:00
Benjamin Peterson 58ee2d31ab merge 3.4 (#22517) 2014-09-29 22:49:05 -04:00
Benjamin Peterson c44eb73473 merge 3.3 (#22517) 2014-09-29 22:48:51 -04:00
Benjamin Peterson bbd0a323ae clear BufferedRWPair weakrefs on deallocation (closes #22517) 2014-09-29 22:46:57 -04:00
Serhiy Storchaka 9baa5b2de2 Issue #22437: Number of capturing groups in regular expression is no longer
limited by 100.
2014-09-29 22:49:23 +03:00
Serhiy Storchaka 20b39b27d9 Removed redundant casts to `char *`.
Corresponding functions now accept `const char *` (issue #1772673).
2014-09-28 11:27:24 +03:00
Antoine Pitrou 2c0a916061 Issue #5309: distutils' build and build_ext commands now accept a ``-j``
option to enable parallel building of extension modules.
2014-09-26 23:31:59 +02:00
Berker Peksag 43705d76aa Issue #21860: Correct docstrings of FileIO.seek() and FileIO.truncate() methods.
Patch by Terry Chia.
2014-09-24 12:44:06 +03:00
Berker Peksag b87630c273 Issue #21860: Correct docstrings of FileIO.seek() and FileIO.truncate() methods.
Patch by Terry Chia.
2014-09-24 12:43:29 +03:00
Charles-François Natali ea07eb9469 Issue #22378: socket module: add SO_MARK. 2014-09-18 23:18:46 +01:00
Nick Coghlan a0f33759fa Merge fix for issue #22166 from 3.4 2014-09-15 23:55:16 +12:00
Nick Coghlan 8fad1676a2 Issue #22166: clear codec caches in test_codecs 2014-09-15 23:50:44 +12:00