Commit Graph

43584 Commits

Author SHA1 Message Date
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
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) 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
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
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) 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
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) 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
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
Miss Islington (bot) d9b25a2627
bpo-36235: Fix distutils test_customize_compiler() on macOS (GH-12764)
Set CUSTOMIZED_OSX_COMPILER to True to disable
_osx_support.customize_compiler().
(cherry picked from commit a9bd8925c7)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-04-10 16:58:55 -07:00
Miss Islington (bot) 796698adf5
bpo-12910: update and correct quote docstring (GH-2568)
Fixes some mistakes and misleadings in the quote function docstring:
- reserved chars are never actually used by quote code, unreserved chars are
- reserved chars were wrong and incomplete
- mentioned that use-case is not minimal quoting wrt. RFC, but cautious quoting
(cherry picked from commit 750d74fac5)

Co-authored-by: Jörn Hees <joernhees@users.noreply.github.com>
2019-04-09 17:53:03 -07:00
Victor Stinner 86f0354fcb
[3.7] bpo-36560: regrtest: don't collect the GC twice (GH-12747) (GH-12749)
* bpo-36560: Fix reference leak hunting in regrtest (GH-12744)

Fix reference leak hunting in regrtest: compute also deltas (of
reference count, allocated memory blocks, file descriptor count)
during warmup, to ensure that everything is initialized before
starting to hunt reference leaks.

Other changes:

* Replace gc.collect() with support.gc_collect()
* Move calls to read memory statistics from dash_R_cleanup() to
  dash_R()
* Pass regrtest 'ns' to dash_R()
* dash_R() is now more quiet with --quiet option (don't display
  progress).
* Precompute the full range for "for it in range(repcount):" to
  ensure that the iteration doesn't allocate anything new.
* dash_R() now is responsible to call warm_caches().

(cherry picked from commit 5aaac94eeb)

* bpo-36560: regrtest: don't collect the GC twice (GH-12747)

dash_R() function of libregrtest doesn't call support.gc_collect()
directly anymore: it's already called by dash_R_cleanup().

Call dash_R_cleanup() before starting the loop.

(cherry picked from commit bb4447897a)
2019-04-09 18:55:50 +02:00
Miss Islington (bot) 0a16bb15af
closes bpo-35848: Move all documentation regarding the readinto out of IOBase. (GH-11893)
Move all documentation regarding the readinto method into either io.RawIOBase or io.BufferedIOBase.

Corresponding changes to documentation in the _pyio.py module.
(cherry picked from commit 7b97ab35b2)

Co-authored-by: Steve Palmer <steve@srpalmer.me.uk>
2019-04-08 21:57:31 -07:00
Miss Islington (bot) 2368d86ed1 bpo-36565: Fix libregrtest for Python without builtin _abc (GH-12733) (GH-12734)
Fix reference hunting (``python3 -m test -R 3:3``) when Python has no
built-in abc module: fix _get_dump() reimplementation of libregrtest.
(cherry picked from commit 79b5d29041)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-04-09 01:54:16 +02:00
Miss Islington (bot) 6f9cd142a2 bpo-36522: Print all values for headers with multiple values. (GH-12681) (GH-12682)
(cherry picked from commit 461c416dd7)

Co-authored-by: Matt Houglum <houglum@google.com>
2019-04-04 11:25:59 +03:00
Pablo Galindo 513d142993
[3.7] bpo-36440: include node names in ParserError messages, instead of numeric IDs (GH-12565) (GH-12671)
The error messages in the parser module are referring to numeric IDs for the nodes. To improve readability, use the node names when reporting errors..
(cherry picked from commit cb0748d393)

Co-authored-by: tyomitch <tyomitch@gmail.com>
2019-04-03 14:34:59 -04:00
Miss Islington (bot) 9c08eeb30c
bpo-36504: Fix signed integer overflow in _ctypes.c's PyCArrayType_new(). (GH-12660)
(cherry picked from commit 487b73ab39)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-04-03 10:55:26 -07:00
Miss Islington (bot) 5ca4fe0478
bpo-13120: fix typo with test_issue13120() method name (GH-12250)
Incorrect issue number '13210' added in 539ee5da6f.

https://bugs.python.org/issue13120
(cherry picked from commit 9139f926a8)

Co-authored-by: Daniel Hahler <github@thequod.de>
2019-04-02 01:17:25 -07:00
Inada Naoki 8384670615
bpo-20844: open script file with "rb" mode (GH-12616)
(cherry picked from commit 10654c19b5)
2019-04-01 21:02:51 +09:00
Serhiy Storchaka a37f356de1
[3.7] bpo-36492: Fix passing special keyword arguments to some functions. (GH-12637) (GH-12645)
The following arguments can be passed as keyword arguments for passing
to other function if the corresponding required argument is passed as
positional:

