Commit Graph

21508 Commits

Author SHA1 Message Date
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
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) 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) 35fc38e5e8
bpo-36157:Document PyInterpreterState_Main() (GH-12238)
I have added documentation for `PyInterpreterState_Main()`.
 I chose to place it under Advanced Debugger Support together with similar functions like `PyInterpreterState_Head()`, `PyInterpreterState_Next(`), and `PyInterpreterState_ThreadHead()` .

https://bugs.python.org/issue36157
(cherry picked from commit 8c61739def)

Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
2019-04-01 08:15:10 -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) 3e78c7c305 bpo-36010: Add venv to the nuget distribution (GH-12367)
(cherry picked from commit e724152796)

Co-authored-by: Paul Moore <p.f.moore@gmail.com>
2019-03-30 14:47:12 -07: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) e9868c5416
bpo-35941: Fix ssl certificate enumeration for windows (GH-12486)
Add a function to collect certificates from several certificate stores into one certificate collection store that is then enumerated. This ensures we load as many certificates as we can access.
(cherry picked from commit d93fbbf88e)

Co-authored-by: kctherookie <48805853+kctherookie@users.noreply.github.com>
2019-03-28 11:56:50 -07:00
Miss Islington (bot) 1d9f1a0c96
bpo-36425: Add Simplified Chinese to the language switcher (GH-12537)
(cherry picked from commit 45a5fdb91c)

Co-authored-by: zhsj <zsj950618@gmail.com>
2019-03-28 11:12:39 -07:00
Miss Islington (bot) 6fd3c852b1
bpo-36459: Fix a possible double PyMem_FREE() due to tokenizer.c's tok_nextc() (12601)
Remove the PyMem_FREE() call added in cb90c89.  The buffer will be
freed when PyTokenizer_Free() is called on the tokenizer state.
(cherry picked from commit cda139d1de)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-03-28 08:08:35 -07:00
Ned Deily 3746635679
[3.7] Fix NEWS entry with incorrect bpo number (GH-12600) 2019-03-28 00:20:59 -04: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) ead1579598
bpo-33832: Add "magic method" glossary entry (GH-7630)
(cherry picked from commit f760610bdd)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
2019-03-26 18:26:52 -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) 20fde53a25
bpo-36436: Fix _testcapi.pymem_buffer_overflow() (GH-12560)
Handle memory allocation failure.
(cherry picked from commit 414b1cde93)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-03-26 08:39:03 -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) e0fe25be1e
bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)
(cherry picked from commit 0523c39e77)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-03-25 23:26:42 -07:00
Ned Deily 3a1f71d6d7 Python 3.7.3
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEDZbfTUEQ5cQ/v7F/LTR+pqplQh0FAlyZOEwACgkQLTR+pqpl
 Qh3UFRAAy9afwI0Jb6Q8drjDXJCRRpx9msSQ5V0vdN+nrs3DawH+y/4yHDCurwc/
 RbM5gwMXWU+Upy3rcCw/0gbNk6QAXrbL+D4hxMtLd4F2OVAKsrb/Hh5F+lPCPyiV
 lEK1dkr1I22ZixR1wY2jqp2QV1e2FMlyOD2cOD0fDYsKDb58ZsmMYuMxKnWQHOcf
 7d6db1UfKOgiJ2DIu86ZRVB+UdSNqkfzMFSV+c3+zcIkGTN7UM95lBA3XsVWPSSJ
 g80f2M951UczWy1zHGU52rZ5OphAGAL7voJ3hHEFzO0gf6EwDnu3RFP6Gn+2rVMO
 PW+TKloE2DBEmY7bl6PLFfBOHisFbWrR5TEd8xvLco/COnSyGhf+lL27CamqG0SD
 dlVIQgoUL5Xj0H8clcokXPU94u7VQioEW9/Na45JICaxV9V9uuJUpJ2Rvq4hNnd8
 8Ul4aFff/N7plnNN/TsetZmv1N8nKTBjy79bT7HxK6zx7oLaLwyMAne0XG0CRskX
 PSfz8vaWMGAlmXTXR56vc7INZizJzWptF8N5q43Hx55lV9ZK62ykWBZlbJPeg+1z
 qwEwg9i9H6SNq7G1lbniwr2gec37e9pQ1DOEY5F08eK7rbjHQ5A5uVx+zKKp1vCd
 wYwbBQAzVKSXC9ez5u7snFL51vjzffALwtUWB+tXKCINwlst2W0=
 =a5jU
 -----END PGP SIGNATURE-----

