Commit Graph

27484 Commits

Author SHA1 Message Date
Serhiy Storchaka 328b5d0e64 [2.7] bpo-31675: Fix memory leaks in Tkinter's methods splitlist() and split() (GH-3866) (#3876)
when pass a string larger than 2 GiB.

Decrease memory requirements for Tcl's bigmem tests..
(cherry picked from commit 27c623c845)
2017-10-04 21:37:53 +03:00
Oren Milman 13da1a60f1 [2.7] bpo-31478: Prevent unwanted behavior in _random.Random.seed() in case the arg has a bad __abs__() method (GH-3596) (#3845) 2017-10-03 00:31:42 +03:00
Victor Stinner 20cbc1d29f bpo-31158: Fix nondeterministic read in test_pty (#3808) (#3853)
(cherry picked from commit e6f62f69f0)
2017-10-02 02:58:09 -07:00
Serhiy Storchaka 1163fb9be0 [2.7] bpo-31627: Make test_mailbox be lenient to empty hostname. (GH-3821) (#3838)
(cherry picked from commit f4ea642cb6)
2017-09-30 22:52:25 +03:00
Oren Milman 40d736bcf4 [2.7] bpo-31285: Don't raise a SystemError in warnings.warn_explicit() in case __loader__.get_source() has a bad splitlines() method. (GH-3219) (#3823)
(cherry picked from commit 91fb0af)
2017-09-30 17:06:55 +03:00
Victor Stinner 8b83687bdf bpo-28129: fix ctypes crashes (#386) (#3800)
* init commit, with initial tests for from_param and fields __set__ and __get__, and some additions to from_buffer and from_buffer_copy

* added the rest of tests and patches. probably only a first draft.

* removed trailing spaces

* replace ctype with ctypes in error messages

* change back from ctypes instance to ctype instance

(cherry picked from commit 1bea762d9e)
2017-09-28 07:31:40 -07:00
Victor Stinner b4920d562b bpo-31593: test_socketserver waits child processes (#3786) 2017-09-27 03:02:57 -07:00
Miss Islington (bot) 9bfa55bfea [2.7] bpo-31490: Fix an assertion failure in ctypes in case an _anonymous_ attr is defined only outside _fields_. (GH-3615) (#3780)
(cherry picked from commit 30b61b51e0)
2017-09-27 09:52:44 +03:00
Serhiy Storchaka 81691b0548 [2.7] bpo-31311: Fix a SystemError and a crash in ctypes._CData.__setstate__(), in case of a bad __dict__. (GH-3254). (#3781)
(cherry picked from commit 57c2561c8c)
2017-09-27 09:24:39 +03:00
Serhiy Storchaka d0b9dc3367 [2.7] bpo-30347: Stop crashes when concurrently iterate over itertools.groupby() iterators. (GH-1557). (#3772)
(cherry picked from commit c740e4fe8a)
2017-09-26 23:15:36 +03:00
Serhiy Storchaka d94a65a069 bpo-25732: Make functools.total_ordering implementing __ne__. (#3748)
Patch by Raymond Hettinger.
2017-09-25 14:41:34 +03:00
Victor Stinner 5f5da728ae bpo-31170: Write unit test for Expat 2.2.4 UTF-8 bug (#3570) (#3745)
Non-regression tests for the Expat 2.2.3 UTF-8 decoder bug.

(cherry picked from commit e6d9fcbb8d)
2017-09-25 01:43:56 -07:00
Igor Filatov cf7197ae43 [2.7] bpo-31351: Set return code in ensurepip when pip fails (GH-3734)
Previously ensurepip would always report success, even if the
pip installation failed.

(cherry picked from commit 9adda0cdf8)
2017-09-25 11:03:24 +10:00
Miss Islington (bot) 860839cc8e [2.7] bpo-30442: Skips refcount test in test_xml_etree under coverage (GH-1767) (#3549)
(cherry picked from commit 1de4705d00)
2017-09-13 15:17:55 -07:00
Victor Stinner 42f7e0d8b0 bpo-31234: fork_wait tests now join threads (#3139) (#3535)
fork_wait.py tests now joins threads, to not leak running threads in
the background.

(cherry picked from commit c99d41f9c0)
2017-09-13 03:26:54 -07:00
Victor Stinner 40996d3f6f bpo-17085: test_socket: cancel scheduled alarm on test failure (#3505)
(cherry picked from commit 71fe8c00f6)
2017-09-11 15:31:16 -07:00
Serhiy Storchaka 004547f970 [2.7] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (#3493)
(cherry picked from commit 252033d50e)
2017-09-11 10:01:31 +03:00
Cheryl Sabella e1847ea4a9 bpo-25684: ttk.OptionMenu radiobuttons weren't unique (GH-2276) (GH-2960)
ttk.OptionMenu radiobuttons weren't unique 
between instances of OptionMenu.
(cherry picked from commit a568e52733)
2017-09-09 23:02:14 -07:00
Christian Heimes b9a860f3bf [2.7] bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3 (GH-1363) (#3446)
* bpo-29136: Add TLS 1.3 support

TLS 1.3 introduces a new, distinct set of cipher suites. The TLS 1.3
cipher suites don't overlap with cipher suites from TLS 1.2 and earlier.
Since Python sets its own set of permitted ciphers, TLS 1.3 handshake
will fail as soon as OpenSSL 1.1.1 is released. Let's enable the common
AES-GCM and ChaCha20 suites.

Additionally the flag OP_NO_TLSv1_3 is added. It defaults to 0 (no op) with
OpenSSL prior to 1.1.1. This allows applications to opt-out from TLS 1.3
now.

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit cb5b68abde)
2017-09-07 22:31:17 -07:00
Miss Islington (bot) 47e5f79122 [2.7] bpo-30824: Add mimetype for .json (GH-3048) (#3394)
(cherry picked from commit 8204b90368)
2017-09-06 18:31:36 -04:00
Victor Stinner eeadf5fc23 bpo-31339: Rewrite time.asctime() and time.ctime() (#3293)
* bpo-31339: Rewrite time.asctime() and time.ctime()

Backport and adapt the _asctime() function from the master branch to
not depend on the implementation of asctime() and ctime() from the
external C library. This change fixes a bug when Python is run using
the musl C library.

* bound checks for time.asctime()

* bound checks for time.strftime()
2017-09-06 01:35:39 +02:00
Gregory P. Smith 5e8e371364 bpo-27448: Work around a gc.disable race condition in subprocess. (#1932)
* bpo-27448: Work around a gc.disable race condition in subprocess.

This works around a gc.isenabled/gc.disable race condition in the 2.7
subprocess module by using a lock for the critical section.  It'll
prevent multiple simultaneous subprocess launches from winding up with
gc remaining disabled but it can't fix the ultimate problem: gc enable
and disable is a global setting and a hack.

Users are *strongly encouraged* to use subprocess32 from PyPI instead
of the 2.7 standard library subprocess module.  Mixing threads with
subprocess is a recipie for disaster otherwise even with "fixes" to
ameliorate common issues like this.

* Add a blurb!
2017-09-05 11:20:02 -07:00
Christian Heimes 57d963b0b5 [2.7] bpo-25674: remove sha256.tbs-internet.com ssl test (GH-3297) (#3301)
* bpo-25674: remove sha256.tbs-internet.com ssl test (#3297)

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 002d64039b)

* [2.7] bpo-25674: remove sha256.tbs-internet.com ssl test (GH-3297)

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 002d64039b)
2017-09-04 23:08:36 +02:00
Pauli Virtanen 990b2d043c [2.7] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31) (#3242)
[2.7] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31)

Ctypes currently produces wrong pep3118 type codes for several types.
E.g. memoryview(ctypes.c_long()).format gives "<l" on 64-bit platforms,
but it should be "<q" instead for sizeof(c_long) == 8

The problem is that the '<>' endian specification in the struct syntax
also turns on the "standard size" mode, which makes type characters have
a platform-independent meaning, which does not match with the codes used
internally in ctypes.  The struct module format syntax also does not
allow specifying native-size non-native-endian items.

This commit adds a converter function that maps the internal ctypes
codes to appropriate struct module standard-size codes in the pep3118
format strings. The tests are modified to check for this..
(cherry picked from commit 07f1658aa0)
2017-09-02 18:24:32 +02:00
Oren Milman 20958e6d91 [2.7] bpo-31243: Fixed PyArg_ParseTuple failure checks. (GH-3171) (#3235) 2017-08-29 19:16:12 +03:00
Benjamin Peterson 5bd2368840 Merge branch 'release-2.7.14' into 2.7 2017-08-26 13:42:29 -07:00
Oren Milman bc80fd1bd2 [2.7] bpo-28261: Prevent raising SystemError where PyArg_ParseTuple is used to parse non-args. (#3213) 2017-08-26 21:56:31 +03:00
Benjamin Peterson 48455e2151 update pydoc topics 2017-08-26 11:17:02 -07:00
Victor Stinner 02e03672e6 bpo-31258: test_urllib2_localnet uses addCleanup(server.stop) (#3184)
Use self.addCleanup(self.server.stop) to stop the HTTP server. Some
tests didn't stop the server like test_https().
2017-08-22 16:51:20 +02:00
Victor Stinner 1460ce5a93 bpo-31258: test_signal: call waitpid() to prevent zombie process (#3183) 2017-08-22 16:51:09 +02:00
Victor Stinner cce1cb9180 bpo-30871: Add test.pythoninfo (#3174) (#3175)
* bpo-30871: Add test.pythoninfo (#3075)

* Add Lib/test/pythoninfo.py: script collecting various informations
  about Python to help debugging test failures.
* regrtest: remove sys.hash_info and sys.flags from header.
* Travis CI, Appveyor: run pythoninfo before tests
(cherry picked from commit b907abc885)

* bpo-30871: pythoninfo: add expat and _decimal (#3121)

* bpo-30871: pythoninfo: add expat and _decimal

* Remove _decimal.__version__

The string is hardcoded, not really interesting.

(cherry picked from commit f6ebd838f0)

* bpo-30871: Add "make pythoninfo" (#3120)

(cherry picked from commit a3a01a2fce)

* bpo-30871: pythoninfo: more sys, os, time data (#3130)

* bpo-30871: pythoninfo: more sys, os, time data

PythonInfo now converts types other than intger to string by default.

* fix typo

(cherry picked from commit ad7eaed543)

* bpo-31231: Fix pythoninfo in Travis config (#3134)

bpo-31231, bpo-30871: Replace "./python -m test.pythoninfo" with
"make pythoninfo", since macOS uses ./python.exe.
(cherry picked from commit 92b1f90143)

(cherry picked from commit 29d007bb67)
2017-08-22 03:40:26 +02:00
Victor Stinner 0fbac706f7 regrtest: fix test to choose if header should be displayed (#3172)
Check "tests" before its value is replaced.
2017-08-21 23:57:06 +02:00
Victor Stinner 02d4292df4 bpo-30263: regrtest: add system load average (#3165)
Add the CPU count in the header.
2017-08-21 18:01:11 +02:00
Victor Stinner 883520a846 bpo-31069, test_multiprocessing: Fix dangling process (#3103) (#3105)
Fix a warning about dangling processes in test_rapid_restart() of
_test_multiprocessing: join the process.
(cherry picked from commit 17657bb945)
2017-08-16 13:14:40 +02:00
Christian Heimes 05b7d9c667 [2.7] bpo-30714: ALPN changes for OpenSSL 1.1.0f (#3094)
OpenSSL 1.1.0 to 1.1.0e aborted the handshake when server and client
could not agree on a protocol using ALPN. OpenSSL 1.1.0f changed that.
The most recent version now behaves like OpenSSL 1.0.2 again. The ALPN
callback can pretend to not been set.

See https://github.com/openssl/openssl/pull/3158 for more details

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit a5c1bab352)
2017-08-15 10:55:03 +02:00
Victor Stinner 504939fdf4 bpo-31067: test_subprocess calls reap_children() (#2931) (#3073)
test_subprocess now also calls reap_children() in tearDown(), not
only on setUp().
(cherry picked from commit cc42c121eb)
2017-08-11 17:14:31 +02:00
Victor Stinner 4dea06531e bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055) (#3071)
The current test_child_terminated_in_stopped_state() function test
creates a child process which calls ptrace(PTRACE_TRACEME, 0, 0) and
then crash (SIGSEGV). The problem is that calling os.waitpid() in the
parent process is not enough to close the process: the child process
remains alive and so the unit test leaks a child process in a
strange state. Closing the child process requires non-trivial code,
maybe platform specific.

Remove the functional test and replaces it with an unit test which
mocks os.waitpid() using a new _testcapi.W_STOPCODE() function to
test the WIFSTOPPED() path.
(cherry picked from commit 7b7c6dcfff)
2017-08-11 14:38:37 +02:00
Victor Stinner 1247e2cda5 [2.7] bpo-31160: Backport reap_children fixes from master to 2.7 (#3063)
* bpo-31160: regrtest now reaps child processes (#3044)

Add a post_test_cleanup() function which currently only calls
support.reap_children().
(cherry picked from commit e3510d74aa)

* bpo-31160: test_tempfile: Fix reap_children() warning (#3056)

TestRandomNameSequence.test_process_awareness() now calls
os.waitpid() to avoid leaking a zombie process.
(cherry picked from commit 6c8c2943d9)
2017-08-10 16:45:38 +02:00
Ammar Askar 425680bbd2 [2.7] bpo-31150: Wait for child process in test_forkinthread to avoid thread reaped warnings (#3042) 2017-08-09 16:54:53 +02:00
Victor Stinner 56e162ad5c ttk: fix LabeledScale and OptionMenu destroy() method (#3026)
bpo-31135: Call the parent destroy() method even if the used
attribute doesn't exist.

The LabeledScale.destroy() method now also explicitly clears label
and scale attributes to help the garbage collector to destroy all
widgets.
2017-08-08 19:15:52 +02:00
Shane Harvey 88ffff5ddb [2.7] bpo-31107: Fix copyreg mangled slot names calculation. (GH-2989). (#3004)
(cherry picked from commit c4c9866064)
2017-08-05 18:03:01 +03:00
Serhiy Storchaka 3dd1ccbb09 bpo-29902: Emit a Py3k deprecation warning when pickling or copying (#2823)
some builtin and extension objects that don't support pickling
explicitly and are pickled incorrectly by default (like memoryview or
staticmethod).
2017-08-02 11:33:33 +03:00
INADA Naoki 3e37f4a115 bpo-29519: weakref spewing exceptions during interp finalization (#2958)
(cherry pick from 9cd7e17640)
2017-07-31 10:52:46 -07:00
Victor Stinner c2f7fb6151 [2.7] bpo-31044: Skip test_posix.test_makedev() on FreeBSD (#2915) (#2918)
* bpo-31044: Skip test_posix.test_makedev() on FreeBSD (#2915)

There is a bug in FreeBSD CURRENT with 64-bit dev_t. Skip the test if
dev_t is larger than 32-bit, until the bug is fixed in FreeBSD
CURRENT.
(cherry picked from commit 12953ffe12)

* Fix syntax for Python 2.7
2017-07-27 18:44:43 +02:00
Victor Stinner fd6736d179 bpo-31028: Fix test_pydoc when run directly (#2864) (#2911)
* bpo-31028: Fix test_pydoc when run directly

Fix get_pydoc_link() of test_pydoc to fix "./python
Lib/test/test_pydoc.py": get the absolute path to __file__ to prevent
relative directories.

* Use realpath() instead of abspath()

(cherry picked from commit fd46561167)
2017-07-27 18:05:44 +02:00
Nir Soffer 29094cec7c bpo-30980: Fix double close in asyncore.file_wrapper (#2789) (#2900)
* bpo-30980: Fix close test to fail

test_close_twice was not considering the fact that file_wrapper is
duping the file descriptor. Closing the original descriptor left the
duped one open, hiding the fact that close protection is not effective.

* bpo-30980: Fix double close protection

Invalidated self.fd before closing, handling correctly the case when
os.close raises.

* bpo-30980: Fix fd leak introduced in the fixed test
2017-07-27 01:24:52 +02:00
Victor Stinner 0cba38d207 bpo-30778: Skip test_bsddb3 on Windows XP (#2877)
* bpo-30778: Skip test_bsddb3 on Windows XP

* Fix if, don't skip Windows Vista
2017-07-26 17:55:52 +02:00
Victor Stinner b65cb8a356 bpo-31019: Fix multiprocessing.Process.is_alive() (#2875) (#2882)
multiprocessing.Process.is_alive() now removes the process from the
_children set if the process completed.

The change prevents leaking "dangling" processes.
(cherry picked from commit 2db64823c2)
2017-07-26 17:54:42 +02:00
Victor Stinner ec9a7127b8 [3.6] bpo-30595: Fix multiprocessing.Queue.get(timeout) (#2027) (#2881) (#2883)
* bpo-30595: Fix multiprocessing.Queue.get(timeout) (#2027)

multiprocessing.Queue.get() with a timeout now polls its reader in
non-blocking mode if it succeeded to aquire the lock but the acquire
took longer than the timeout.

Co-Authored-By: Grzegorz Grzywacz <grzgrzgrz3@gmail.com>
(cherry picked from commit 1b7863c3b6)

* bpo-30595: Increase test_queue_feeder_donot_stop_onexc() timeout (#2148)

_test_multiprocessing.test_queue_feeder_donot_stop_onexc() now uses a
timeout of 1 second on Queue.get(), instead of 0.1 second, for slow
buildbots.
(cherry picked from commit 8f6eeaf21c)

(cherry picked from commit e42339d3a0)
2017-07-26 17:52:36 +02:00
Dong-hee Na e5eae474c4 [2.7] bpo-30119: fix ftplib.FTP.putline() to throw an error for a illegal command (#1214) (#2894) 2017-07-26 17:50:36 +02:00
Victor Stinner 0fc940a09a test_bsddb3 tolerates smaller timeout on Windows (#2840)
bpo-30850: On Windows, test04_lock_timeout2() now tolerates 50 ms
whereas 100 ms is expected. The lock sometimes times out after only
58 ms. Windows clocks have a bad resolution and bad accuracy.
2017-07-24 13:01:59 +02:00
Victor Stinner 80ebc438ed bpo-30822: regrtest: fix -u extralargefile (#2788)
Fix also regrtest command line parser to allow passing -u
extralargefile to run test_zipfile64.
2017-07-21 02:12:14 +02:00
Ammar Askar a739000db5 [2.7] bpo-30883: Use pythontest.net instead of debian.org in test_urllib2net (GH-2755) 2017-07-19 07:07:49 +03:00
Serhiy Storchaka b6dae2e40d [2.7] bpo-30911: Add tests for bad boolean arguments for accelerated json (GH-2690) (#2694)
encoder and decoder..
(cherry picked from commit d3aaa2f149)
2017-07-13 12:03:18 +03:00
Victor Stinner f6d6480b93 [2.7] bpo-30855: Trying to fix test_use on Windows. (#2586)
* bpo-30855: Trying to fix test_use on Windows.

Avoid possible weird behavior of WideInt convertion.
"winfo id" always returns string hexadecimal representation.

(cherry picked from commit b9d672491d)

* bpo-30855: Trying to fix test_use on Windows.

(cherry picked from commit 29a2f7c6b3)
(subTest() removed since it was introduced in Python 3)
2017-07-06 10:22:50 +02:00
Mariatta af6c5474cc Fix trivial typo in json module docstring (GH-2274) (GH-2432)
(cherry picked from commit 76c567ee27)
2017-07-05 20:55:30 -07:00
Serhiy Storchaka 2b92cd3b16 bpo-30850: Use specialized assert methods in bsddb tests. (#2584)
This provides more information on test failures.
2017-07-05 14:09:36 +02:00
Victor Stinner 8767de2f77 bpo-30759: regrtest: list_cases() now unload modules (#2582)
list_cases() now unload modules, as the test runner does, to prevent
a failure in test_xpickle about test.pickletester loaded after
loading test_cpickle:

./python -m test --list-cases test_cpickle test_xpickle
2017-07-05 10:52:06 +02:00
Victor Stinner 668489a6d5 bpo-30759: Copy test_robotparser from master (#2546)
Copy Lib/test/test_robotparser.py from master to 2.7 and adapt it for
Python 2.7:

* Replace urllib.robotparser with robotparser
* Adjust HTTPServer import
* Replace io.StringIO with StringIO.StringIO
* Remove tests on crawl_delay() and request_rate() since these
  methods were added to Python 3
* Remove subTest()
* Add test_main() which explicitly lists all test cases

Patch based on the commit 4da0fd06ce
written by Berker Peksag.

Co-Authored-By: Berker Peksag <berker.peksag@gmail.com>
2017-07-05 10:00:33 +02:00
Victor Stinner 3050987d85 bpo-30843: regrtest fixes sys.path, restore test.bisect (#2567)
* Rename again Lib/test/bisectcmd.py to Lib/test/bisect.py
* regrtest now removes '' and Lib/test/ from sys.path
* Use absolute import in test_bisect
2017-07-05 09:16:47 +02:00
Victor Stinner 28b72baf3c bpo-30843: Rename Lib/test/bisect.py to Lib/test/bisectcmd.py (#2563)
Revert test_bisect.py change:
remove "from __future__ import absolute_import".
2017-07-04 11:45:04 +02:00
Victor Stinner 1fef0154d9 bpo-29796: test_weakref: Fix collect_in_thread() on Windows (#2553)
Sleep 1 ms instead of 0.1 ms to workaround a rounding issue on
Windows. On Windows, time.sleep(0.0001) sleeps 0 ms, so
collect_in_thread() calls gc.collect() in a loop and tests using this
thread takes too long. Sleep 1 ms so time.sleep() sleeps 15.6 ms on
Windows.
2017-07-04 11:36:16 +02:00
Victor Stinner 1e4fcb3edd regrtest: fix --list-cases --verbose (#2547)
Write header and "Using seed ..." after checking for --list-cases and
--list-tests.
2017-07-03 22:18:28 +02:00
Serhiy Storchaka c51a8e9072 [2.7] Rename test_ file that is really a support file to remove test_ prefix. (#2548)
I thought I had run the full test suite before the last checkin, but
obviously I didn't.  test_multibytecodec_support.py isn't really a test file,
it is a support file that contains a base test class.  Rename it to
multibytecodec_support so that regrtest test discovery doesn't think it is a
test file that should be run..
(cherry picked from commit 75d9aca97a)
2017-07-03 22:01:57 +02:00
Victor Stinner d7955b8196 [2.7] bpo-29512, bpo-30764: Backport regrtest enhancements from 3.5 to 2.7 (#2541)
* bpo-29512, bpo-30764: Backport regrtest enhancements from 3.5 to 2.7

* bpo-29512: Add test.bisect, bisect failing tests (#2452)

Add a new "python3 -m test.bisect" tool to bisect failing tests.

It can be used to find which test method(s) leak references, leak
files, etc.

* bpo-30764: Fix regrtest --fail-env-changed --forever (#2536) (#2539)

--forever now stops if a fail changes the environment.

* Fix test_bisect: use absolute import
2017-07-03 15:07:53 +02:00
Victor Stinner fd93f37f0d bpo-30448: Fix support.SuppressCrashReport on macOS (#2515)
Add missing "import subprocess".
2017-07-01 01:01:28 +02:00
Antoine Pitrou a45a99b47f [2.7] bpo-30807: signal.setitimer() may disable the timer by mistake (GH-2493) (#2499)
* bpo-30807: signal.setitimer() may disable the timer by mistake

* Add NEWS blurb.
(cherry picked from commit 729780a810)
2017-06-30 10:54:54 +02:00
Antoine Pitrou 12536bd261 [2.7] Clear potential ref cycle between Process and Process target (GH-2470) (#2473)
* Clear potential ref cycle between Process and Process target

Besides Process.join() not being called, this was an indirect cause of bpo-30775.
The threading module already does this.

* Add issue reference.
(cherry picked from commit 79d37ae979)
2017-06-28 13:48:38 +02:00
Victor Stinner fea98bfcff [2.7] bpo-30523, bpo-30764, bpo-30776: Sync regrtest from master (#2444)
* bpo-30523: regrtest --list-cases --match (#2401)

* regrtest --list-cases now supports --match and --match-file options.
  Example: ./python -m test --list-cases -m FileTests test_os
* --list-cases now also sets support.verbose to False to prevent
  messages to stdout when loading test modules.
* Add support._match_test() private function.
(cherry picked from commit ace56d5836)

(cherry picked from commit 36946c06a3)

* bpo-30764: regrtest: add --fail-env-changed option (#2402)

* bpo-30764: regrtest: change exit code on failure

* Exit code 2 if failed tests ("bad")
* Exit code 3 if interrupted

* bpo-30764: regrtest: add --fail-env-changed option

If the option is set, mark a test as failed if it alters the
environment, for example if it creates a file without removing it.

(cherry picked from commit 63f54c6893)
(cherry picked from commit 1f33857a36)

* bpo-30776: reduce regrtest -R false positives (#2422)

* Change the regrtest --huntrleaks checker to decide if a test file
  leaks or not. Require that each run leaks at least 1 reference.
* Warmup runs are now completely ignored: ignored in the checker test
  and not used anymore to compute the sum.
* Add an unit test for a reference leak.

Example of reference differences previously considered a failure
(leak) and now considered as success (success, no leak):

    [3, 0, 0]
    [0, 1, 0]
    [8, -8, 1]
(cherry picked from commit 48b5c422ff)

(cherry picked from commit e0f8b43a46)
2017-06-27 16:56:43 +02:00
Victor Stinner 2d775589d9 bpo-30705: Fix test_regrtest.test_crashed() (#2439)
* Add test.support._crash_python() which triggers a crash but uses
  test.support.SuppressCrashReport() to prevent a crash report from
  popping up.
* Modify test_child_terminated_in_stopped_state() of test_subprocess
  and test_crashed() of test_regrtest to use _crash_python().
2017-06-27 15:37:19 +02:00
Victor Stinner 95a91df036 bpo-30764: Windows support.SuppressCrashReport (#2423)
* Add Windows support to test.support.SuppressCrashReport: call
  SetErrorMode() and CrtSetReportMode().
* _testcapi: add CrtSetReportMode() and CrtSetReportFile() functions
  and CRT_xxx and CRTDBG_xxx constants needed by SuppressCrashReport.
2017-06-27 14:31:40 +02:00
Victor Stinner 2097b9e0ef [2.7] bpo-30764: test_subprocess uses SuppressCrashReport (#2405) (#2412)
* bpo-30764: Backport support.SuppressCrashReport

Backport test.support.SuppressCrashReport context-manager from
master. Drop the Windows implementation since it depends on
msvcrt.CrtSetReportMode() which isn't available on Python 2.7.

* bpo-30764: test_subprocess uses SuppressCrashReport (#2405)

bpo-30764, bpo-29335: test_child_terminated_in_stopped_state() of
test_subprocess now uses support.SuppressCrashReport() to prevent the
creation of a core dump on FreeBSD.
(cherry picked from commit cdee3f14f7)
2017-06-27 00:00:51 +02:00
Serhiy Storchaka 787826c931 [2.7] bpo-30746: Prohibited the '=' character in environment variable names (GH-2382) (#2393)
in `os.putenv()` and `os.spawn*()`..
(cherry picked from commit 77703942c5)
2017-06-25 09:50:00 +03:00
Serhiy Storchaka 9dda2caca8 [2.7] bpo-30730: Prevent environment variables injection in subprocess on Windows. (GH-2325) (#2372)
Prevent passing other invalid environment variables and command arguments..
(cherry picked from commit d174d24a5d)
2017-06-24 11:49:00 +03:00
Serhiy Storchaka 7709b4d57b [2.7] bpo-30727: Fix a race condition in test_threading. (GH-2334). (#2353)
(cherry picked from commit 32cb968a2e)
2017-06-23 14:13:39 +03:00
Victor Stinner da6d305b6f bpo-8799: Reduce timing sensitivity of condition test by explicitly (#2320)
delaying the main thread so that it doesn't race ahead of the workers.

(cherry picked from commit 020af2a2bc)
2017-06-22 02:09:40 +02:00
Victor Stinner d4324baca4 bpo-30500: urllib: Simplify splithost by calling into urlparse. (#1849) (#2294)
The current regex based splitting produces a wrong result. For example::

  http://abc#@def

Web browsers parse that URL as ``http://abc/#@def``, that is, the host
is ``abc``, the path is ``/``, and the fragment is ``#@def``.
(cherry picked from commit 90e01e50ef)
2017-06-20 16:20:36 +02:00
Victor Stinner 24c2c20873 bpo-30540, bpo-30523: Add --matchfile and --list-cases options to regrtest (#2249)
[2.7] bpo-30540, bpo-30523: Add --matchfile and --list-cases options to regrtest
2017-06-16 17:30:03 +02:00
Victor Stinner 8bb0863e02 bpo-30675: Fix refleak hunting in regrtest (#2227)
regrtest now warms up caches: create explicitly all internal
singletons which are created on demand to prevent false positives
when checking for reference leaks.
2017-06-16 12:14:09 +02:00
Antoine Pitrou d09f1674d7 [2.7] bpo-24484: Avoid race condition in multiprocessing cleanup (GH-2159) (#2168)
* bpo-24484: Avoid race condition in multiprocessing cleanup

The finalizer registry can be mutated while inspected by multiprocessing
at process exit.

* Use test.support.start_threads()

* Add Misc/NEWS.
(cherry picked from commit 1eb6c0074d)
2017-06-13 17:52:29 +02:00
Nick Coghlan a51f12f154 [2.7] bpo-29514: Check magic number for bugfix releases
Add a test to check the current MAGIC_NUMBER against the
expected number for the release if the current release is
at candidate or final level. On test failure, describe to
the developer the procedure for changing the magic number.

This ensures that pre-merge CI will automatically pick up
on magic number changes in maintenance releases (and
explain why those are problematic), rather than relying on
all core developers to be aware of the implications of
such changes.
2017-06-13 20:58:48 +10:00
Serhiy Storchaka 0cc43df05e [2.7] bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (GH-2034) (#2123)
The traceback no longer displayed for SystemExit raised in a callback registered by atexit..
(cherry picked from commit 3fd54d4a7e)
2017-06-12 09:10:53 +03:00
Zachary Ware 5fe8ac69f9 [2.7] bpo-27425: Be more explicit in .gitattributes (GH-840) (GH-2086)
Also updates checked-in line endings in several files.
2017-06-11 14:19:39 -05:00
Victor Stinner e5bdad2201 bpo-30418: Popen.communicate() always ignore EINVAL (#2002) (#2006)
On Windows, subprocess.Popen.communicate() now also ignore EINVAL
on stdin.write() if the child process is still running but closed the
pipe.
(cherry picked from commit d52aa31378)
2017-06-08 18:34:30 +02:00
Alex Gaynor e14af32cc6 Simplify code in warnings modules (#1957)
Metaprogramming a list of attributes was excessive, and made the code less readable and slower.

Backport of 5de3a64179
2017-06-05 09:13:50 -04:00
Zachary Ware 87edc5e5e0 Skip UNC tests on AppVeyor in case of ENOENT (GH-1950) 2017-06-04 17:45:02 -05:00
Xiang Zhang 3ef3bcbe38 bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses (#1904) (#1676) 2017-06-01 22:22:18 +08:00
Mariatta 1626a479e2 [2.7] bpo-29960 _random.Random corrupted on exception in setstate(). … (#1289)
(cherry picked from commit 9616a82e78)
2017-05-27 07:19:55 -07:00
Serhiy Storchaka 96f5020597 [2.7] bpo-30310: tkFont now supports unicode options (e.g. font family). (#1567) 2017-05-26 08:15:51 +03:00
Antoine Pitrou bdd964710d [2.7] bpo-30414: multiprocessing.Queue._feed do not break from main loop on exc (GH-1683) (#1817)
* bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc

Queue background running thread was not handling exceptions correctly.
Any exception occurred inside thread (putting unpickable object) cause
feeder to finish running. After that every message put into queue is
silently ignored.

* bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc

Queue background running thread was not handling exceptions correctly.
Any exception occurred inside thread (putting unpickable object) cause
feeder to finish running. After that every message put into queue is
silently ignored..
(cherry picked from commit bc50f03db4)
2017-05-25 17:53:04 +02:00
Stéphane Wirtel 779e7c933e bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700) (#1788) 2017-05-25 02:24:27 +08:00
Vijay Kumar f31f225468 Fix spelling mistakes in tkinter.py (#1754)
Ran the docstrings through spell checker, and fixed spelling issues.
2017-05-23 09:16:27 +03:00
Xiang Zhang 6e1b832a6c bpo-30003: Fix handling escape characters in HZ codec (#1720) (#1556) 2017-05-23 01:04:27 +08:00
Serhiy Storchaka 2b67c7aae7 [2.7] bpo-30415: Add new tests for the fnmatch module. (GH-1684). (#1696)
(cherry picked from commit 817554715b)
2017-05-21 10:37:43 +03:00
Sean McCully cef8b1741c bpo-30409: locale.getpreferredencoding doesn't return result (#1672) 2017-05-20 18:44:02 -07:00
Serhiy Storchaka e6a0b59829 [2.7] bpo-27945: Fixed various segfaults with dict. (GH-1657) (#1681)
Based on patches by Duane Griffin and Tim Mitchell.
(cherry picked from commit 753bca3934)
2017-05-20 20:05:27 +03:00
Serhiy Storchaka e9f9b04278 [2.7] bpo-25794: Fix `type.__setattr__()` for non-interned or unicode attribute names. (GH-1652) (#1675)
Based on patch by Eryk Sun.
(cherry picked from commit d896985bb2)
2017-05-20 10:04:53 +03:00
Marc Schlaich c47c315812 bpo-26434: Fix multiprocessing grandchilds in a Windows service (GH-1167)
Patch by Davin with help from Marc.
2017-05-18 19:40:16 -05:00
Serhiy Storchaka dfcfc91578 [2.7] bpo-30375: Correct the stacklevel of regex compiling warnings. (#1595) (#1648)
Warnings emitted when compile a regular expression now always point
to the line in the user code.  Previously they could point into inners
of the re module if emitted from inside of groups or conditionals.

(cherry picked from commit c7ac7280c3)
2017-05-18 13:46:17 +03:00
Serhiy Storchaka 955b6760cf [2.7] bpo-30363: Backport warnings in the re module. (#1577)
Running Python with the -3 option now warns about regular expression
syntax that is invalid or has different semantic in Python 3
or will change the behavior in future Python versions.
2017-05-18 12:34:40 +03:00
Serhiy Storchaka 09b52471f3 bpo-30365: Backport warnings and fix bugs in ElementTree. (#1581)
Running Python with the -3 option now emits deprecation warnings for
getchildren() and getiterator() methods of the Element class in the
xml.etree.cElementTree module and when pass the html argument to
xml.etree.ElementTree.XMLParser().

Fixed a deprecation warning about the doctype() method of the
xml.etree.ElementTree.XMLParser class.  Now it is emitted only when
define the doctype() method in the subclass of XMLParser.

Fixed a bug in the test_bug_200708_close test method.  An EchoTarget
instance was incorrectly passed to XMLParser() as the html argument and
silently ignored.

Tests no longer failed when use the -m option for running only selected
test methods. Checking warnings now is more specific, warnings are
expected only when use deprecated features.
2017-05-17 10:08:11 +03:00
Victor Stinner 800e4b7ad6 bpo-30329: Catch Windows error 10022 on shutdown() (#1538) (#1624)
Catch the Windows socket WSAEINVAL error (code 10022) in imaplib
on shutdown(SHUT_RDWR): An invalid operation was attempted

This error occurs sometimes on SSL connections.
(cherry picked from commit 83a2c28798)
2017-05-16 17:38:30 -07:00
grzgrzgrz3 6924ed55c9 bpo-30357 each test in test_thread waits until all spawned threads finish (#1583)
* bpo-30357 each test in test_thread waits until all spawn threads finish

* bpo-30357 each test in test_thread waits until all spawn threads finish

* bpo-30357: test_thread now uses threading_cleanup() (#1592)

test_thread: setUp() now uses support.threading_setup() and
support.threading_cleanup() to wait until threads complete to avoid
random side effects on following tests.

Co-Authored-By: Victor Stinner <victor.stinner@gmail.com>

* bpo-30357: test_thread now uses threading_cleanup() (#1592)

test_thread: setUp() now uses support.threading_setup() and
support.threading_cleanup() to wait until threads complete to avoid
random side effects on following tests.

Co-Authored-By: Victor Stinner <victor.stinner@gmail.com>
2017-05-15 21:01:07 +02:00
Victor Stinner 9d1983be50 bpo-11790: Fix sporadic failures in test_multiprocessing.WithProcessesTestCondition. (#1591)
(cherry picked from commit f25a8de845)
2017-05-15 17:32:14 +02:00
Serhiy Storchaka eb66897e87 [2.7] bpo-30366: Backport tests for test.support. (#1582)
Also backport new functions temp_dir() and python_is_optimized().
temp_cwd() now accepts None as a name (means using tempfile.mkdtemp).
check_syntax_error() now accepts arguments lineno and offset.
Use more specific error messages in get_attribute().
2017-05-15 11:59:35 +03:00
Victor Stinner 94a3694c3d bpo-6393: Fix locale.getprerredencoding() on macOS (#1555)
Fix for bpo-6393: Python crashes on OSX when $LANG is set to some (but
not all) invalid values due to an invalid result from nl_langinfo

(cherry picked from commit 6d77e07196)
2017-05-12 11:51:38 +02:00
Victor Stinner f2e894cfd9 bpo-30342: Fix sysconfig.is_python_build() on VS9.0 (#1544)
Fix sysconfig.is_python_build() if Python is built with Visual Studio
2008 (VS 9.0).
2017-05-12 11:31:08 +02:00
Victor Stinner a5bb62436e [2.7] bpo-30283: regrtest: backport test_slow_interrupted() and test_coverage() (#1541)
* bpo-30283: regrtest: backport test_coverage()

* Add --coverage option, the option was already described in the doc
* When coverage is used, regrtest now pass all options to runtest()
  and calls also accumulate_result() (as done when coverage is not
  used).
* bpo-25260: Fix coverage on Windows: remove the list of ignored
  directories.

* bpo-30283: regrtest: backport test_slow_interrupted()

* Fix regrtest to report interrupted tests as omitted rather than
  failed.
* bpo-25260: Fix coverage on Windows: remove the list of ignored
  directories.

* bpo-30283: Fix test_regrtest on Visual Studio 2008

Skip Tools\buildbot\test.bat and PCbuild\rt.bat if Python was not
compiled in PCbuild (but compiled in PC\VS9.0\ for example).
2017-05-11 11:30:23 +02:00
Victor Stinner 3837d9797c bpo-15526: test_startfile changes the cwd (#1537)
Try to fix test_startfile's inability to clean up after itself in
time. Patch by Jeremy Kloth.

Fix the following support.rmtree() error while trying to remove the
temporary working directory used by Python tests:

WindowsError: [Error 32] The process cannot access the file because
it is being used by another process: ...

Original commit: 8a53dbeb7a
2017-05-11 01:23:19 +02:00
Victor Stinner 453a685702 bpo-30283: Backport regrtest features from master to 2.7 (#1516)
* regrtest: add --slowest alias to --slow

* make buildbottest: add --slowest option

* regrtest: add "- " prefix to --slowest output

* regrtest: Fix an outdated comment

* regrtest: replace PermissionError

Replace PermissionError with OSError and check on exc.errno.
PermissionError was added to Python 3.3.

* regrtest: add -3 -tt options to run Python scripts

* regrtest: backport --list-tests option

* regrtest: backport "Tests result: xxx" summary

* regrtest: backport total duration

* regrtest: add timestamp to the progress

* regrtest: describe previous test state

* Add the state of the test: passed, failed, etc.
* If a test took longer than 30 seconds, log its execution time

* regrtest: -jN logs running workers

* regrtest: mention if tests are run in parallel

* regrtest: parallel mode is more verbose during wait

Display running tests every 30 seconds if no test completed in the
meanwhile.

* test_regrtest: fix typo in SubprocessRun
2017-05-09 17:06:34 +02:00
Victor Stinner d2aff60719 [2.7] bpo-30283: Backport test_regrtest from master to 2.7 (#1513)
* bpo-30283: regrtest: add --testdir option

* bpo-30283: Backport _testcapi.raise_signal()

Function used by test_regrtest to simulate an interrupted unit test.

* bpo-30283: Backport test_regrtest from master
2017-05-09 13:57:20 +02:00
Victor Stinner c8a77d3394 Fix SyntaxWarning on importing test_inspect (#1512)
Fix the following warning when test_inspect.py is compiled to
test_inspect.pyc:

test_inspect.py:505: SyntaxWarning: tuple parameter unpacking has been removed in 3.x
  def spam_deref(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h):

Replace also test.test_support import with test.support.
2017-05-09 11:53:16 +02:00
Xiang Zhang 4e7457b853 bpo-29990: Fix range checking in GB18030 decoder (#1509) 2017-05-09 12:18:56 +08:00
Victor Stinner 228da42961 bpo-30258: Fix handling of child error in regrtest (#1477)
Don't stop the worker thread if a child failed.
2017-05-05 10:28:35 +02:00
Victor Stinner 03b278895f bpo-30265: support.unlink() don't catch any OSError (#1456)
support.unlink() now only ignores ENOENT and ENOTDIR, instead of
ignoring any OSError exception.
2017-05-05 10:27:34 +02:00
Victor Stinner d81f9e24ea bpo-30264: ExpatParser now closes the source (#1476)
ExpatParser.parse() of xml.sax.xmlreader now closes the source: close
the file object or the urllib object if source is a string (not an
open file-like object).

Add test_parse_close_source() unit test.
2017-05-05 10:11:55 +02:00
Victor Stinner fd6094cdeb Relax test timing (bpo-29861) to avoid sporadic failures (#1120) (#1472)
(cherry picked from commit 685cdb9acc)
2017-05-05 09:47:11 +02:00
Benjamin Peterson ef4c6ba169 Revert "Issue #29094: Offsets in a ZIP file created with extern file object and modes" (#1467)
This reverts commit 0f4ed2cdc6 (though, the tests are retained) and the followup 58ab4b57da.

See discussion on bpo-29094.
2017-05-04 23:54:43 -07:00
Victor Stinner e81e355a8e bpo-30108: Fix test_site setUpModule() (#1460)
Oops, I forgot that PermissionError was introduced in Python 3.3!
Replace PermissionError with OSError and check on errno.
2017-05-04 18:52:26 +02:00
Victor Stinner 78064387e5 bpo-30108: Restore sys.path in test_site (#1197) (#1459)
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-04 18:21:52 +02:00
Victor Stinner 9fb061ba9c Fix test_ftplib warning if IPv6 is not available (#1457)
DummyFTPServer now calls del_channel() on bind() error to prevent the
following warning in TestIPv6Environment.setUpClass():

Warning -- asyncore.socket_map was modified by test_ftplib
  Before: {}
  After:  {3: <test.test_ftplib.DummyFTPServer 127.0.0.1:0 at ...>}
2017-05-04 18:10:30 +02:00
Victor Stinner 0f7f676606 test_distutils: test_build_ext uses EnvironGuard (#1458)
Use EnvironGuard on BuildExtTestCase to save/restore os.environ, to fix the
following warning:

Warning -- os.environ was modified by test_distutils

MSVCCompiler.initialize() of distutils.msvc9compiler modifies
os.environ.
2017-05-04 18:10:09 +02:00
Serhiy Storchaka 74f0db885f [2.7] bpo-30236: Backported regrtest options -m and -G. (#1394) 2017-05-04 00:23:50 +03:00
Victor Stinner c991eb280e bpo-30258: regrtest handles child process crash (#1431)
Backport the CHILD_ERROR status from master: a test is considered as
failed if a worker process running a test exited with a code
different than zero.

Change also the output: write stdout and stderr of the child process
after the test name, instead of writing it before.

accumulate_result(): don't use time of CHILD_ERROR or INTERRUPTED
results.
2017-05-03 17:28:28 +02:00
Victor Stinner 15f8d0d360 test_distutils: use EnvironGuard (#1433)
Use EnvironGuard on InstallTestCase and UtilTestCase.

Backport fixes from master to prevent the following warning:

Warning -- os.environ was modified by test_distutils
2017-05-03 17:28:10 +02:00
Victor Stinner 0d493795c8 regrtest: always show before/after of modified env (#1407) (#1409)
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)
(cherry picked from commit 2298235023)
2017-05-03 03:47:44 +02:00
Victor Stinner d1c862ffa7 bpo-30199: test_ssl closes all asyncore channels (#1381) (#1408)
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-03 03:47:34 +02:00
Victor Stinner 8105dd7f75 bpo-30223: Add global in regrtest main_in_temp_cwd (#1399) 2017-05-02 23:43:25 +02:00
Serhiy Storchaka 8e158b2316 [2.7] bpo-30223: Fix test_xpickle for Python 2.4. (#1395) 2017-05-02 21:56:52 +03:00
Serhiy Storchaka 43566aee12 [2.7] bpo-30223: Add Lib/test/__main__.py. (#1373)
To unify running tests in Python 2.7 and Python 3, the test
package can be run as a script.  This is equivalent to running the
test.regrtest module as a script.
2017-05-02 18:26:25 +03:00
Serhiy Storchaka a694e092f6 bpo-30207: Rename test.test_support to test.support. (#1353)
To simplify backports from Python 3, the test.test_support module
was converted into a package and renamed to test.support.  The
test.script_helper module was moved into the test.support package.
Names test.test_support and test.script_helper are left as aliases to
test.support and test.support.script_helper.
2017-04-30 11:36:58 +03:00
Serhiy Storchaka 941ea53b57 [2.7] bpo-30197: Enhance swap_attr() and backport swap_item() in test.test_support. (#1341) (#1347)
(cherry picked from commit d1a1def7bf)
2017-04-28 20:06:30 +03:00
Serhiy Storchaka 2a1bf0633c [2.7] [3.5] bpo-30070: Fixed leaks and crashes in errors handling in the parser module. (GH-1131). (GH-1185) (#1189)
(cherry picked from commit a79f4c2195).
(cherry picked from commit 952a05e4e2)
2017-04-20 00:48:57 +03:00
Serhiy Storchaka 64aa4df850 [2.7] bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (GH-1096) (GH-1180) (#1183)
raised an error.

(cherry picked from commit bf623ae884)
(cherry picked from commit 680fea4)
2017-04-19 22:34:58 +03:00
Serhiy Storchaka 50f948edda bpo-30011: Fixed race condition in HTMLParser.unescape(). (#1140) 2017-04-15 18:35:46 +03:00
Xiang Zhang 5fbdfc36f3 bpo-30068: add missing iter(self) in _io._IOBase.readlines when hint is present (#1152) 2017-04-15 13:18:22 +08:00
Serhiy Storchaka 65c5b096ac bpo-30027: Fix Py3k warnings in test_xml_etree. (#1065) 2017-04-12 16:00:14 +03:00
Victor Stinner 23d6eb656e bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS. (#462) (#973)
* bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS

Skip some tests of select.poll when running on macOS due to unresolved
issues with the underlying system poll function on some macOS versions.

(cherry picked from commit de04644627)
2017-04-03 18:11:22 +02:00
Ivan Mokeev d64146c4b7 Fix socket leaks (#351)
* Fix socket leaks

* Fixed sockets leak
2017-04-03 13:06:34 +02:00
Serhiy Storchaka 9c2c42c221 bpo-27863: Fixed multiple crashes in ElementTree. (#765) (#903) (#963)
(cherry picked from commit 576def096e)

(cherry picked from commit a6b4e19022)
2017-04-02 20:37:03 +03:00
Serhiy Storchaka 68903b656d bpo-15083: Convert ElementTree doctests to unittests. (#906) 2017-04-02 16:55:43 +03:00
T. Wouters d694a06206 bpo-29942: Fix the use of recursion in itertools.chain.from_iterable. (#913)
Fix the use of recursion in itertools.chain.from_iterable. Using recursion
is unnecessary, and can easily cause stack overflows, especially when
building in low optimization modes or with Py_DEBUG enabled.
(cherry picked from commit 5466d4af5f)
2017-03-30 12:49:22 -07:00
Antoine Pitrou 5084ff7ddf bpo-29861: release references to multiprocessing Pool tasks (#743) (#803)
* bpo-29861: release references to multiprocessing Pool tasks (#743)

* bpo-29861: release references to multiprocessing Pool tasks

Release references to tasks, their arguments and their results as soon
as they are finished, instead of keeping them alive until another task
arrives.

* Comments in test

(cherry picked from commit 8988945cdc)

* Fix Misc/NEWS ?
2017-03-24 16:03:46 +01:00
Xiang Zhang dae5482c9c fix function name in tabnanny documentation (GH-764) 2017-03-22 15:22:44 +08:00
Xiang Zhang c9ba186222 bpo-26867: Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. (GH-374) 2017-03-01 15:36:15 +08:00
Xiang Zhang b4f0e980b6 bpo-28598: Support __rmod__ for RHS subclasses of str in % string formatting operations (GH-366) 2017-03-01 14:28:14 +08:00
INADA Naoki 02eb4b0bd4 bpo-29110: Fix file object leak in aifc.open (GH-356) 2017-02-28 20:39:30 +09:00
Mark Dickinson c0b336e0ad bpo-29602: fix signed zero handling in complex constructor (#204)
* bpo-29602: fix signed zero handling in complex constructor

* Add missing have_getformat definition; remove use of unittest subtests.
2017-02-20 21:14:52 +00:00
Victor Stinner 8420cd2905 Backport test_gdb fixes for s390x buildbots 2017-02-10 14:14:04 +01:00
Mark Dickinson ea82972ec8 Issue #14376: sys.exit now accepts longs as well as ints. Thanks Gareth Rees. 2017-02-02 19:31:53 +00:00
Serhiy Storchaka 3b23004112 Issue #29354: Fixed inspect.getargs() for parameters which are cell
variables.
2017-02-01 22:53:03 +02:00
Gregory P. Smith f0739cbfe7 Issue #29335: Fix subprocess.Popen.wait() when the child process has
exited to a stopped instead of terminated state (ex: when under ptrace).
2017-01-22 22:38:28 -08:00
Martin Panter 1b31d284e1 Issue #29274: tests cases → test cases 2017-01-18 12:14:29 +00:00
Benjamin Peterson 9ce1564cd9 revert dd13098a5dc2 (#29006, #10513) 2017-01-16 00:07:27 -08:00
Serhiy Storchaka 7a7e04e42c Issue #29219: Fixed infinite recursion in the repr of uninitialized
ctypes.CDLL instances.
2017-01-13 09:37:56 +02:00
Serhiy Storchaka 99ba17f553 Issue #29082: Fixed loading libraries in ctypes by unicode names on Windows.
Original patch by Chi Hsuan Yen.
2017-01-12 17:00:32 +02:00
Benjamin Peterson c8a752eaff merge heads 2017-01-11 23:40:23 -08:00
Benjamin Peterson 0897a557f4 revert 030e100f048a (#29006, #10513) 2017-01-11 23:39:58 -08:00
Xiang Zhang 98b1c82675 Issue #29142: Fix suffixes in no_proxy handling in urllib.
In urllib, suffixes in no_proxy environment variable with
leading dots could match related hostnames again (e.g. .b.c matches a.b.c).
Patch by Milan Oberkirch.
2017-01-09 11:43:24 +08:00
Raymond Hettinger 9b7ae96b98 Issue #29023: Clarify that ints and longs are always deterministic seeds for random. 2017-01-06 16:13:37 -08:00
Xavier de Gaye 9220111fc5 test_curses - substitute self.skip() with self.skipTest() 2017-01-06 09:44:36 +01:00
Benjamin Peterson ea02cdc7ec ring in 2017 for Python 2017-01-01 22:04:13 -06:00
Serhiy Storchaka 0f4ed2cdc6 Issue #29094: Offsets in a ZIP file created with extern file object and modes
"w" now are relative to the start of the file.
2017-01-01 19:04:09 +02:00
Berker Peksag c644d53acf Issue #29123: Make CheckSqlTimestamp more robust 2017-01-01 02:51:46 +03:00
Serhiy Storchaka 4d42af136b Issue #13051: Fixed recursion errors in large or resized curses.textpad.Textbox.
Based on patch by Tycho Andersen.
2016-12-28 10:16:06 +02:00
Serhiy Storchaka f77fe6b5a6 Issue #9770: curses.ascii predicates now work correctly with negative integers. 2016-12-28 10:04:27 +02:00
Serhiy Storchaka e96095b43f Fixed running MiscTests in test_xml_etree_c. 2016-12-28 09:27:56 +02:00
Serhiy Storchaka 1451874e6b Backed out changeset 78bf34b6a713 2016-12-28 09:23:17 +02:00
Antoine Pitrou f939b3c0f7 Issue #28427: old keys should not remove new values from
WeakValueDictionary when collecting from another thread.
2016-12-27 15:08:27 +01:00
Serhiy Storchaka 994f04dbf5 Issue #28998: More APIs now support longs as well as ints. 2016-12-27 15:09:36 +02:00
Martin Panter 500794dc01 Issue #28815: Skip TIPC tests if /proc/modules is not readable
Based on patch by Patrila.
2016-12-24 10:41:37 +00:00
Terry Jan Reedy 536e7a2174 Issue 28923: Remove editor artifacts from Tix.py,
including encoding not recognized by codecs.lookup.
2016-12-21 23:43:50 -05:00
Serhiy Storchaka 85add4783e Issue #28871: Fixed a crash when deallocate deep ElementTree.
Fixed running MiscTests in test_xml_etree_c.
2016-12-21 12:55:28 +02:00
Antoine Pitrou 805f283aa3 Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop()
when a GC collection happens in another thread.

Original patch and report by Armin Rigo.
2016-12-19 11:12:58 +01:00
Martin Panter 88e4206456 Fix spelling in code comments 2016-12-18 05:27:49 +00:00
Serhiy Storchaka 30ad6e2c46 Issue #14061: Misc fixes and cleanups in archiving code in shutil.
Improved the documentation and tests for make_archive().
Improved error handling when corresponding compress module is not available.
External zip executable is now used if the zlib module is not available.
2016-12-16 19:04:17 +02:00
Serhiy Storchaka 6560e22c66 Issue #28925: cPickle now correctly propagates errors when unpickle instances
of old-style classes.
2016-12-15 12:51:34 +02:00
Serhiy Storchaka 7117d35dfc Issue #5322: Restored tests for __new__. 2016-12-14 19:48:38 +02:00
Benjamin Peterson 0644d2629e merge 2.7.13 release branch 2016-12-13 23:32:54 -08:00
Benjamin Peterson 4403d501ac revert a37cc3d926ec (#5322) 2016-12-13 23:30:16 -08:00
Benjamin Peterson 5cc5493c72 remove unused logger from BaseFix 2016-12-05 22:30:26 -08:00
Benjamin Peterson 1426a99d31 simplify cleanup of test_replace_parent_in_sys_modules (closes #28862) 2016-12-03 23:17:04 -08:00
Benjamin Peterson ddb9c07db7 update pydoc topics 2016-12-03 12:36:45 -08:00
Ned Deily 32b3734866 Issue #28440: No longer add /Library/Python/site-packages, the Apple-supplied
system Python site-packages directory, to sys.path for macOS framework builds.
The coupling between the two Python instances often caused confusion and, as
of macOS 10.12, changes to the site-packages layout can cause pip component
installations to fail.  This change reverts the effects introduced in 2.7.0
by Issue #4865.  If you are using a package with both the Apple system Python
2.7 and a user-installed Python 2.7, you will need to ensure that copies of
the package are installed with both Python instances.
2016-12-03 02:14:09 -05:00
Serhiy Storchaka 7653c3806c Try to fix test.test_support.rmtree() on Windows for fixing issue28847 tests. 2016-12-03 07:57:54 +02:00
Benjamin Peterson 1122236c89 increase test_smtplib timeouts 2016-12-01 23:58:38 -08:00
Serhiy Storchaka daf82f7539 Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code.
Original patch by Andreas Stührk.
2016-12-02 08:42:43 +02:00
Serhiy Storchaka 9bd44d6dab Issue #28847: dubmdbm no longer writes the index file in when it is not
changed and supports reading read-only files.
2016-12-02 07:58:42 +02:00
Serhiy Storchaka c30f27d1f2 Issue #11145: Fixed miscellaneous issues with C-style formatting of types
with custom __oct__ and __hex__.
2016-12-01 10:27:11 +02:00
Martin Panter fd08fdc7be Issue #25659: Change assert to TypeError in from_buffer/_copy()
Based on suggestion by Eryk Sun.
2016-11-20 09:35:06 +00:00
Martin Panter 398bc76575 Issue #28666: Fix stat import 2016-11-20 23:06:58 +00:00
Serhiy Storchaka d54d327f1c Issue #28666: Fix removing readonly directories on Windows. 2016-11-20 20:04:54 +02:00
Serhiy Storchaka f0d0306c24 Issue #28666: Now test.test_support.rmtree is able to remove unwritable or
unreadable directories on Windows too.
2016-11-20 17:42:03 +02:00
Serhiy Storchaka b7c057a143 Issue #28666: Now test.support.rmtree is able to remove unwritable or
unreadable directories.
2016-11-20 16:15:35 +02:00
Donald Stufft bd20530e17 Upgrade pip to 9.0.1 and setuptools to 28.8.0 2016-11-15 21:21:35 -05:00
Serhiy Storchaka d3e6c9e4dc Issue #28563: Make plural form selection more lenient and accepting
non-integer numbers.  Django tests depend on this.
2016-11-14 19:25:44 +02:00
Martin Panter 536d93dbd0 Issue #28016: Skip /dev/tty seekable() test on AIX 2016-11-14 03:35:59 +00:00
Serhiy Storchaka 58b6b985a0 Fixed the documentation of parse_constant argument in json.load().
parse_constant doesn't get called on 'null', 'true', 'false' since 3.1/2.7.
2016-11-12 22:47:16 +02:00
Terry Jan Reedy 30b51c9224 Issue #27854: Include idlelib/help.html in 2.7 Windows installer.
Without this file, clicking Help => IDLE Help did nothing.
2016-11-11 12:03:09 -05:00
Serhiy Storchaka 1e4b73fcf7 Issue #19398: Extra slash no longer added to sys.path components in case of
empty compile-time PYTHONPATH components.  This fixes some tests in -S or -I
modes.
2016-11-11 12:11:55 +02:00
Serhiy Storchaka ac33bd7d1d Issue #23839: Various caches now are cleared before running every test file. 2016-11-11 11:42:25 +02:00
Terry Jan Reedy a33deb2d07 Issue #25507: Add back import needed for 2.x encoding warning box.
Add pointer to 'Encoding declaration' in Language Reference.
2016-11-10 18:42:58 -05:00
Serhiy Storchaka a8760275bd Issue #28563: Fixed possible DoS and arbitrary code execution when handle
plural form selections in the gettext module.  The expression parser now
supports exact syntax supported by GNU gettext.
2016-11-08 21:15:55 +02:00
Donald Stufft d01b516e9f pip 9.0 works fine without the ssl module 2016-11-02 16:20:20 -04:00
Donald Stufft c6c0aa4a3b Update pip to 9.0.0 and setuptools to 28.7.1 2016-11-02 16:01:17 -04:00
Serhiy Storchaka 5396257be2 Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar
file with compression before trying to open it without compression.  Otherwise
it had 50% chance failed with ignore_zeros=True.
2016-10-30 20:52:55 +02:00
Martin Panter 5e5af961b8 Issue #26240: Clean up the subprocess module doc string
Patch by Tim Mitchell.
2016-10-26 00:44:31 +00:00
Serhiy Storchaka f8cc2870f1 Issue #28515: Fixed py3k warnings. 2016-10-25 09:51:38 +03:00
Serhiy Storchaka f10006cdb8 Issue #25464: Fixed HList.header_exists() in Tix module by adding
a workaround to Tix library bug.
2016-10-24 23:47:08 +03:00
Serhiy Storchaka 59addd608c Some distutils tests require zlib for creating tar.gz source distribution. 2016-10-23 22:54:43 +03:00
Serhiy Storchaka abcd5d5fbd Issue #28115: ZIP creation test requires zlib. 2016-10-23 22:32:18 +03:00
Serhiy Storchaka ef5c24a72e Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive. 2016-10-23 15:52:01 +03:00
Serhiy Storchaka e2a3c77546 Issue #28115: Added tests for CLI of the zipfile module. 2016-10-23 13:07:48 +03:00
Martin Panter 58bd36b987 Issue #28435: Avoid no_proxy environment variable interfering with tests
Patch by Piotr Szczepaniak.
2016-10-22 03:00:32 +00:00
Berker Peksag 05b84439a3 Issue #21720: Improve exception message when the type of fromlist is unicode 2016-10-17 01:05:04 +03:00
Guido van Rossum 5e2486b159 Issue #24452: Make webbrowser support Chrome on Mac OS X (backport to 2.7) 2016-10-13 13:29:55 -07:00
Martin Panter 829d4fbbf9 Issue #28394: Typo fixes in code comments and changelog
Includes patch by Ville Skyttä.
2016-10-10 01:00:00 +00:00
Serhiy Storchaka 58ab4b57da Issue #26293: Fixed writing ZIP files that starts not from the start of the
file.  Offsets in ZIP file now are relative to the start of the archive in
conforming to the specification.
2016-10-07 23:12:53 +03:00
Benjamin Peterson 46550fffa7 skip test on windows 2016-10-05 22:09:31 -07:00
Benjamin Peterson d7cfae994b fix bug in 48797808a302 2016-10-05 22:00:24 -07:00
Benjamin Peterson 38297d7de6 skip test if resizing is not supported 2016-10-05 22:00:05 -07:00
Benjamin Peterson 1df2cbed76 mmap: do all internal arithmetic with Py_ssize_t while being very careful about overflow 2016-10-05 21:45:48 -07:00
Serhiy Storchaka ab8b75a56e Issue #28350: String constants with null character no longer interned. 2016-10-04 18:17:08 +03:00
Serhiy Storchaka 317d350f9c Moved Unicode C API related tests to separate test class. 2016-10-02 21:16:28 +03:00
Serhiy Storchaka b8a1a2707b Issue #27358: Backported tests. 2016-10-02 11:10:18 +03:00
Serhiy Storchaka 78b634d226 Issue #28257: Backported a test. 2016-10-02 10:36:33 +03:00
Serhiy Storchaka 67edf73183 Issue #27942: String constants now interned recursively in tuples and frozensets. 2016-09-30 10:38:08 +03:00
Terry Jan Reedy 8d7fa40cb3 Issue #25488: Stpp idle.py from adding a entry when it is a duplicate.
Also, make idlelib.idle.main() work after import idlelib.idle.
2016-09-30 02:53:33 -04:00
Benjamin Peterson 846466d2a6 build_ext: correctly parse the link_objects user option (closes #1703178)
Patch by Valerie Lambert.
2016-09-28 23:13:58 -07:00
Martin Panter 32d74e1d73 Remove disabled ctypes test
The test was commented out in 2005 before ctypes was added to Python, because
the “cdll” attribute loading feature “will no longer work this way”:
http://svn.python.org/view?view=revision&revision=49102
2016-09-29 02:50:20 +00:00
Terry Jan Reedy ad7a9eab0e IDLE NEWS item and ack. 2016-09-28 21:55:33 -04:00
Alexander Belopolsky 8cab419624 Issue #28253: Fixed calendar functions for extreme months: 0001-01 and 9999-12.
Methods itermonthdays() and itermonthdays2() are reimplemented so that they
don't call itermonthdates() which can cause datetime.date under/overflow.
2016-09-27 22:45:20 -04:00
Serhiy Storchaka c8120092dd Issue #27897: Backported tests. 2016-09-27 00:27:15 +03:00
Serhiy Storchaka 2b91fadc7f Issue #27611: Fixed support of default root window in the Tix module. 2016-09-25 16:44:32 +03:00
Martin Panter 0259c66368 Issue #28221: Remove unused assignment from test_asyncore_server()
The later value of FOO is fine. The test just needs to verify that the server
converted it to lowercase.
2016-09-23 23:45:56 +00:00
Christian Heimes cae643022f merge 2016-09-22 16:54:06 +02:00
Christian Heimes e56fb8f62f Add Lib/test/ssltests.py for faster testing of OpenSSL 2016-09-22 16:53:15 +02:00
Steve Dower 1de99f7afa Issue #26513: Use winver.product_type instead of .product 2016-09-21 09:10:21 -07:00
Steve Dower db01b3e069 Issue #27932: Prevent memory leak in win32_ver(). 2016-09-17 16:43:01 -07:00
Martin Panter 75b2c5f82d Issue #24363: Continue parsing HTTP header in spite of invalid lines 2016-09-16 02:54:11 +00:00
Serhiy Storchaka 12c8855d09 Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). 2016-09-14 16:36:15 +03:00
Terry Jan Reedy 87bcc1d646 Issue #15308: Add 'interrupt execution' (^C) to Shell menu.
Patch by Roger Serwy, updated by Bayard Randel.
2016-09-12 01:49:55 -04:00
Martin Panter 8f7d36ba9a Issue #27952: Get fixcid.py working with the re module 2016-09-11 09:48:57 +00:00
Serhiy Storchaka 0b5f22d371 Backported tests for issue #28070. 2016-09-11 01:39:51 +03:00
Terry Jan Reedy 8b7aff8135 IDLE newx items. 2016-09-10 16:24:31 -04:00
Martin Panter fcc8a0f0f5 Correct spelling in documentation and code comments 2016-09-10 10:38:28 +00:00
Martin Panter ad6a99c011 Correct print() calls to print a blank line in various test cases 2016-09-10 10:38:22 +00:00
Serhiy Storchaka 7f8ce85947 Issue #28019: Backported additional tests for itertools.count(). 2016-09-10 09:53:29 +03:00
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) 13b56efa81 remove fix_callable, callable() was readded long ago in 3.x. 2016-09-09 18:33:32 -07:00
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) 88c00132cc Issue #25969: Update the lib2to3 grammar to handle the unpacking
generalizations added in 3.5.
2016-09-09 18:32:52 -07:00