- "func" in functools.partialmethod(), weakref.finalize(),
  profile.Profile.runcall(), cProfile.Profile.runcall(),
  bdb.Bdb.runcall(), trace.Trace.runfunc() and
  curses.wrapper().
- "function" in unittest.addModuleCleanup() and
  unittest.TestCase.addCleanup().
- "fn" in the submit() method of concurrent.futures.ThreadPoolExecutor
  and concurrent.futures.ProcessPoolExecutor.
- "callback" in contextlib.ExitStack.callback(),
  contextlib.AsyncExitStack.callback() and
  contextlib.AsyncExitStack.push_async_callback().
- "c" and "typeid" in multiprocessing.managers.Server.create().
- "obj" in weakref.finalize().

(cherry picked from commit 42a139ed88)
2019-04-01 10:59:24 +03:00
Miss Islington (bot) bd48280cb6 bpo-24214: Fixed the UTF-8 incremental decoder. (GH-12603) (GH-12627)
The bug occurred when the encoded surrogate character is passed
to the incremental decoder in two chunks.
(cherry picked from commit 7a465cb5ee)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-03-30 15:52:41 +02:00
Miss Islington (bot) 4724ba9b57 bpo-36434: Properly handle writing errors in ZIP files. (GH-12559) (GH-12628)
Errors during writing no longer prevent to properly close
the ZIP file.
(cherry picked from commit 2524fdefc9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-03-30 15:52:16 +02:00
Miss Islington (bot) 9cad523328
bpo-31292: Fixed distutils check --restructuredtext for include directives (GH-10605)
(cherry picked from commit d5a5a33f12)

Co-authored-by: Philipp A <flying-sheep@web.de>
2019-03-27 15:25:57 -07:00
Miss Islington (bot) 65445f65e6
bpo-36441: Fixes creating a venv when debug binaries are installed. (GH-12566)
(cherry picked from commit 4a9a505d6f)

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2019-03-27 08:47:57 -07:00
Miss Islington (bot) 23eb816399
bpo-36429: Fix starting IDLE with pyshell (GH-12548)
Add idlelib.pyshell alias at top; remove pyshell alias at bottom.
Remove obsolete __name__=='__main__' command.
(cherry picked from commit 6a258c8890)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-03-26 17:19:23 -07:00
Miss Islington (bot) 03440850e7
bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556)
https://bugs.python.org/issue36433
(cherry picked from commit 871309c775)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2019-03-26 02:47:08 -07:00
Miss Islington (bot) 9dbb09fc27 bpo-36218: Fix handling of heterogeneous values in list.sort (GH-12209) GH-12532)
(cherry picked from commit dd5417afcf)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2019-03-25 00:47:55 -07:00
Miss Islington (bot) 0e05d8a82d
bpo-30348: IDLE: Add test_autocomplete unittest (GH-2209)
(cherry picked from commit 113d735e20)

Co-authored-by: Louie Lu <git@louie.lu>
2019-03-24 16:53:13 -07:00
Miss Islington (bot) 2b580146a5
bpo-36405: IDLE - Restore __main__ and add tests (GH-12518)
Fix error in commit 2b75155 noticed by Serhiy Storchaka.
(cherry picked from commit 0fe4513d9a)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-03-24 14:32:40 -07:00
Miss Islington (bot) 5ab665005b
bpo-23205: IDLE: Add tests and refactor grep's findfiles (GH-12203)
* Add tests for grep findfiles.
* Move findfiles to module function.
* Change findfiles to use os.walk.

Based on a patch by Al Sweigart.
(cherry picked from commit d60f658fc0)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2019-03-23 05:21:46 -07:00
Miss Islington (bot) 00986ec553
bpo-36405: Use dict unpacking in idlelib (GH-12507)
Remove now unneeded imports.
(cherry picked from commit 2b75155590)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-03-23 01:08:37 -07:00
Miss Islington (bot) 2d7798ad12
bpo-36396: Remove fgBg param of idlelib.config.GetHighlight() (GH-12491)
This param was only used once and changed the return type.
(cherry picked from commit c1419578a1)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-03-22 15:42:51 -07:00
Miss Islington (bot) fdd82338a3
Raise the timeout in test_multiprocessing_* for slow buildbots (GH-12489)
(cherry picked from commit 40b6907b37)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-03-22 00:54:32 -07:00
Miss Islington (bot) 00eb97b4a7 bpo-36256: Fix bug in parsermodule when parsing if statements (GH-12488)
bpo-36256: Fix bug in parsermodule when parsing if statements

