Commit Graph

24865 Commits

Author SHA1 Message Date
Victor Stinner 3a521f0b61
bpo-35346, platform: replace os.popen() with subprocess (GH-10786)
Replace os.popen() with subprocess.check_output() in the platform module:

* platform.uname() (its _syscmd_ver() helper function) now redirects
  stderr to DEVNULL.
* Remove platform.DEV_NULL.
* _syscmd_uname() and _syscmd_file() no longer catch AttributeError.
  The "except AttributeError:" was only needed in Python 2, when
  os.popen() was not always available. In Python 3,
  subprocess.check_output() is always available.
2018-12-07 11:10:33 +01:00
Steve Dower 468a15aaf9
bpo-34977: Add Windows App Store package (GH-10245) 2018-12-06 21:09:20 -08:00
Serhiy Storchaka 42b1d6127b
bpo-33023: Fix NotImplemented to NotImplementedError. (GH-10934) 2018-12-06 22:36:55 +02:00
Victor Stinner 0644b33821
bpo-35363: test_eintr uses print(flush=True) (GH-10990) 2018-12-06 14:16:21 +01:00
Victor Stinner 388c8c208d
bpo-35424: test_multiprocessing: join 3 pools (GH-10986)
Join 3 pools in these tests:

* test.test_multiprocessing_spawn.WithProcessesTestPool.test_context
* test.test_multiprocessing_spawn.WithProcessesTestPool.test_traceback
2018-12-06 11:56:52 +01:00
Victor Stinner 9dfc754d61
Revert "bpo-34172: multiprocessing.Pool leaks resources after being deleted (GH-8450)" (GH-10971)
This reverts commit 97bfe8d3eb.
2018-12-06 08:51:47 +01:00
native-api 8752dfbd1f bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278) 2018-12-06 09:04:35 +02:00
Victor Stinner aa8ae904ad
bpo-35363: test_eintr runs eintr_tester.py in verbose mode (GH-10965)
Moreover, "python3 -m test test_eintr -v" now avoids redirecting
stdout/stderr to a pipe, the child process inherits stdout/stderr
from the parent.
2018-12-06 00:18:30 +01:00
Victor Stinner 848acf7249
bpo-35389: test.pythoninfo logs platform.libc_ver (GH-10951) 2018-12-05 23:21:54 +01:00
Victor Stinner ea0ca218b0
bpo-35344: platform.platform() uses mac_ver() on macOS (GH-10780)
On macOS, platform.platform() now uses mac_ver(), if it returns a
non-empty release string, to get the macOS version rather than darwin
version.
2018-12-05 22:41:52 +01:00
Alex H 54fd45505b bpo-34185: Fix test module collision in test_bdb when ran as script. (GH-8537)
When running test_bdb.py as a script, `import test_module` would be
importing the existing Lib/test/test_modules.py instead of the
tempcwd/test_module.py module which was dynamically created by
test_bdb.py itself.
2018-12-05 21:32:16 +02:00
Victor Stinner f2f4555d82
bpo-10496: posixpath.expanduser() catchs pwd.getpwuid() error (GH-10919)
* posixpath.expanduser() now returns the input path unchanged if
  the HOME environment variable is not set and pwd.getpwuid() raises
  KeyError (the current user identifier doesn't exist in the password
  database).
* Add test_no_home_directory() to test_site.
2018-12-05 16:49:35 +01:00
Victor Stinner 476b113ed8
bpo-35389: platform.libc_ver() uses os.confstr() (GH-10891)
platform.libc_ver() now uses os.confstr('CS_GNU_LIBC_VERSION') if
available and the *executable* parameter is not set. The default
value of the libc_ver() *executable* parameter becomes None.

Quick benchmark on Fedora 29:

python3 -m perf command ./python -S -c 'import platform; platform.libc_ver()'
94.9 ms +- 4.3 ms -> 33.2 ms +- 1.4 ms: 2.86x faster (-65%)
2018-12-05 14:04:52 +01:00
Victor Stinner c11b3b19a5
bpo-35411: Skip test_urllib2net FTP tests on Travis CI (GH-10907)
On Travis CI, FTP tests of test_urllib2net randomly fail with "425
Security: Bad IP connecting".

