Commit Graph

103067 Commits

Author SHA1 Message Date
Miss Islington (bot) 5f5b187bfa
bpo-36734: Fix compilation of faulthandler.c on HP-UX (GH-12970)
Initialize "stack_t current_stack" to zero using memset().
(cherry picked from commit b84cb70880)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-04-30 14:30:44 -07:00
Miss Islington (bot) 4d723e76e1
bpo-36742: Fixes handling of pre-normalization characters in urlsplit() (GH-13017)
(cherry picked from commit d537ab0ff9)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-04-30 05:21:02 -07:00
Miss Islington (bot) 4b5340bb63
closes bpo-35329: Change 'Package' to 'package' in accordance with PEP8. (GH-13008)
(cherry picked from commit ee0309f3d8)

Co-authored-by: Utkarsh Gupta <guptautkarsh2102@gmail.com>
2019-04-29 19:26:00 -07:00
Miss Islington (bot) 52a5b71063
bpo-34602: Avoid failures setting macOS stack resource limit (GH-13011)
Under some conditions the earlier fix for bpo-18075, "Infinite recursion
tests triggering a segfault on Mac OS X", now causes failures on macOS
when attempting to change stack limit with resource.setrlimit
resource.RLIMIT_STACK, like regrtest does when running the test suite.
The reverted change had specified a non-default stack size when linking
the python executable on macOS.  As of macOS 10.14.4, the previous
code causes a hard failure when running tests, although similar
failures had been seen under some conditions under some earlier
systems.  For now, revert the original change and resume using
the default stack size when linking the interpreter.
(cherry picked from commit 883dfc668f)

Co-authored-by: Ned Deily <nad@python.org>
2019-04-29 12:27:36 -07:00
Victor Stinner 5e09a9973b
bpo-35952: Sync test.pythoninfo from master (GH-13009) 2019-04-29 15:20:27 +02:00
Miss Islington (bot) 896c6357f3
bpo-36745: Fix a possible reference leak in PyObject_SetAttr() (GH-12993)
https://bugs.python.org/issue36745
(cherry picked from commit e0dcb85b7d)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-04-28 06:17:40 -07:00
Miss Islington (bot) f5972cc0c9 bpo-2091: Fix typo in exception message (GH-12987)
(cherry picked from commit 21a9ba1992)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2019-04-27 23:39:06 +03:00
Miss Islington (bot) 5d90954856
Syntax highlight IDLE html doc code example. (GH-12981)
The new markup is currently ignored by IDLE's tk doc display.
(cherry picked from commit 55d035113d)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-04-26 20:42:05 -07:00
Ivan Levkivskyi d111490a1f
[3.7] bpo-36679: Rename duplicate test_class_getitem function (GH-12892) (GH-12978)
(cherry picked from commit d437012cdd)

Co-authored-by: Windson yang <wiwindson@outlook.com>
2019-04-26 18:21:45 -07:00
Miss Islington (bot) 967f14ec2a
bpo-31525: Increase minimum sqlite version number check (GH-12923)
(cherry picked from commit ad0daf5b37)

Co-authored-by: Charles Pigott <charlespigott@googlemail.com>
2019-04-26 09:15:31 -07:00
Victor Stinner 1069d38fa1
[3.7] bpo-36719: sync regrtest with master branch (GH-12967)
* Clean up code which checked presence of os.{stat,lstat,chmod} (GH-11643)

(cherry picked from commit 8377cd4fcd)

* bpo-36725: regrtest: add TestResult type (GH-12960)

* Add TestResult and MultiprocessResult types to ensure that results
  always have the same fields.
* runtest() now handles KeyboardInterrupt
* accumulate_result() and format_test_result() now takes a TestResult
* cleanup_test_droppings() is now called by runtest() and mark the
  test as ENV_CHANGED if the test leaks support.TESTFN file.
* runtest() now includes code "around" the test in the test timing
* Add print_warning() in test.libregrtest.utils to standardize how
  libregrtest logs warnings to ease parsing the test output.
* support.unload() is now called with abstest rather than test_name
* Rename 'test' variable/parameter to 'test_name'
* dash_R(): remove unused the_module parameter
* Remove unused imports

