Commit Graph

97827 Commits

Author SHA1 Message Date
stratakis a4465a5bd0 [3.6] bpo-28787: Fix out of tree --with-dtrace builds (GH-135) (#1543)
* bpo-28787: Fix out of tree --with-dtrace builds

* Unsilence directory creation

* Add Misc/NEWS and Misc/ACKS entries.
(cherry picked from commit f6eae5bf1c)
2017-05-11 13:13:18 +02:00
Xiang Zhang 98b49a00d4 bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1480) (#1529) 2017-05-10 19:00:15 +08:00
Victor Stinner 81ed537846 bpo-30320: test_eintr now uses pthread_sigmask() (#1523) (#1524)
Rewrite sigwaitinfo() and sigtimedwait() unit tests for EINTR using
pthread_sigmask() to fix a race condition between the child and the
parent process.

Remove the pipe which was used as a weak workaround against the race
condition.

sigtimedwait() is now tested with a child process sending a signal
instead of testing the timeout feature which is more unstable
(especially regarding to clock resolution depending on the platform).
(cherry picked from commit 211a392cc1)
2017-05-10 08:47:22 +02:00
Serhiy Storchaka 418d60a525 [3.6] bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. (GH-1490) (#1525)
Now allowed several subsequential inline modifiers at the start of the
pattern (e.g. '(?i)(?s)...').  In verbose mode whitespaces and comments
now are allowed before and between inline modifiers (e.g.
'(?x) (?i) (?s)...')..
(cherry picked from commit 305ccbe27e)
2017-05-10 06:44:02 +03:00
torsava 03b8a378df [3.6] bpo-29243: Fix Makefile with respect to --enable-optimizations (GH-1478) (#1518)
* bpo-29243: Fix Makefile with respect to --enable-optimizations (#1478)

* bpo-29243: Fix Makefile with respect to --enable-optimizations

When using the Profile Guided Optimization (./configure --enable-optimizations)
Python is built not only during `make` but rebuilt again during `make test`,
`make install` and others. This patch fixes the issue.

Note that this fix produces no change at all in the Makefile if configure is
run witout --enable-optimizations.

* !squash

(cherry picked from commit a1054c3b00)

* [3.6] bpo-29243: Fix Makefile with respect to --enable-optimizations (GH-1478)

* bpo-29243: Fix Makefile with respect to --enable-optimizations

When using the Profile Guided Optimization (./configure --enable-optimizations)
Python is built not only during `make` but rebuilt again during `make test`,
`make install` and others. This patch fixes the issue.

Note that this fix produces no change at all in the Makefile if configure is
run witout --enable-optimizations.

* !squash.
(cherry picked from commit a1054c3b00)
2017-05-09 16:05:10 +02:00
Xiang Zhang 72e1b61da0 bpo-29990: Fix range checking in GB18030 decoder (#1495) (#1507)
When decoding a 4-byte GB18030 sequence, the first and third byte cannot exceed 0xFE.
2017-05-09 12:16:50 +08:00
Xiang Zhang 410d75ab71 bpo-30289: remove Misc/python-config.sh when make distclean (#1498) (#1506) 2017-05-09 10:56:30 +08:00
Serhiy Storchaka 70dc6a7a0b [3.6] Revert bpo-26293 for zipfile breakage. See also bpo-29094. (GH-1484). (#1485)
(cherry picked from commit 3763ea865c)
2017-05-06 15:10:50 +03:00
Victor Stinner 0fe870f3f9 bpo-30264: ExpatParser closes the source on error (#1451) (#1474)
ExpatParser.parse() of xml.sax.xmlreader now always closes the
source: close the file object or the urllib object if source is a
string (not an open file-like object). The change fixes a
ResourceWarning on parsing error.

Add test_parse_close_source() unit test.
(cherry picked from commit ef9c0e732f)
2017-05-05 10:04:57 +02:00
Serhiy Storchaka 39b73dd513 [3.6] bpo-30243: Fixed the possibility of a crash in _json. (GH-1420) (#1469)
It was possible to get a core dump by using uninitialized
_json objects. Now __new__ methods create initialized objects.
__init__ methods are removed..
(cherry picked from commit 76a3e51a40)
2017-05-05 10:40:30 +03:00
Victor Stinner 9d02f56296 [3.6] bpo-23404: make touch becomes make regen-all (#1405) (#1461)
* bpo-23404: make touch becomes make regen-all (#1405)

Don't rebuild generated files based on file modification time
anymore, the action is now explicit. Replace "make touch"
with "make regen-all".

Changes:

* Remove "make touch", Tools/hg/hgtouch.py and .hgtouch
* Add a new "make regen-all" command to rebuild all generated files
* Add subcommands to only generate specific files:

  - regen-ast: Include/Python-ast.h and Python/Python-ast.c
  - regen-grammar: Include/graminit.h and Python/graminit.c
  - regen-importlib: Python/importlib_external.h and Python/importlib.h
  - regen-opcode: Include/opcode.h
  - regen-opcode-targets: Python/opcode_targets.h
  - regen-typeslots: Objects/typeslots.inc

* Rename PYTHON_FOR_GEN to PYTHON_FOR_REGEN
* pgen is now only built by by "make regen-grammar"
* Add $(srcdir)/ prefix to paths to source files to handle correctly
  compilation outside the source directory

Note: $(PYTHON_FOR_REGEN) is no more used nor needed by "make"
default target building Python.
(cherry picked from commit a5c62a8e9f)

* bpo-30273: Update sysconfig (#1464)

The AST_H_DIR variable was removed from Makefile.pre.in by the commit
a5c62a8e9f (bpo-23404).

AST_H_DIR was hardcoded to "Include", so replace the removed variable
by its content.

Remove also ASDLGEN variable from sysconfig example since this
variable was also removed.
(cherry picked from commit b109a1d336)
2017-05-05 00:46:56 +02:00
Antoine Pitrou a7e48b544b [3.6] bpo-30185: avoid KeyboardInterrupt tracebacks in forkserver (GH-1319) (#1454)
* bpo-30185: avoid KeyboardInterrupt tracebacks in forkserver

* Tweak comment.
(cherry picked from commit 6dd4d734ed)
2017-05-04 17:12:35 +02:00
Victor Stinner 31906b42fd bpo-30225: Fix is_valid_fd() on macOS Tiger (#1443) (#1449)
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:10 +02:00
Serhiy Storchaka 1bebd8a219 [3.6] bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords. (GH-1316). (#1441)
(cherry picked from commit 5f161fd86d)
2017-05-04 06:50:28 +03:00
Mariatta af71364c3f [3.6] bpo-28315: Improve code examples in docs (GH-1372) (#1445)
Replace
   File "<stdin>", line 1, in ?
with
   File "<stdin>", line 1, in <module>
(cherry picked from commit 8856940cf2)
2017-05-03 18:41:20 -07:00
Zachary Ware 833dcb6259 Bump version in AppVeyor config (GH-1436) 2017-05-03 11:56:44 -05:00
Mariatta e612c28513 [3.6] bpo-28556: Routine updates to typing (GH-1366) (#1416)
- Add NoReturn type
- Use WrapperDescriptorType (original PR by Jim Fasarakis-Hilliard)
- Minor bug-fixes
(cherry picked from commit f06e0218ef)
2017-05-03 09:38:01 -07:00
Mariatta 5bcf01d4cd [3.6] Fix typo in selectors.rst (GH-1383) (#1414)
decriptor -> descriptor
(cherry picked from commit b0d8203654)
2017-05-02 21:35:43 -07:00
Victor Stinner 564e89f43b regrtest: always show before/after of modified env (#1192) (#1406)
Buildbots don't run tests with -vv and so only log "xxx was modified
by test_xxx" which is not enough to debug such random issue. In many
cases, I'm unable to reproduce the warning and so unable to fix it.

Always logging the value before and value after should help to debug
such warning on buildbots.
(cherry picked from commit ec4b17239d)
2017-05-03 02:12:22 +02:00
Antoine Pitrou 0c2ff0898d Backport bpo-30205 to 3.6 (#1403) 2017-05-03 00:14:29 +02:00
Victor Stinner 4dae0d111d [3.6] bpo-30232: Support Git worktree in configure.ac (#1398)
* bpo-30232: Support Git worktree in configure.ac (#1391)

Don't test if .git/HEAD file exists, but only if the .git file (or
directory) exists.
(cherry picked from commit 5facdbb291)

* bpo-30232: Regenerate configure (#1396)

Run autoconf.
(cherry picked from commit 9ed34a8953)
2017-05-02 23:46:06 +02:00
Victor Stinner 3c422b9265 bpo-30199: test_ssl closes all asyncore channels (#1381) (#1390)
AsyncoreEchoServer of test_ssl now calls
asyncore.close_all(ignore_all=True) to ensure that
asyncore.socket_map is cleared once the test completes, even if
ConnectionHandler was not correctly unregistered.

Fix the following warning:

Warning -- asyncore.socket_map was modified by test_ssl
  Before: {}
  After:  {6: <test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler>}
(cherry picked from commit 1dae7450c6)
2017-05-02 16:49:10 +02:00
Victor Stinner 3076895849 bpo-30132: distutils BuildExtTestCase use temp_cwd (#1387)
BuildExtTestCase of test_distutils now uses support.temp_cwd() in
setUp() to remove files created in the current working in all
BuildExtTestCase unit tests, not only test_build_ext().

Fix the following warning:

Warning -- files was modified by test_distutils
  Before: []
  After:  ['vc140.pdb']
2017-05-02 15:50:42 +02:00
Victor Stinner 33a5d40de9 bpo-30108: Restore sys.path in test_site (#1197) (#1378)
Add setUpModule() and tearDownModule() functions to test_site to
save/restore sys.path at the module level to prevent warning if the
user site directory is created, since site.addsitedir() modifies
sys.path.
(cherry picked from commit b85c136903)
2017-05-02 11:45:42 +02:00
Victor Stinner 809101f14f bpo-30104: Use -fno-strict-aliasing on clang (#1376)
Python/dtoa.c is not compiled correctly with clang 4.0 and
optimization level -O2 or higher, because of an aliasing issue on the
double/ULong[2] union. Only compile dtoa.c with -fno-strict-aliasing.

LLVM bug report:
https://bugs.llvm.org//show_bug.cgi?id=31928
2017-05-02 10:47:37 +02:00
Mariatta 78b23ab682 [3.6] Clean up some confusing text left by PROTOCOL_SSLv23 -> PROTOCOL_TLS transition (GH-1355) (#1371)
(cherry picked from commit d4069de511)
2017-05-01 22:55:53 -07:00
Mariatta 750ff5f8df [3.6] Improve the grammar in windows.rst (GH-1330) (GH-1360)
(cherry picked from commit 80a3da4d4a)
2017-04-29 22:18:40 -07:00
csabella 5a8dcec939 [3.6] bpo-30208: DOC: fix small typos in IDLE (#1356)
(cherry picked from commit d9af73330f)
2017-04-29 20:42:03 -04:00
Serhiy Storchaka 712114b3f9 [3.6] bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (GH-1341) (#1345)
They now work when delete replaced attribute or item inside the with
statement.  The old value of the attribute or item (or None if it doesn't
exist) now will be assigned to the target of the "as" clause, if there is
one.

(cherry picked from commit d1a1def7bf)
2017-04-28 20:05:05 +03:00
Victor Stinner e005dd9a6d bpo-30125: disable faulthandler in ctypes test_SEH (#1237) (#1343)
Disable faulthandler to run test_SEH() of test_ctypes to prevent the
following log with a traceback:

    Windows fatal exception: access violation

Add support.disable_faulthandler() context manager.
(cherry picked from commit a36e939aeb)
2017-04-28 16:06:48 +02:00
Victor Stinner cb21f5f3d2 bpo-30131: test_logging now joins queue threads (#1298) (#1317)
QueueListenerTest of test_logging now closes the multiprocessing
Queue and joins its thread to prevent leaking dangling threads to
following tests.

Add also @support.reap_threads to detect earlier if a test leaks
threads (and try to "cleanup" these threads).
(cherry picked from commit 8ca2f2faef)
2017-04-28 04:13:53 +02:00
Victor Stinner caa59c156d [3.6] bpo-30106: Fix test_asyncore.test_quick_connect() (#1336)
* Fix/optimize test_asyncore.test_quick_connect() (#1188)

Don't use addCleanup() in test_quick_connect() because it keeps the
Thread object alive and so @reap_threads fails on its timeout of 1
second. "./python -m test -v test_asyncore -m test_quick_connect"
now takes 185 ms, instead of 11 seconds.

Other minor changes:

* Use "with sock:" to close the socket instead of
  try/finally: sock.close()
* Use self.skipTest() in test_quick_connect() to remove one
  indentation level and notice user that the test is specific to
  AF_INET and AF_INET6

* bpo-30106: Fix tearDown() of test_asyncore (#1194)

Call asyncore.close_all() with ignore_all=True in the tearDown()
method of the test_asyncore base test case. It should prevent keeping
alive sockets in asyncore.socket_map if close() fails with an
unexpected error.

Revert also an unwanted change of my previous commit: remove name
parameter of Thread in test_quick_connect().

* bpo-30106: Fix test_asyncore.test_quick_connect() (#1234)

test_quick_connect() runs a thread up to 50 seconds, whereas the
socket is connected in 0.2 second and then the thread is expected to
end in less than 3 second. On Linux, the thread ends quickly because
select() seems to always return quickly. On FreeBSD, sometimes
select() fails with timeout and so the thread runs much longer than
expected.

Fix the thread timeout to fix a race condition in the test.
2017-04-28 04:13:37 +02:00
Victor Stinner c9ca57eeea bpo-30107: Make SuppressCrashReport quiet on macOS (#1279) (#1335)
On macOS, SuppressCrashReport now redirects /usr/bin/defaults command
stderr into a pipe to not pollute stderr. It fixes a
test_io.test_daemon_threads_shutdown_stderr_deadlock() failure when
the CrashReporter domain doesn't exists. Message logged into stderr:

2017-04-24 16:57:21.432 defaults[41046:2462851]
The domain/default pair of (com.apple.CrashReporter, DialogType) does not exist
(cherry picked from commit d819ad9832)
2017-04-28 03:27:51 +02:00
Victor Stinner 4dc3b9cf2a bpo-30175: Skip client cert tests of test_imaplib (#1320) (#1323)
* bpo-30175: Skip client cert tests of test_imaplib

The IMAP server cyrus.andrew.cmu.edu doesn't accept our randomly
generated client x509 certificate anymore.

* bpo-30188: Catch EOFError in NetworkedNNTPTests

test_nntplib fails randomly with EOFError in
NetworkedNNTPTests.setUpClass(). Catch EOFError to skip tests in that
case.

(cherry picked from commit 5bccca58b9)
2017-04-27 18:25:03 +02:00
Mariatta 33a5568f69 [3.6] bpo-30182: Use the correct name for ISO in Unicode HOWTO. (GH-1312) (GH-1313)
(cherry picked from commit 6fde770e4e)
2017-04-26 22:18:53 -07:00
Dong-hee Na 2fc3c543fc [3.6] bpo-30142: Remove "callable" from the 2to3fixer documentation. (GH-1303) 2017-04-26 09:55:55 -07:00
Berker Peksag 04f389b8b3 bpo-29974: Improve typing.TYPE_CHECKING example (GH-982)
* Fix PEP 8 (SomeType instead of some_type)
* Add a function parameter annotation
* Explain, using wording from PEP 484 and PEP 526,
  why one annotation is in quotes and another is not.

Suggested by Ivan Levkevskyi.

(cherry picked from commit 87c07fe9d9)
2017-04-26 17:25:37 +03:00
Louie Lu 9f6828119d bpo-28698: Fix c_wchar_p doc example (GH-1160)
(cherry picked from commit 0d637e236d)
2017-04-26 11:45:31 +03:00
Mariatta 16b6f971bd [3.6] bpo-28851: Improve namedtuple documentation (GH-1274) (GH-1286)
Clarify that a sequence of strings is the preferred value for 'field_names'.
(cherry picked from commit 97bf722fcd)
2017-04-25 18:23:05 -07:00
Mariatta ea0efa3bc1 [3.6] bpo-29751: Improve PyLong_FromString documentation (GH-915) (#1266)
(cherry picked from commit 26896f2832)
2017-04-23 21:05:01 -07:00
Serhiy Storchaka f2ed2858ee [3.6] bpo-15718: Document the upper bound constrain on the __len__ return value. (GH-1256) (#1259)
(cherry picked from commit 85157cd)
2017-04-23 08:50:14 +03:00
Louie Lu 9d022f169e [3.6] Fix trailing colon and newline in test.rst (GH-1250) (#1254)
(cherry picked from commit 7fae81e167)
2017-04-22 14:48:53 +03:00
Mariatta a3d8dda7d8 bpo-30098: Clarify that run_coroutine_threadsafe expects asyncio.Future (GH-1170) (#1247)
(cherry picked from commit ae5b3260dd)
2017-04-21 19:58:28 -07:00
Mariatta 414e0283a3 [3.6] Correct the README link in Unix install docs (GH-1245) (GH-1248)
(cherry picked from commit d1ae24e888)
2017-04-21 19:28:29 -07:00
Victor Stinner 3a8f8ea2ac bpo-30125: Fix faulthandler.disable() on Windows (#1243)
On Windows, faulthandler.disable() now removes the exception handler
installed by faulthandler.enable().
2017-04-21 23:17:33 +02:00
Steve Dower 1ccbe6007e bpo-29191: Add liblzma.vcxproj to pcbuild.sln and other missing entries (GH-1222) (GH-1244)
liblzma is missing from pcbuild.sln. This causes the build of _lzma to fail when building the solution and not using build.bat.
2017-04-21 11:28:46 -07:00
Victor Stinner b984a05d55 bpo-30107: don't dump core on expected test_io crash (#1235) (#1241)
test_io has two unit tests which trigger a deadlock:

* test_daemon_threads_shutdown_stdout_deadlock()
* test_daemon_threads_shutdown_stderr_deadlock()

These tests call Py_FatalError() if the expected bug is triggered
which calls abort(). Use test.support.SuppressCrashReport to prevent
the creation on a core dump, to fix the warning:

Warning -- files was modified by test_io
  Before: []
  After:  ['python.core']
(cherry picked from commit 2a1aed04b0)
2017-04-21 18:27:29 +02:00
Mariatta 483729526e [3.6] Add missing .gitignore entries for VS2015 IntelliSense DB (GH-1223) (#1225)
(cherry picked from commit 8e675286a9)
2017-04-20 20:55:59 -07:00
Serhiy Storchaka 7a113a0cbf bpo-29802: Fix the cleaning up issue in PyUnicode_FSDecoder(). (#1217) 2017-04-20 22:55:06 +03:00
Mariatta 430020500c [3.6] bpo-30109: Fix reindent.py (GH-1207) (GH-1208)
Skip the file if it has bad encoding.
(cherry picked from commit 58f3c9dc8f)
2017-04-20 07:12:37 -07:00