In the parser module, when validating nodes before starting the parsing with to create a ST in "parser_newstobject" there is a problem that appears when two arcs in the same DFA state has transitions with labels with the same type. For example, the DFA for if_stmt has a state with
two labels with the same type: "elif" and "else" (type NAME). The algorithm tries one by one the arcs until the label that starts the arc transition has a label with the same type of the current child label we are trying to accept. In this case, the arc for "elif" comes before the arc for "else"and passes this test (because the current child label is "else" and has the same type as "elif"). This lead to expecting a namedexpr_test (305) instead of a colon (11). The solution is to compare also the string representation (in case there is one) of the labels to see if the transition that we have is the correct one.
(cherry picked from commit 9a0000d15d)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-03-21 23:56:20 +00:00
Miss Islington (bot) b0967fe4ed
bpo-35978: Correctly skips venv tests in venvs (GH-12220)
Also fixes venvs from the build directory on Windows.
(cherry picked from commit 8bba81fd55)

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2019-03-21 10:33:40 -07:00
Miss Islington (bot) 74829b7323
bpo-36312: Fix decoders for some code pages. (GH-12369)
(cherry picked from commit c1e2c288f4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-03-20 21:31:57 -07:00
Victor Stinner dd1cfefd67
bpo-36235: Enhance distutils test_customize_compiler() (GH-12403) (GH-12415)
The test test_customize_compiler() now mocks all sysconfig variables
and all environment variables used by customize_compiler().

(cherry picked from commit 72c7b372cf)
2019-03-18 18:34:11 +01:00
Miss Islington (bot) 6a7a9f1d83 bpo-36272: Logging now propagates RecursionError (GH-12312) (GH-12391)
(cherry picked from commit 65f64b1903)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2019-03-18 14:22:41 +00:00
Miss Islington (bot) bedfbc790e bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375) (GH-12395)
(cherry picked from commit 23581c018f)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-03-18 00:48:02 -07:00
Miss Islington (bot) 7f7485c060
bpo-34745: Fix asyncio sslproto memory issues (GH-12386)
* Fix handshake timeout leak in asyncio/sslproto

Refs MagicStack/uvloopGH-222

* Break circular ref _SSLPipe <-> SSLProtocol

* bpo-34745: Fix asyncio ssl memory leak

* Break circular ref SSLProtocol <-> UserProtocol

* Add NEWS entry
(cherry picked from commit f683f46425)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2019-03-17 16:09:14 -07:00
Miss Islington (bot) b34f1aa814
bpo-23216: IDLE: Add docstrings to search modules (GH-12141)
(cherry picked from commit 0bb5e75cf8)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2019-03-16 16:47:28 -07:00
Victor Stinner 6c0e0d141a
bpo-36235: Fix CFLAGS in distutils customize_compiler() (GH-12236) (GH-12348)
Fix CFLAGS in customize_compiler() of distutils.sysconfig: when the
CFLAGS environment variable is defined, don't override CFLAGS variable with
the OPT variable anymore.

Initial patch written by David Malcolm.

Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
(cherry picked from commit 86082c22d2)
2019-03-15 16:03:50 +01:00
Miss Islington (bot) 0b9bd5b4c3
Fix typo duplicate period in a docstring in the zipfile module. (GH-12326)
(cherry picked from commit 53c2935dac)

Co-authored-by: nick sung <sungboss2004@gmail.com>
2019-03-14 21:52:59 -07:00
Ned Deily 69785b2127 3.7.3rc1 2019-03-12 15:14:21 -04:00
Miss Islington (bot) 1c4580d1f5
[3.7] bpo-35931: Gracefully handle any exception in pdb debug command (GH-12103) (GH-12285)
This is relevant for `debug doesnotexist()`, which would crash with a
NameError otherwise.
(cherry picked from commit 3e936431e2)


Co-authored-by: Daniel Hahler <github@thequod.de>


https://bugs.python.org/issue35931
2019-03-11 21:00:59 -07:00
Miss Islington (bot) 24872e1e15
bpo-36234: Add more tests to PosixUidGidTests (GH-12234)
test_posix.PosixUidGidTests:

* Add tests for invalid uid/gid type (str)
* Add UID_OVERFLOW and GID_OVERFLOW constants to replace (1 << 32)

Initial patch written by David Malcolm.

Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
(cherry picked from commit 876e82b4f3)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-03-11 06:18:40 -07:00
Miss Islington (bot) ea1627008e
bpo-36176: Fix IDLE autocomplete & calltip popup colors. (GH-12262)
Prevent conflicts with Linux dark themes
(and slightly darken calltip background).
(cherry picked from commit 491ef53c15)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-03-10 17:37:36 -07:00
Miss Islington (bot) 97c7d78fda
bpo-35647: Fix path check in cookiejar (GH-11436)
* Refactor cookie path check as per RFC 6265

* Add tests for prefix match of path

* Add news entry

* Fix set_ok_path and refactor tests

* Use slice for last letter
(cherry picked from commit 0e1f1f0105)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-03-10 10:30:35 -07:00