Merge tag 'v3.7.3' into 3.7
2019-03-25 19:28:53 -04:00
Ned Deily ef4ec6ed12 3.7.3 2019-03-25 16:21:05 -04:00
Miss Islington (bot) fa27870992
bpo-36421: Fix a possible double decref in _ctypes.c's PyCArrayType_new(). (GH-12530)
Set type_attr to NULL after the assignment to stgdict->proto (like
what is done with stgdict after the Py_SETREF() call) so that it is
not decrefed twice on error.
(cherry picked from commit 5e333784f0)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-03-25 01:34:26 -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
Harmon ab8fcfda90 Fix "catchs" typos in NEWS entries (GH-12364) 2019-03-24 22:22:36 -04:00
Ned Deily b7540e096e Remove NEWS entries duplicated from 3.7.2final. (GH-12309) 2019-03-24 22:22:19 -04:00
Ned Deily ab48fc0b9f Correct minor edit to news entry. (GH-12299) 2019-03-24 22:21:46 -04: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) d93de028e8
bpo-32217: Correct usage of ABI tags in freeze. (GH-4719)
Check for sys.abiflags before using since not all platforms have it defined.
(cherry picked from commit a7987e7193)

Co-authored-by: AraHaan <15173749+AraHaan@users.noreply.github.com>
2019-03-23 09:47: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) 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) 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
Julien Palard 756cfd8892
[3.7] bpo-35564: add master_doc='contents' to conf.py (GH-12460)
(cherry picked from commit fc8284e220)

Co-authored-by: Jean-François B <jfbu@free.fr>
2019-03-20 10:40:30 +01:00
Victor Stinner f7959a9fe7
bpo-36236: Handle removed cwd at Python init (GH-12450)
At Python initialization, the current directory is no longer
prepended to sys.path if it has been removed.
2019-03-20 00:30:45 +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
Harmon c49521dfd1 Fix "catchs" typos in NEWS entries (GH-12364) 2019-03-17 16:49:43 -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
Miss Islington (bot) e213cd6325
bpo-36138: Clarify docs about converting datetime.timedelta to scalars. (GH-12137)
Be explicit that timedelta division converts an overall duration to the interval
units given by the denominator.
(cherry picked from commit f40b4a0b62)

Co-authored-by: Yasser A <yalshalaan@gmail.com>
2019-03-15 21:03:43 -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
Victor Stinner 9818360ed9
bpo-36262: Fix _Py_dg_strtod() memory leak (goto undfl) (GH-12276) (GH-12331)
Fix an unlikely memory leak on conversion from string to float in the
function _Py_dg_strtod() used by float(str), complex(str),
pickle.load(), marshal.load(), etc.

Fix an unlikely memory leak in _Py_dg_strtod() on "undfl:" label:
rewrite memory management in this function to always release all
memory before exiting the function. Initialize variables to NULL, and
set them to NULL after calling Bfree() at the "cont:" label.

Note: Bfree(NULL) is well defined: it does nothing.

(cherry picked from commit 9776b0636a)
2019-03-14 17:12:01 +01:00
Ned Deily a84f9bc11c
Remove NEWS entries duplicated from 3.7.2final. (GH-12309) 2019-03-13 10:49:21 -04:00
Ned Deily 500320d3a6
Correct minor edit to news entry. (GH-12299) 2019-03-12 19:44:41 -04:00