4922 Commits

Author SHA1 Message Date
Antoine Pitrou
85b34edd8b [3.5] bpo-30765: Avoid blocking when PyThread_acquire_lock() is asked not to (GH-2403) (#2419)
* bpo-30765: Avoid blocking when PyThread_acquire_lock() is asked not to lock

This is especially important if PyThread_acquire_lock() is called reentrantly
(for example from a signal handler).

* Update 2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst

* Avoid core logic when taking the mutex failed.
(cherry picked from commit f84ac420c2)
2017-06-26 22:07:20 +02:00
Serhiy Storchaka
263dcc39da [3.5] bpo-30626: Fix error handling in PyImport_Import(). (GH-2103) (#2222)
In rare circumstances PyImport_Import() could return NULL without raising
an error.
(cherry picked from commit 145541c)
2017-06-15 21:15:26 +03:00
Serhiy Storchaka
86f8f1f05c [3.5] bpo-30567: Fix refleak in sys.getwindowsversion (GH-1940) (#1971)
(cherry picked from commit 48fb766)
2017-06-06 19:23:21 +03:00
Xiang Zhang
639e295650 bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1530) (#1480) 2017-05-10 19:11:09 +08:00
Victor Stinner
8a1c710531 bpo-30225: Fix is_valid_fd() on macOS Tiger (#1443) (#1450)
is_valid_fd() now uses fstat() instead of dup() on macOS to return 0
on a pipe when the other side of the pipe is closed. fstat() fails
with EBADF in that case, whereas dup() succeed.
(cherry picked from commit 1c4670ea0c)
2017-05-04 13:21:16 +02:00
Serhiy Storchaka
8b8bde44f3 bpo-29935: Fixed error messages in the index() method of tuple, list and deque (#887) (#907) (#909)
when pass indices of wrong type.
(cherry picked from commit d4edfc9abf)
(cherry picked from commit bf4bb2e430)
2017-03-30 20:31:46 +03:00
Serhiy Storchaka
a16894ebf8 [3.5] bpo-8256: Fixed possible failing or crashing input() (#642)
if attributes "encoding" or "errors" of sys.stdin or sys.stdout
are not set or are not strings.

(cherry picked from commit c2cf128571)
2017-03-12 21:52:57 +02:00
Serhiy Storchaka
f12f820ef8 bpo-29746: Update marshal docs to Python 3. (#547) (#630)
(cherry picked from commit c611a5b1d4)
2017-03-12 10:05:27 +02:00
Xiang Zhang
ce222c8770 bpo-29770: remove outdated PYO related info (GH-590) (GH-613) 2017-03-11 14:12:29 +08:00
Nick Coghlan
93602e3af7 [3.5] bpo-29537: Tolerate legacy invalid bytecode (#169)
bpo-27286 fixed a problem where BUILD_MAP_UNPACK_WITH_CALL could
be emitted with an incorrect oparg value, causing the eval loop
to access the wrong stack entry when attempting to read the
function name.

The associated magic number change caused significant problems when
attempting to upgrade to 3.5.3 for anyone that relies on pre-cached
bytecode remaining valid across maintenance releases.

This patch restores the ability to import legacy bytecode generated
by 3.5.0, 3.5.1 or 3.5.2, and modifies the eval loop to
avoid any harmful consequences from the potentially malformed legacy
bytecode.

Original import patch by Petr Viktorin, eval loop patch by Serhiy Storchaka,
and tests and integration by Nick Coghlan.
2017-03-08 16:41:01 +10:00
Ned Deily
a2edd3ae40 [3.5] bpo-27593: Get SCM build info from git instead of hg. (#446) (#454) (#455)
* bpo-27593: Get SCM build info from git instead of hg. (#446)

sys.version and the platform module python_build(),
python_branch(), and python_revision() functions now use
git information rather than hg when building from a repo.

Based on original patches by Brett Cannon and Steve Dower.
(cherry picked from commit 5c4b0d063a)

(cherry picked from commit 95c50e5aed)
2017-03-04 01:34:19 -05:00
Berker Peksag
0dadf56737 bpo-29655: Fixed possible reference leaks in import *. (#301) (#349)
Patch by Matthias Bussonnier.

(cherry picked from commit 160edb4357)
2017-02-27 21:25:29 +03:00
Martijn Pieters
bc144f0abf bpo-28598: Support __rmod__ for RHS subclasses of str in % string formatting operations (#94) 2017-02-27 19:07:27 +03:00
Serhiy Storchaka
3a1042567c Issue #26729: Fixed __text_signature__ for sorted().
Patch by Erik Welch.
2017-01-23 12:29:47 +02:00
Victor Stinner
035ba5da3e Issue #29157: Prefer getrandom() over getentropy()
Copy and then adapt Python/random.c from default branch. Difference between 3.5
and default branches:

* Python 3.5 only uses getrandom() in non-blocking mode: flags=GRND_NONBLOCK
* If getrandom() fails with EAGAIN: py_getrandom() immediately fails and
  remembers that getrandom() doesn't work.
* Python 3.5 has no _PyOS_URandomNonblock() function: _PyOS_URandom()
  works in non-blocking mode on Python 3.5
2017-01-09 11:18:53 +01:00
Benjamin Peterson
493ac1bbe0 only include sys/random.h if it seems like it might have something useful (#29057) 2017-01-01 22:29:36 -06:00
Benjamin Peterson
4365833d11 merge 3.4 2017-01-01 22:08:33 -06:00
Benjamin Peterson
b6e2142b0c merge 3.3 2017-01-01 22:07:37 -06:00
Benjamin Peterson
e527dd34bc ring in 2017 for Python 2017-01-01 22:04:13 -06:00
Benjamin Peterson
fb2ae15c67 add a specific configure check for sys/random.h (closes #28932) 2016-12-19 23:54:25 -08:00
Martin Panter
ca3263c50c Issue #25677: Correct syntax error caret for indented blocks.
Based on patch by Michael Layzell.
2016-12-11 00:18:36 +00:00
Serhiy Storchaka
8b58339eb2 Issue #28512: Fixed setting the offset attribute of SyntaxError by
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
2016-12-11 14:39:01 +02:00
Serhiy Storchaka
144f77a981 Issue #28715: Added error checks for PyUnicode_AsUTF8(). 2016-11-20 08:47:21 +02:00
Serhiy Storchaka
f5894dd646 Issue #28701: Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.
The latter function is more readable, faster and doesn't raise exceptions.

Based on patch by Xiang Zhang.
2016-11-16 15:40:39 +02:00
Serhiy Storchaka
f4934ea77d Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:17:58 +02:00