test.pythoninfo now also logs TRAVIS environment variable.
2018-12-05 01:58:31 +01:00
Victor Stinner 4752e65250
bpo-35363, test_eintr: skip test_open() on macOS (GH-10896) 2018-12-04 17:13:33 +01:00
Andrew Svetlov 3bc0ebab17
bpo-35380: Enable TCP_NODELAY for proactor event loop (#10867) 2018-12-03 21:08:13 +02:00
Serhiy Storchaka 4013c17911
bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848) 2018-12-03 10:36:45 +02:00
Ismo Toijala 68b56d02ef bpo-35341: Add generic version of OrderedDict to typing (GH-10850) 2018-12-02 15:53:14 +00:00
Serhiy Storchaka 32bc11c33c
bpo-35371: Fix possible crash in os.utime() on Windows. (GH-10844) 2018-12-01 14:30:20 +02:00
Victor Stinner 7212148c95
bpo-35352: Cleanup test_asyncio/utils.py (GH-10831)
'here' variable is no longer needed.
2018-11-30 18:30:09 +01:00
stratakis b062ba77b6 bpo-35352: test_asyncio uses the certificate set from the test directory (GH-10826)
Modify asyncio tests to utilize the certificates from the test directory
instead of its own set, as they are the same and with each update they had
to be updated as well.
2018-11-30 17:56:56 +01:00
Victor Stinner 304315d251
bpo-35347: Cleanup test_socket.NonBlockingTCPTests (GH-10818)
* Replace testInheritFlags() with two tests:
  testInheritFlagsBlocking() and testInheritFlagsTimeout()
  to test different default socket timeout. Moreover, the test now
  checks sock.gettimeout() rather than a functional test on recv().
* Replace time.time() with time.monotonic()
* Add socket_setdefaulttimeout() context manager to restore the
  default timeout when the test completes.
* Remove testConnect(): accept() wasn't blocking and testAccept()
  already tests non-blocking accept().
* Remove accept() functional test from testInitNonBlocking():
  already tested by testAccept()
* Rewrite testSetBlocking() with a new assert_sock_timeout() method
* Use addCleanup() and context manager to close sockets
* Replace assertTrue(x < y) with assertLess(x, y)
2018-11-30 13:22:44 +01:00
Victor Stinner ebd5d6d6e6
bpo-35347: Fix test_socket.NonBlockingTCPTests (GH-10791)
testAccept() and testRecv() of test_socket.NonBlockingTCPTests have a
race condition: time.sleep() is used as a weak synchronization
primitive and the tests fail randomly on slow buildbots.

Use a reliable threading.Event to fix these tests.

Other changes:

* Replace send() with sendall()
* Expect specific BlockingIOError rather than generic OSError
* Add a timeout to select() in testAccept() and testRecv()
* Use addCleanup() to close sockets
* Use assertRaises()
2018-11-30 12:29:25 +01:00
Victor Stinner 55e498058f
bpo-35336: Fix PYTHONCOERCECLOCALE=1 (GH-10806)
Fix PYTHONCOERCECLOCALE=1 environment variable: only coerce the C
locale if the LC_CTYPE locale is "C".
2018-11-30 11:34:47 +01:00
Pablo Galindo 9724348b43 bpo-34279, regrtest: Issue a warning if no tests have been executed (GH-10150) 2018-11-29 18:17:44 +01:00
Victor Stinner 73104fa1e6
bpo-35345: Remove platform.popen() (GH-10781)
Remove platform.popen() function, it was deprecated since Python 3.3:
use os.popen() instead.

Rename also the "Removed" section to "API and Feature Removals"
of What's New in Python 3.8.
2018-11-29 09:58:20 +01:00
Victor Stinner 2956bffbc0
bpo-35189, bpo-35316: Make test_eintr less strict (GH-10782)
test_eintr no longer fails if the signal handler has not been called.
2018-11-29 01:34:51 +01:00
Victor Stinner 48498dd57f
bpo-33723: Remove busy loop from test_time (GH-10773)
The "busy loops" of test_process_time() and test_thread_time() are
not reliable and fail randomly on Windows: remove them.
2018-11-28 18:30:10 +01:00
INADA Naoki f7e4d3642f bpo-34100: compile: Re-enable frozenset merging (GH-10760)
This reverts commit 1005c84535.
2018-11-28 16:58:46 +01:00
Victor Stinner bde9d6bbb4
bpo-34523, bpo-35322: Fix unicode_encode_locale() (GH-10759)
Fix memory leak in PyUnicode_EncodeLocale() and
PyUnicode_EncodeFSDefault() on error handling.

Changes:

* Fix unicode_encode_locale() error handling
* Fix test_codecs.LocaleCodecTest
2018-11-28 10:26:20 +01:00
Victor Stinner b7278736b3
bpo-33676: Fix dangling thread in _test_multiprocessing (GH-10755)
Fix WithThreadsTestPool.test_wrapped_exception()
of test_multiprocessing_fork: join the pool.

