Commit Graph

23303 Commits

Author SHA1 Message Date
Serhiy Storchaka b580f4f2bf
[3.6] bpo-30416: Protect the optimizer during constant folding. (#4865)
It no longer spends much time doing complex calculations and no
longer consumes much memory for creating large constants that will
be dropped later.

This fixes also bpo-21074.
2017-12-15 14:12:14 +02:00
Serhiy Storchaka b82da9ebb2
[3.6] bpo-27169: The __debug__ constant is now optimized out at compile time. (GH-4880) (#4882)
This fixes also bpo-22091..
(cherry picked from commit 3325a6780c)
2017-12-15 13:26:26 +02:00
Victor Stinner 22097aaa77
bpo-32329: Fix sys.flags.hash_randomization (#4875)
sys.flags.hash_randomization is now properly set to 0 when hash
randomization is turned off by PYTHONHASHSEED=0.
2017-12-15 01:39:48 +01:00
Victor Stinner 4f37105277
pythoninfo: sync with master (#4844) 2017-12-14 15:41:06 +01:00
Andrew Svetlov 28453feaa8
[3.6] bpo-32297: Fix misspellings in Python source code comments (GH-4803) (#4864)
* [3.6] bpo-32297: Few misspellings found in Python source code comments. (GH-4803)

* Fix multiple typos in code comments

* Add spacing in comments (test_logging.py, test_math.py)

* Fix spaces at the beginning of comments in test_logging.py.

(cherry picked from commit 53f7a7c281)
2017-12-14 16:19:51 +02:00
Antoine Pitrou b6263ca313
[3.6] Test atexit shutdown mechanism in a subprocess (GH-4828) (#4829)
* Test atexit shutdown mechanism in a subprocess.
(cherry picked from commit fc5db95e00)
2017-12-13 11:53:59 +01:00
Miss Islington (bot) f4b814f9a2 Fix improper use of re.escape() in tests. (GH-4814) (#4816)
(cherry picked from commit b748e3b258)
2017-12-12 20:29:05 +02:00
Miss Islington (bot) eb2f222aae Fix implementation dependent assertion in test_plistlib. (GH-4813) (#4815)
It is failed with an advanced optimizer.
(cherry picked from commit 0e069a1597)
2017-12-12 19:53:02 +02:00
Miss Islington (bot) ce5a3cd9b1 bpo-32255: Always quote a single empty field when write into a CSV file. (GH-4769) (#4810)
This allows to distinguish an empty row from a row consisting of a single empty field.
(cherry picked from commit 2001900b0c)
2017-12-12 12:56:40 +02:00
Miss Islington (bot) 0aa2a1d003 bpo-22671: Clarify and test default read method implementations (GH-4568) (#4796)
Original patch written by Martin Panter, enhanced by Sanyam Khurana.
(cherry picked from commit 1b74f9b77a)
2017-12-11 15:27:25 +01:00
Miss Islington (bot) a04ca12e12 bpo-32208: update threading.Semaphore docs and add unit test (GH-4709) (#4750)
* fix issue32208: update threading.Semaphore docs and add unit test to validate correct behavior

* add test for blocking

* Update threading.rst

* semaphore: remove documentation validation tests and move 'return value' test to BaseSemaphore
(cherry picked from commit a0374dd34a)
2017-12-07 20:48:35 +02:00
Miss Islington (bot) d9cadc5f59 [3.6] bpo-31380: Skip test_httpservers test_undecodable_file on macOS. (GH-4720) (#4721)
The undecodable file name cannot be created on macOS APFS file systems.
(cherry picked from commit b3edde8dd4)
2017-12-05 00:03:29 -05:00
Miss Islington (bot) b0576278b2 [bpo-28556] Minor fixes for typing module (GH-4710) (#4713)
(cherry picked from commit 29bc193210)
2017-12-04 22:02:02 -05:00
Miss Islington (bot) a87ba60fe5 bpo-27240 Rewrite the email header folding algorithm. (GH-3488) (#4693)
The original algorithm tried to delegate the folding to the tokens so
that those tokens whose folding rules differed could specify the
differences.  However, this resulted in a lot of duplicated code because
most of the rules were the same.

The new algorithm moves all folding logic into a set of functions
external to the token classes, but puts the information about which
tokens can be folded in which ways on the tokens...with the exception of
mime-parameters, which are a special case (which was not even
implemented in the old folder).

This algorithm can still probably be improved and hopefully simplified
somewhat.

Note that some of the test expectations are changed.  I believe the
changes are toward more desirable and consistent behavior: in general
when (re) folding a line the canonical version of the tokens is
generated, rather than preserving errors or extra whitespace.
(cherry picked from commit 85d5c18c9d)
2017-12-03 19:46:23 -05:00
Nick Coghlan c8f32aae0a
[3.6] bpo-32176: Set CO_NOFREE in the code object constructor (GH-4684)
Previously, CO_NOFREE was set in the compiler, which meant
it could end up being set incorrectly when code objects
were created directly. Setting it in the constructor based
on freevars and cellvars ensures it is always accurate,
regardless of how the code object is defined.

(cherry picked from commit 078f1814f1)
2017-12-03 23:32:54 +10:00
Victor Stinner e10c9de9d7
bpo-20891: Fix PyGILState_Ensure() (#4650) (#4655)
When PyGILState_Ensure() is called in a non-Python thread before
PyEval_InitThreads(), only call PyEval_InitThreads() after calling
PyThreadState_New() to fix a crash.

Add an unit test in test_embed.

Enhance also embedded tests, backport from master:

* Add test_pre_initialization_api()
* Set PYTHONIOENCODING environment variable in
  test_forced_io_encoding()

(cherry picked from commit b4d1e1f7c1)
2017-11-30 23:36:49 +01:00
Miss Islington (bot) 8cd31082fb bpo-32072: Fix issues with binary plists. (GH-4455) (#4654)
* Fixed saving bytearrays.
* Identical objects will be saved only once.
* Equal references will be load as identical objects.
* Added support for saving and loading recursive data structures.
(cherry picked from commit a897aeeef6)
2017-12-01 00:15:30 +02:00
Miss Islington (bot) c91bf742e5 bpo-28416: Break reference cycles in Pickler and Unpickler subclasses (GH-4080) (#4653)
with the persistent_id() and persistent_load() methods.
(cherry picked from commit 986375ebde)
2017-11-30 23:30:39 +02:00
Miss Islington (bot) 92a2c07b71 Skip test_socket.test_sha256() on linux < 4.5 (GH-4643) (#4645)
bpo-31705.
(cherry picked from commit 86afc1f2a7)
2017-11-30 14:43:43 +01:00
Victor Stinner 06be9daf6f
bpo-32030: Fix test_sys.test_getallocatedblocks() (#4637)
Skip the test if PYTHONMALLOC environment variable is set.
2017-11-29 23:51:41 +01:00
Barry Warsaw 23cc8c0f9e
[3.6] bpo-32107 - Backport bitmask check fix (GH-4576) (#4591)
Remove a flakey test and rewrite another one for readability.
2017-11-29 10:35:02 -05:00
Miss Islington (bot) b0df786258 bpo-32139: test_strftime does not anymore modify the locale (GH-4569) (#4635)
(cherry picked from commit cc55e78aca)
2017-11-29 16:18:22 +01:00
Miss Islington (bot) 230ffeae0a bpo-32110: codecs.StreamReader.read(n) now returns not more than n (GH-4499) (#4622)
characters/bytes for non-negative n.  This makes it compatible with
read() methods of other file-like objects.
(cherry picked from commit 219c2de5ad)
2017-11-29 02:06:53 +02:00
Miss Islington (bot) 4237939805 asyncio: Fix BaseSelectorEventLoopTests (GH-4595) (#4599)
Currently, two tests fail with PYTHONASYNCIODEBUG=1 (or using -X
dev).
(cherry picked from commit 92f9339a58)
2017-11-28 10:32:53 +01:00
Victor Stinner d5c71b0c98
pythoninfo: add Py_DEBUG (#4198) (#4580)
(cherry picked from commit afd055a59f)
2017-11-27 10:44:53 +01:00
Miss Islington (bot) dde38b9cb3 bpo-32128: Skip test_nntplib.test_article_head_body() (GH-4552) (#4553)
The NNTP server currently has troubles with SSL, whereas we don't
have the control on this server. This test blocks all CIs, so disable
it until a fix can be found.
(cherry picked from commit 706cb3162e)
2017-11-25 03:02:47 +01:00
Berker Peksag 412f00b839
[3.6] bpo-12239: Make GetProperty() return None for VT_EMPTY (GH-4539)
The previous behavior was to raise an exception

    NotImplementedError: result of type 0

when the value of the property is VT_EMPTY.

(cherry picked from commit 19fb134185)
2017-11-24 19:04:40 +03:00
Miss Islington (bot) bfa89b21e1 bpo-12382: Make OpenDatabase() raise better exception messages (GH-4528)
Previously, 'msilib.OpenDatabase()' function raised a
cryptical exception message when it couldn't open or
create an MSI file. For example:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    _msi.MSIError: unknown error 6e

(cherry picked from commit 4864a619dc)
2017-11-24 13:31:21 +03:00
Miss Islington (bot) ff847d1ac7 bpo-31325: Fix usage of namedtuple in RobotFileParser.parse() (GH-4529) (#4533)
(cherry picked from commit 3df02dbc8e)
2017-11-23 15:57:58 -08:00
Victor Stinner 70b2f87971
[3.6] bpo-31324: Optimize support._match_test() (#4523)
* bpo-31324: Optimize support._match_test() (#4421)

* Rename support._match_test() to support.match_test(): make it
  public
* Remove support.match_tests global variable. It is replaced with a
  new support.set_match_tests() function, so match_test() doesn't
  have to check each time if patterns were modified.
* Rewrite match_test(): use different code paths depending on the
  kind of patterns for best performances.

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 803ddd8ce2)

* bpo-31324: Fix test.support.set_match_tests(None) (#4505)

(cherry picked from commit bb11c3c967)
2017-11-23 17:42:04 +01:00
Berker Peksag 4b3042900e
bpo-1102: View.Fetch() now returns None when it's exhausted (GH-4459)
(cherry picked from commit bdb8315c21)
2017-11-23 17:33:12 +03:00
Victor Stinner 33217d2213
bpo-31701: faulthandler: ignore MSC and COM Windows exception (#3929) (#4416)
(cherry picked from commit 6e3d6b5dc2)
2017-11-16 03:53:45 -08:00
Miss Islington (bot) f35076a002 bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable GH-4409 (#4411)
(cherry picked from commit 43605e6bfa)
2017-11-15 19:28:25 -05:00
Miss Islington (bot) d15bb5fcad bpo-32011: Revert "Issue GH-15480: Remove the deprecated and unused TYPE_INT64 code from marshal." (GH-4381) (#4405)
Simplify the reverted code.

This reverts commit e9bbe8b87b.
(cherry picked from commit 00987f6230)
2017-11-15 18:05:58 +02:00
Serhiy Storchaka 3864248866
[3.6] bpo-31949: Fixed several issues in printing tracebacks (PyTraceBack_Print()). (GH-4289) (#4406)
* Setting sys.tracebacklimit to 0 or less now suppresses printing tracebacks.
* Setting sys.tracebacklimit to None now causes using the default limit.
* Setting sys.tracebacklimit to an integer larger than LONG_MAX now means using
  the limit LONG_MAX rather than the default limit.
* Fixed integer overflows in the case of more than 2**31 traceback items on
  Windows.
* Fixed output errors handling..
(cherry picked from commit edad8eebee)
2017-11-15 18:04:46 +02:00
Miss Islington (bot) eb38367f20 bpo-32032: Test both implementations of module-level pickle API. (GH-4401) (#4403)
(cherry picked from commit 6545256df9)
2017-11-15 14:32:04 +02:00
Andrew Svetlov cc0961c517
[3.6] bpo-32015: Asyncio looping during simultaneously socket read/write an… (GH-4386) (#4393)
* bpo-32015: Asyncio cycling during simultaneously socket read/write and reconnection

* Tests fix

* Tests fix

* News add

* Add new unit tests.
(cherry picked from commit e1d62e0b7c)
2017-11-14 12:14:51 +02:00
xdegaye ad004f9b5a
[3.6] bpo-28759: Skip some tests on PermissionError raised by Android (GH-4350) (#4380)
(cherry picked from commit 92c2ca7633)
2017-11-12 18:18:36 +01:00
xdegaye ea5b545e38
[3.6] bpo-30696: Fix the REPL looping endlessly when no memory (GH-4160). (#4379)
(cherry picked from commit e0582a37c8)
2017-11-12 17:33:16 +01:00
Miss Islington (bot) 7997fa2e21 bpo-31999: Fix test_venv in case the zlib module is not available. (GH-4359) (#4360)
(cherry picked from commit 5e0df74b3b)
2017-11-10 12:56:59 +02:00
Miss Islington (bot) b9a40aca29 bpo-31222: Make (datetime|date|time).replace return subclass type in Pure Python (GH-4176) (#4356)
(cherry picked from commit 191e993365)
2017-11-09 16:52:05 -08:00
Miss Islington (bot) ac4f6d4448 bpo-31620: have asyncio/queues not leak memory when you've exceptions during waiting (GH-3813) (#4326)
(cherry picked from commit c62f0cb3b1)
2017-11-07 22:08:15 +03:00
Antoine Pitrou d8d218ffda
[3.6] bpo-31970: Reduce performance overhead of asyncio debug mode. (GH-4314) (#4322)
* bpo-31970: Reduce performance overhead of asyncio debug mode..
(cherry picked from commit 921e9432a1)
2017-11-07 17:50:48 +01:00
Miss Islington (bot) a5dca7d173 Fix the sizeof test for dicts with shared keys. (GH-4311) (#4312)
By accident the size of the empty dict keys object matched the
size of values array.
(cherry picked from commit 39a156c505)
2017-11-07 15:59:33 +02:00
Miss Islington (bot) 8ce98543ef bpo-31924: Fix test_curses on NetBSD 8. (GH-4228) (#4259)
(cherry picked from commit a7723d8b09)
2017-11-03 22:11:09 +02:00
Miss Islington (bot) a512493371 bpo-31933: fix blake2 multi-byte params on big endian platforms (GH-4250) (#4262)
All Blake2 params have to be encoded in little-endian byte order. For
the two multi-byte integer params, leaf_length and node_offset, that
means that assigning a native-endian integer to them appears to work on
little-endian platforms, but gives the wrong result on big-endian. The
current libb2 API doesn't make that very clear, and @sneves is working
on new API functions in the GH issue above. In the meantime, we can work
around the problem by explicitly assigning little-endian values to the
parameter block.

See https://github.com/BLAKE2/libb2/issues/12.
(cherry picked from commit dcfb0e3c04)
2017-11-03 20:55:54 +01:00
Antoine Pitrou b5f09acf0a
[3.6] bpo-31310: multiprocessing's semaphore tracker should be launched again if crashed (GH-3247) (#4254)
* bpo-31310: multiprocessing's semaphore tracker should be launched again if crashed

* Avoid mucking with process state in test.
Add a warning if the semaphore process died, as semaphores may then be leaked.

* Add NEWS entry
(cherry picked from commit cbe1756)
2017-11-03 14:58:37 +01:00
Antoine Pitrou 019c99f325
[3.6] bpo-31308: If multiprocessing's forkserver dies, launch it again when necessary (GH-3246) (#4252)
* bpo-31308: If multiprocessing's forkserver dies, launch it again when necessary.

* Fix test on Windows

* Add NEWS entry

* Adopt a different approach: ignore SIGINT and SIGTERM, as in semaphore tracker.

* Fix comment

* Make sure the test doesn't muck with process state

* Also test previously-started processes

* Update 2017-08-30-17-59-36.bpo-31308.KbexyC.rst

* Avoid masking SIGTERM in forkserver.  It's not necessary and causes a race condition in test_many_processes..
(cherry picked from commit fc6b348b12)
2017-11-03 13:59:43 +01:00
Miss Islington (bot) 5fbe5e161c bpo-30806: Fix netrc.__repr__() format (GH-2491)
netrc file format doesn't support quotes and escapes.

See https://linux.die.net/man/5/netrc
(cherry picked from commit b24cd055ec)
2017-11-03 14:36:45 +09:00
Miss Islington (bot) aad7ac10af bpo-27666: Fixed stack corruption in curses.box() and curses.ungetmouse(). (GH-4220) (#4221)
(cherry picked from commit 4f469c0966)
2017-11-01 21:23:46 +02:00