(cherry picked from commit 4d29983185)

* bpo-36725: Refactor regrtest multiprocessing code (GH-12961)

Rewrite run_tests_multiprocess() function as a new MultiprocessRunner
class with multiple methods to better report errors and stop
immediately when needed.

Changes:

* Worker processes are now killed immediately if tests are
  interrupted or if a test does crash (CHILD_ERROR): worker
  processes are killed.
* Rewrite how errors in a worker thread are reported to
  the main thread. No longer ignore BaseException or parsing errors
  silently.
* Remove 'finished' variable: use worker.is_alive() instead
* Always compute omitted tests. Add Regrtest.get_executed() method.

(cherry picked from commit 3cde440f20)

* bpo-36719: regrtest always detect uncollectable objects (GH-12951)

regrtest now always detects uncollectable objects. Previously, the
check was only enabled by --findleaks. The check now also works with
-jN/--multiprocess N.

--findleaks becomes a deprecated alias to --fail-env-changed.

(cherry picked from commit 75120d2205)

* bpo-34060: Report system load when running test suite for Windows (GH-8357)

While Windows exposes the system processor queue length, the raw value
used for load calculations on Unix systems, it does not provide an API
to access the averaged value. Hence to calculate the load we must track
and average it ourselves. We can't use multiprocessing or a thread to
read it in the background while the tests run since using those would
conflict with test_multiprocessing and test_xxsubprocess.

Thus, we use Window's asynchronous IO API to run the tracker in the
background with it sampling at the correct rate. When we wish to access
the load we check to see if there's new data on the stream, if there is,
we update our load values.


(cherry picked from commit e16467af0b)

* bpo-36719: Fix regrtest re-run (GH-12964)

Properly handle a test which fail but then pass.

Add test_rerun_success() unit test.

(cherry picked from commit 837acc1957)

* bpo-36719: regrtest closes explicitly WindowsLoadTracker (GH-12965)

Regrtest.finalize() now closes explicitly the WindowsLoadTracker
instance.

(cherry picked from commit 00db7c73af)
2019-04-26 12:16:30 +02:00
Miss Islington (bot) 3076a3e0d1 bpo-28552: Fix distutils.sysconfig for empty sys.executable (GH-12875) (GH-12948)
bpo-28552, bpo-7774: Fix distutils.sysconfig if sys.executable is
None or an empty string: use os.getcwd() to initialize project_base.

Fix also the distutils build command: don't use sys.executable if
it's evaluated as false (None or empty string).
(cherry picked from commit 0ef8c157e9)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-04-25 13:15:47 +02:00
Miss Islington (bot) 4d0233ec65 bpo-30840: Document relative imports (GH-12831) (GH-12938)
* Document relative imports
(cherry picked from commit 70bf713617)

Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
2019-04-25 01:44:19 +10:00
Miss Islington (bot) e1a6cf2824
bpo-36454: Fix test_time.test_monotonic() (GH-12929)
Change test_time.test_monotonic() to test only the lower bound of elapsed time
after a sleep command rather than the upper bound. This prevents unnecessary
test failures on slow buildbots. Patch by Victor Stinner.
(cherry picked from commit d246a6766b)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-04-23 15:35:55 -07:00
Miss Islington (bot) e64d21b187
replace 'sequencial argument' by 'positional' in doc (GH-12925)
(cherry picked from commit 29d018aa63)

Co-authored-by: Mathieu Dupuy <deronnax@users.noreply.github.com>
2019-04-23 06:06:57 -07:00
Miss Islington (bot) c0f6f53703
bpo-18372: Add missing PyObject_GC_Track() calls in the pickle module (GH-8505)
(cherry picked from commit 359bd4f61b)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-04-23 05:18:15 -07:00
Victor Stinner 8a9a6b443c
[3.7] bpo-9566: Fix compiler warnings on Windows (GH-12920)
* bpo-9566: Fix compiler warnings in gcmodule.c (GH-11010)

Change PyDTrace_GC_DONE() argument type from int to Py_ssize_t.

(cherry picked from commit edad38e3e0)