WithThreadsTestPool.test_del_pool() is now also decorated
with @support.reap_threads.
2018-11-28 01:14:31 +01:00
Victor Stinner 1005c84535
bpo-34100: Partially revert merge_consts_recursive() (GH-10743)
Partically revert commit c2e1607a51 to
fix a reference leak.
2018-11-27 15:12:47 +01:00
Victor Stinner cfaafda8e3
bpo-35317: Fix mktime() error in test_email (GH-10721)
Fix mktime() overflow error in test_email: run
test_localtime_daylight_true_dst_true() and
test_localtime_daylight_false_dst_true() with a specific timezone.
2018-11-27 12:40:50 +01:00
Serhiy Storchaka b619b09792
bpo-31241: Fix AST node position for list and generator comprehensions. (GH-10633)
The lineno and col_offset attributes of AST nodes for list comprehensions,
generator expressions and tuples are now point to the opening parenthesis or
square brace. For tuples without parenthesis they point to the position
of the first item.
2018-11-27 09:40:29 +02:00
Zackery Spytz d1cbc6f8a0 Include the highest pickle protocol in a couple of tests. (GH-10735)
test_reduce_ex() in test_array.py and
test_reversevaluesiterator_pickling() in test_dict.py weren't using
the highest pickle protocol.
2018-11-27 07:40:49 +02:00
Zhiming Wang 8c281ed403 bpo-35308: Fix regression where BROWSER env var is not respected. (GH-10693)
Regression introduced in e3ce695 and 25b804a, where the old parameter
update_tryorder to _synthesize was first ignored, then given the opposite
value in the attempt to fix bpo-31014.
2018-11-26 23:29:45 +02:00
Victor Stinner 65c216e74f
bpo-33723: Fix test_time.test_thread_time() (GH-10724)
Tolerate up to 30 ms, instead of 15 min, in other threads.
2018-11-26 21:19:29 +01:00
Lisa Roach 433433fa6d
Adds IPv6 support when invoking http.server directly. (GH-10595) 2018-11-26 10:43:38 -08:00
Victor Stinner 282c03d45d
pythoninfo: log more environment variable (GH-10719)
Log TZ to debug a timezone issue... and a few more :-)
2018-11-26 17:03:16 +01:00
INADA Naoki c2e1607a51 bpo-34100: Merge constants recursively (GH-8341)
There are some same consts in a module.  This commit merges them into
single instance.  It reduces number of objects in memory after loading modules.


https://bugs.python.org/issue34100
2018-11-26 04:23:22 -08:00
Victor Stinner f0b366a8d7
bpo-35313: Cleanup test_embed.py (GH-10716)
* Remove an unused import.
* Move get_expected_config() call to check_config() to ease backport
  to Python 3.7.
2018-11-26 12:37:34 +01:00
Victor Stinner a6537fb7c2
bpo-35313: Fix test_embed when run from venv (GH-10713)
test_embed.InitConfigTests now gets the expected configuration from
a child process run with -S to not run the site module.
2018-11-26 11:54:12 +01:00
Dustin Spicuzza 1d817e4c82 bpo-29877: compileall: import ProcessPoolExecutor only when needed (GH-4856)
Importing ProcessPoolExecutor may hang or cause an error when the import
accesses urandom on a low resource platform


https://bugs.python.org/issue29877
2018-11-23 09:06:55 -08:00
Victor Stinner 9de3632715
bpo-34812: subprocess._args_from_interpreter_flags(): add isolated (GH-10675)
The "-I" command line option (run Python in isolated mode) is now
also copied by the multiprocessing and distutils modules when
spawning child processes. Previously, only -E and -s options (enabled
by -I) were copied.

subprocess._args_from_interpreter_flags() now copies the -I flag.
2018-11-23 17:54:20 +01:00
nierob b409ffa848 bpo-35189: Retry fnctl calls on EINTR (GH-10413)
Modify the following fnctl function to retry if interrupted by a signal
(EINTR): flock, lockf, fnctl.
2018-11-23 16:46:12 +01:00
Victor Stinner f1d002c1e0
bpo-35059: Enhance _PyObject_AssertFailed() (GH-10642)
Enhance _PyObject_AssertFailed()

* Exchange 'expr' and 'msg' parameters
* 'expr' and 'func' arguments can now be NULL
2018-11-21 23:53:44 +01:00
Victor Stinner aac1f81eef
bpo-35189: Fix eintr_tester.py (GH-10637)
Call setitimer() before each test method, instead of once per test
case, to ensure that signals are sent in each test method.
Previously, only the first method of a testcase class got signals.

Changes:

* Replace setUpClass() with setUp() and replace tearDownClass() with
  tearDown().
* tearDown() now ensures that at least one signal has been sent.
* Replace support.run_unittest() with unittest.main() which has
  a nicer CLI and automatically discover test cases.
2018-11-21 16:33:13 +01:00
Victor Stinner 7c2d5702d1
bpo-35290: Add debug info to test_c_locale_coercion (GH-10631)
In verbose mode, test_c_locale_coercion now dumps global variables at
startup.
2018-11-21 12:21:25 +01:00
Serhiy Storchaka 3ec0f49516
bpo-35021: Fix assertion failures in _datetimemodule.c. (GH-10039)
Fixes assertion failures in _datetimemodule.c
introduced in the previous fix (see bpo-31752).

Rather of trying to handle an int subclass as exact int,
let it to use overridden special methods, but check the
result of divmod().
2018-11-20 20:41:09 +02:00
Serhiy Storchaka 97f1efb606
bpo-35169: Improve error messages for forbidden assignments. (GH-10342) 2018-11-20 19:27:16 +02:00