* bpo-30465: Fix C downcast warning on Windows in ast.c (#6593)

ast.c: fstring_fix_node_location() downcasts a pointer difference to
a C int. Replace int with Py_ssize_t to fix the compiler warning.

(cherry picked from commit fb7e7992be)

* bpo-9566: Fix compiler warnings in peephole.c (GH-10652)

(cherry picked from commit 028f0ef4f3)

* bpo-27645, sqlite: Fix integer overflow on sleep (#6594)

Use the _PyTime_t type and round away from zero (ROUND_UP,
_PyTime_ROUND_TIMEOUT) the sleep duration, when converting a Python
object to seconds and then to milliseconds. Raise an OverflowError in
case of overflow.

Previously the (int)double conversion rounded towards zero
(ROUND_DOWN).

(cherry picked from commit ca405017d5)
2019-04-23 10:26:11 +02:00
Miss Islington (bot) 9344d74f7b
Fixes platform.win32_ver on non-Windows platforms (GH-12912)
(cherry picked from commit d307d05350)

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2019-04-22 11:59:08 -07:00
Miss Islington (bot) 36aecc0079
bpo-36672: Fix a compiler warning in winreg.SetValue() (GH-12882)
(cherry picked from commit 34366b7f91)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-04-22 10:31:46 -07:00
Miss Islington (bot) 7038deed09
bpo-9194: Fix the bounds checking in winreg.c's fixupMultiSZ() (GH-12687)
(cherry picked from commit 56ed86490c)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-04-22 10:20:33 -07:00
Miss Islington (bot) 5407aaf18b bpo-36690: Fix typo in Tools/demo/rpython.py (GH-12903)
(cherry picked from commit d59b662e49)

Co-authored-by: 周家未 <752736341@qq.com>
2019-04-22 16:53:53 +03:00
Marcin Niemira 1100ae8f3f bpo-36523: Add docstring to io.IOBase.writelines (GH-12683)
(cherry picked from commit ab86521a9d)
2019-04-22 21:08:24 +09:00
Miss Islington (bot) 8c49d71385
Doc: add the missing ".tp_flags" in type definition (GH-12902)
(cherry picked from commit 662ebd2ab2)

Co-authored-by: Wu Wei <weiwu@cacheme.net>
2019-04-22 04:14:25 -07:00
Berker Peksag 15a57a3cad
bpo-23078: Add support for {class,static}method to mock.create_autospec() (GH-11613)
Co-authored-by: Felipe <felipe.nospam.ochoa@gmail.com>

(cherry picked from commit 9b21856b0f)
2019-04-22 06:07:56 +03:00
Miss Islington (bot) 71b88827f6
bpo-36645: Fix ambiguous formatting in re.sub() documentation (GH-12879)
(cherry picked from commit 5ebfa840a1)

Co-authored-by: mollison <mollison@cs.unc.edu>
2019-04-21 15:20:45 -07:00
Miss Islington (bot) 307e7a4264
Fix typo (GH-12878)
"sychronization" -> "synchronization"
(cherry picked from commit 3e986de0d6)

Co-authored-by: Fredrik Averpil <fredrik@averpil.com>
2019-04-20 16:12:23 -07:00
Miss Islington (bot) 8b30ee8435 bpo-36650: Fix handling of empty keyword args in C version of lru_cache. (GH-12881) (GH-12888)
(cherry picked from commit 14adbd4598)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-04-20 07:50:32 -10:00
Miss Islington (bot) d29b3dd922
bpo-36651: Fixed Asyncio Event Loop documentation inconsistency (GH-12866)
GH- [bpo-36651](https://bugs.python.org/issue36651): Fixed Asyncio Event Loop documentation inconsistency

In the documentation for the call_later and the call_at methods there is a note which says that the delay cannot be longer than a day, but both methods have a note saying that this limitation was removed in Python 3.8
Here I fixed this issue by removing the pre-exising note and added a versionchanged.

To test my changes I have rebuilt the documentation with ```make html```. I did not have any errors and the effected page displayed correctly on a browser.

https://bugs.python.org/issue36651
(cherry picked from commit 7e954e7de4)

Co-authored-by: Enrico Alarico Carbognani <enrico.carbognani@gmail.com>
2019-04-18 05:49:24 -07:00
Miss Islington (bot) 21c8caa16a
Fix wrong indentation of a paragraph in documentation (GH-12868)
This paragraph doesn't seem to be a part of code, but merged into previous code block.
(cherry picked from commit 9941f963fe)

Co-authored-by: cocoatomo <cocoatomo77@gmail.com>
2019-04-17 18:00:37 -07:00
Miss Islington (bot) 0d4f16d283
bpo-36649: Remove trailing spaces for registry keys when installed via the Store (GH-12865)
(cherry picked from commit 4c3efd9cd0)

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2019-04-17 14:52:14 -07:00
Victor Stinner 394b991e41
[3.7] bpo-35755: shutil.which() uses os.confstr("CS_PATH") (GH-12862)
* bpo-35755: shutil.which() uses os.confstr("CS_PATH") (GH-12858)

shutil.which() and distutils.spawn.find_executable() now use
os.confstr("CS_PATH") if available instead of os.defpath, if the PATH
environment variable is not set.

Don't use os.confstr("CS_PATH") nor os.defpath if the PATH
environment variable is set to an empty string.

Changes:

* find_executable() now starts by checking for the executable in the
  current working directly case. Add an explicit
  "if not path: return None".
* Add tests for PATH='' (empty string), PATH=':' and for PATHEXT.

(cherry picked from commit 228a3c99bd)

* bpo-35755: Remove current directory from posixpath.defpath (GH-11586)

Document the change in a NEWS entry of the Security category.

(cherry picked from commit 2c4c02f8a8)
2019-04-17 18:38:06 +02:00
Miss Islington (bot) b87a8073db bpo-32849: Fix is_valid_fd() on FreeBSD (GH-12852) (GH-12863)
Fix Python Initialization code on FreeBSD to detect properly when
stdin file descriptor (fd 0) is invalid.

On FreeBSD, fstat() must be used to check if stdin (fd 0) is valid.
dup(0) doesn't fail if stdin is invalid in some cases.
(cherry picked from commit 3092d6b263)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-04-17 18:30:27 +02:00
Miss Islington (bot) a6fce19968 bpo-33783: Use proper class markup for random.Random docs (GH-7817) (GH-12859)
Signed-off-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
(cherry picked from commit 31e8d69bfe)

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
2019-04-16 23:32:32 +02:00
Miss Islington (bot) cd46b09b08 bpo-36508: python-config don't export LINKFORSHARED (GH-12661) (GH-12748)
python-config --ldflags no longer includes flags of the LINKFORSHARED
variable. The LINKFORSHARED variable must only be used to build
executables.
(cherry picked from commit e65f01f78d)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-04-16 15:01:33 +02:00
Victor Stinner 2815bf5b1f
bpo-36348: test_imaplib: add debug info (GH-12846)
Log more info if tests fail.
2019-04-15 18:45:01 +02:00
Miss Islington (bot) 871ba6c848
Doc: update PendingDeprecationWarning explanation (GH-12837)
Keep the nudge towards DeprecationWarning, but remove the
"Note" markup and generally shorten the description.

Ref: https://github.com/python/cpython/pull/12505/filesGH-r273978757
(cherry picked from commit a3283efd30)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2019-04-15 05:48:31 -07:00
Miss Islington (bot) 28ed39e83e bpo-36629: Add support.get_socket_conn_refused_errs() (GH-12834) (GH-12835)
Fix test_imap4_host_default_value() of test_imaplib: catch also
errno.ENETUNREACH error.
(cherry picked from commit 3c7931e514)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-04-15 12:49:37 +02:00
Miss Islington (bot) 9f9e029bd2
bpo-16079: fix duplicate test method name in test_gzip. (GH-12827)
(cherry picked from commit cd466559c4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2019-04-14 10:50:52 -07:00
Pablo Galindo 7723d0545c
[3.7] bpo-36427: Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread (GH-12541) (GH-12820)
Calling these function from a thread when the runtime is finalizing will terminate
the thread, even if the thread was not created by Python. Users can use
_Py_IsFinalizing or sys.is_finalizing to check if the interpreter is in the process of
being finalized before calling this function to avoid unwanted termination.
(cherry picked from commit fde9b33)
2019-04-14 03:49:17 +01:00
Miss Islington (bot) f3a9d722d7
bpo-36593: Fix isinstance check for Mock objects with spec executed under tracing (GH-12790)
In Python having a trace function in effect while mock is imported causes isinstance to be wrong for MagicMocks. This is due to the usage of super() in some class methods, as this sets the __class__ attribute. To avoid this, as a workaround, alias the usage of super .
(cherry picked from commit 830b43d03c)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-04-13 12:31:58 -07:00
Miss Islington (bot) d28aaa7df8
Skip test_preadv_flags if RWF_HIPRI is not supported by the system (GH-12762)
(cherry picked from commit 46544f69bf)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-04-13 09:25:20 -07:00
Miss Islington (bot) be63df287a
Doc: define PY_SSIZE_T_CLEAN always (GH-12794)
(cherry picked from commit c88feceb44)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2019-04-12 18:56:50 -07:00
Victor Stinner 5403006c5c
bpo-36605: make tags: parse Modules/_io directory (GH-12789) (GH-12814)
"make tags" and "make TAGS" now also parse Modules/_io/*.c
and Modules/_io/*.h.

(cherry picked from commit 21a74a9d77)
2019-04-13 02:50:31 +02:00
Miss Islington (bot) b759a2c5b9
bpo-35581: Document @typing.type_check_only (GH-11312)
(cherry picked from commit 1e8295402b)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2019-04-12 15:47:57 -07:00
Miss Islington (bot) 395bb94a7f
bpo-33922: Adding documentation for new "-64" suffix of Python launcher (GH-7849)
Since bpo-30291 it is possible to specify the architecture of Python when using the launcher
(cherry picked from commit 1e2ad6c275)

Co-authored-by: mrh1997 <mrh1997@users.noreply.github.com>
2019-04-12 15:32:33 -07:00
Miss Islington (bot) c05c1165ab
Allow Windows layout builds to fully skip code signing (GH-12808)
(cherry picked from commit 606c66a17f)

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2019-04-12 11:44:00 -07:00
Miss Islington (bot) 7182e653fb
bpo-36611: Fix test_sys.test_getallocatedblocks() (GH-12797)
Fix test_sys.test_getallocatedblocks() when tracemalloc is enabled.
If the name of Python memory allocators cannot get read, consider
that pymalloc is disabled.

Fix the following error:

./python -X tracemalloc -m test test_sys -v -m test_getallocatedblocks

ERROR: test_getallocatedblocks (test.test_sys.SysModuleTest)
------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_sys.py", line 770, in test_getallocatedblocks
    alloc_name = _testcapi.pymem_getallocatorsname()
RuntimeError: cannot get allocators name
(cherry picked from commit 9b8314cfe2)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-04-12 06:33:31 -07:00
Miss Islington (bot) a910c2c6f3
bpo-34839: Add a 'before 3.6' in the section 'warnings' of doctest (GH-9736)
(cherry picked from commit 0522fd81dc)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
2019-04-11 23:27:27 -07:00
Victor Stinner 9e23f0a27c
[3.7] bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770) (GH-12788)
* bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770)

Replace _PyMem_IsFreed() function with _PyMem_IsPtrFreed() inline
function. The function is now way more efficient, it became a simple
comparison on integers, rather than a short loop. It detects also
uninitialized bytes and "forbidden bytes" filled by debug hooks
on memory allocators.

Add unit tests on _PyObject_IsFreed().

(cherry picked from commit 2b00db6855)

* bpo-36389: Change PyMem_SetupDebugHooks() constants (GH-12782)

Modify CLEANBYTE, DEADDYTE and FORBIDDENBYTE constants: use 0xCD,
0xDD and 0xFD, rather than 0xCB, 0xBB and 0xFB, to use the same byte
patterns than Windows CRT debug malloc() and free().

(cherry picked from commit 4c409beb4c)
2019-04-11 22:30:31 +02:00
Inada Naoki ac31da8f37
bpo-36597: fix random doctest failure (GH-12778) 2019-04-11 19:37:53 +09:00