]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
5 years agobpo-39050: The Help button in IDLE's config menu works again (GH-17611)
Zackery Spytz [Thu, 23 Jan 2020 03:54:30 +0000 (20:54 -0700)] 
bpo-39050: The Help button in IDLE's config menu works again (GH-17611)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
5 years agobpo-29435: Allow is_tarfile to take a filelike obj (GH-18090)
William Woodruff [Thu, 23 Jan 2020 02:24:16 +0000 (21:24 -0500)] 
bpo-29435: Allow is_tarfile to take a filelike obj (GH-18090)

`is_tarfile()` now supports `name` being a file or file-like object.

5 years agobpo-39427: Document -X opt options in the CLI --help and the man page (GH-18131)
Pablo Galindo [Thu, 23 Jan 2020 01:03:04 +0000 (01:03 +0000)] 
bpo-39427: Document -X opt options in the CLI --help and the man page (GH-18131)

https://bugs.python.org/issue39427

Automerge-Triggered-By: @pablogsal
5 years agobpo-39336: Allow packages to not let their child modules be set on them (#18006)
Dino Viehland [Thu, 23 Jan 2020 00:42:38 +0000 (16:42 -0800)] 
bpo-39336: Allow packages to not let their child modules be set on them (#18006)

* bpo-39336: Allow setattr to fail on modules which aren't assignable

When attaching a child module to a package if the object in sys.modules raises an AttributeError (e.g. because it is immutable) it causes the whole import to fail.  This now allows immutable packages to exist and an ImportWarning is reported and the AttributeError exception is ignored.

5 years agobpo-35182: fix communicate() crash after child closes its pipes (GH-17020) (GH-18117)
Alex Rebert [Wed, 22 Jan 2020 23:28:31 +0000 (18:28 -0500)] 
bpo-35182: fix communicate() crash after child closes its pipes (GH-17020) (GH-18117)

When communicate() is called in a loop, it crashes when the child process
has already closed any piped standard stream, but still continues to be running

Co-authored-by: Andriy Maletsky <andriy.maletsky@gmail.com>
5 years agobpo-39366: Remove xpath() and xgtitle() methods of NNTP (GH-18035)
Dong-hee Na [Wed, 22 Jan 2020 21:59:43 +0000 (06:59 +0900)] 
bpo-39366: Remove xpath() and xgtitle() methods of NNTP (GH-18035)

5 years agobpo-39406: Implement os.putenv() with setenv() if available (GH-18128)
Victor Stinner [Wed, 22 Jan 2020 21:48:16 +0000 (22:48 +0100)] 
bpo-39406: Implement os.putenv() with setenv() if available (GH-18128)

If setenv() C function is available, os.putenv() is now implemented
with setenv() instead of putenv(), so Python doesn't have to handle
the environment variable memory.

5 years agobpo-39406: os.putenv() avoids putenv_dict on Windows (GH-18126)
Victor Stinner [Wed, 22 Jan 2020 20:53:26 +0000 (21:53 +0100)] 
bpo-39406: os.putenv() avoids putenv_dict on Windows (GH-18126)

Windows: _wputenv(env) copies the *env* string and doesn't require
the caller to manage the variable memory.

5 years agoRevert "bpo-39413: Implement os.unsetenv() on Windows (GH-18104)" (GH-18124)
Victor Stinner [Wed, 22 Jan 2020 20:11:17 +0000 (21:11 +0100)] 
Revert "bpo-39413: Implement os.unsetenv() on Windows (GH-18104)" (GH-18124)

This reverts commit 56cd3710a1ea3ba872d345ea1bebc86ed08bc8b8.

5 years agobpo-39353: Deprecate the binhex module (GH-18025)
Victor Stinner [Wed, 22 Jan 2020 19:44:22 +0000 (20:44 +0100)] 
bpo-39353: Deprecate the binhex module (GH-18025)

Deprecate binhex4 and hexbin4 standards. Deprecate the binhex module
and the following binascii functions:

* b2a_hqx(), a2b_hqx()
* rlecode_hqx(), rledecode_hqx()
* crc_hqx()

5 years agobpo-39425: Fix list.count performance regression (GH-18119)
Dong-hee Na [Wed, 22 Jan 2020 17:36:54 +0000 (02:36 +0900)] 
bpo-39425: Fix list.count performance regression (GH-18119)

https://bugs.python.org/issue39425

Automerge-Triggered-By: @pablogsal
5 years agobpo-39377: json: Update doc about the encoding option. (GH-18076)
Inada Naoki [Wed, 22 Jan 2020 10:01:24 +0000 (19:01 +0900)] 
bpo-39377: json: Update doc about the encoding option. (GH-18076)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
5 years agocloses bpo-39415: Remove unused codes from longobject.c complexobject.c floatobject...
Dong-hee Na [Wed, 22 Jan 2020 02:49:30 +0000 (11:49 +0900)] 
closes bpo-39415: Remove unused codes from longobject.c complexobject.c floatobject.c. (GH-18105)

5 years agoPyLong_AsLongLong() docs should say 'long long' (#18082)
Keith Erskine [Tue, 21 Jan 2020 19:14:13 +0000 (13:14 -0600)] 
PyLong_AsLongLong() docs should say 'long long' (#18082)

5 years agobpo-39406: Add PY_PUTENV_DICT macro to posixmodule.c (GH-18106)
Victor Stinner [Tue, 21 Jan 2020 18:25:32 +0000 (19:25 +0100)] 
bpo-39406: Add PY_PUTENV_DICT macro to posixmodule.c (GH-18106)

Rename posix_putenv_garbage to putenv_dict.

5 years agobpo-39413: Implement os.unsetenv() on Windows (GH-18104)
Victor Stinner [Tue, 21 Jan 2020 15:13:09 +0000 (16:13 +0100)] 
bpo-39413: Implement os.unsetenv() on Windows (GH-18104)

The os.unsetenv() function is now also available on Windows.

It is implemented with SetEnvironmentVariableW(name, NULL).

5 years agoMove test_math tests (GH-18098)
Victor Stinner [Tue, 21 Jan 2020 11:48:16 +0000 (12:48 +0100)] 
Move test_math tests (GH-18098)

testPerm() and testComb() belong to MathTests, not to IsCloseTests().

test_nextafter() and test_ulp() now use assertIsNaN().

5 years agobpo-33387: Fix compiler warning in frame_block_unwind() (GH-18099)
Victor Stinner [Tue, 21 Jan 2020 11:47:29 +0000 (12:47 +0100)] 
bpo-33387: Fix compiler warning in frame_block_unwind() (GH-18099)

Replace int with intptr_t to fix the warning:

    objects\frameobject.c(341): warning C4244: 'initializing':
    conversion from '__int64' to 'int', possible loss of data

5 years agobpo-39389: gzip: fix compression level metadata (GH-18077)
William Chargin [Tue, 21 Jan 2020 11:25:24 +0000 (03:25 -0800)] 
bpo-39389: gzip: fix compression level metadata (GH-18077)

As described in RFC 1952, section 2.3.1, the XFL (eXtra FLags) byte of a
gzip member header should indicate whether the DEFLATE algorithm was
tuned for speed or compression ratio. Prior to this patch, archives
emitted by the `gzip` module always indicated maximum compression.

5 years agobpo-39396: Fix math.nextafter(-0.0, +0.0) on AIX 7.1 (GH-18094)
Victor Stinner [Tue, 21 Jan 2020 10:14:10 +0000 (11:14 +0100)] 
bpo-39396: Fix math.nextafter(-0.0, +0.0) on AIX 7.1 (GH-18094)

Move also math.nextafter() on math.ulp() tests from IsCloseTests to
MathTests.

5 years agobpo-32989: IDLE - fix bad editor call of pyparse method (GH-5968)
Cheryl Sabella [Tue, 21 Jan 2020 10:11:26 +0000 (05:11 -0500)] 
bpo-32989: IDLE - fix bad editor call of pyparse method (GH-5968)

Fix comments and add tests for editor newline_and_indent_event method.
Remove unused None default for function parameter of pyparse find_good_parse_start method
and code triggered by that default.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
5 years agoimprove the documentation of the LOAD_METHOD and CALL_METHOD (GH-18079)
Carl Friedrich Bolz-Tereick [Tue, 21 Jan 2020 00:41:17 +0000 (01:41 +0100)] 
improve the documentation of the LOAD_METHOD and CALL_METHOD (GH-18079)

5 years agobpo-39383: Mention Darwin as a potential value for platform.system() (GH-18054)
Peter Bittner [Mon, 20 Jan 2020 23:22:56 +0000 (00:22 +0100)] 
bpo-39383: Mention Darwin as a potential value for platform.system() (GH-18054)

5 years agobpo-39386: Prevent double awaiting of async iterator (GH-18081)
Andrew Svetlov [Mon, 20 Jan 2020 22:49:30 +0000 (00:49 +0200)] 
bpo-39386: Prevent double awaiting of async iterator (GH-18081)

5 years agoFix asyncio.get_event_loop() documentation (GH-18051)
Andrew Svetlov [Mon, 20 Jan 2020 22:46:38 +0000 (00:46 +0200)] 
Fix asyncio.get_event_loop() documentation (GH-18051)

Mention that the function implicitly creates new event loop only if called from the main thread.

5 years agobpo-35134: Migrate frameobject.h contents to cpython/frameobject.h (GH-18052)
Nick Coghlan [Mon, 20 Jan 2020 22:21:35 +0000 (08:21 +1000)] 
bpo-35134: Migrate frameobject.h contents to cpython/frameobject.h (GH-18052)

5 years agobpo-39377: json: Remove the encoding option. (GH-18075)
Inada Naoki [Mon, 20 Jan 2020 04:54:00 +0000 (13:54 +0900)] 
bpo-39377: json: Remove the encoding option. (GH-18075)

5 years agobpo-38536: locale: Remove trailing space in formatted currency (GH-16864)
Inada Naoki [Mon, 20 Jan 2020 03:45:50 +0000 (12:45 +0900)] 
bpo-38536: locale: Remove trailing space in formatted currency (GH-16864)

5 years agobpo-35561: Supress valgrind false alarm on epoll_ctl(event) (GH-18060)
Zackery Spytz [Sun, 19 Jan 2020 22:38:37 +0000 (15:38 -0700)] 
bpo-35561: Supress valgrind false alarm on epoll_ctl(event) (GH-18060)

Update Misc/valgrind-python.supp to suppress the false alarm.

5 years agoFix typo from base to based (GH-18055)
Michael Haas [Sun, 19 Jan 2020 10:29:42 +0000 (04:29 -0600)] 
Fix typo from base to based (GH-18055)

5 years agobpo-39372: Clean header files of declared interfaces with no implementations (GH...
Pablo Galindo [Sat, 18 Jan 2020 03:14:59 +0000 (03:14 +0000)] 
bpo-39372: Clean header files of declared interfaces with no implementations (GH-18037)

The public API symbols being removed are:

_PyBytes_InsertThousandsGroupingLocale, _PyBytes_InsertThousandsGrouping, _Py_InitializeFromArgs, _Py_InitializeFromWideArgs, _PyFloat_Repr, _PyFloat_Digits,
_PyFloat_DigitsInit, PyFrame_ExtendStack, _PyAIterWrapper_Type, PyNullImporter_Type, PyCmpWrapper_Type, PySortWrapper_Type, PyNoArgsFunction.

5 years agoRun doctests in GitHub actions Docs targer (GH-18041)
Pablo Galindo [Fri, 17 Jan 2020 23:44:38 +0000 (23:44 +0000)] 
Run doctests in GitHub actions Docs targer (GH-18041)

5 years agoFix Lock.locked() to remove extra bold highlighting (#18042)
Grant Jenks [Fri, 17 Jan 2020 22:54:44 +0000 (14:54 -0800)] 
Fix Lock.locked() to remove extra bold highlighting (#18042)

5 years agobpo-39356, zipfile: Remove code handling DeprecationWarning (GH-18027)
Victor Stinner [Fri, 17 Jan 2020 14:17:48 +0000 (15:17 +0100)] 
bpo-39356, zipfile: Remove code handling DeprecationWarning (GH-18027)

Remove old "except DeprecationWarning:" code path added by
commit bf02e3bb21b2d75cba4ce409a14ae64dbc2dd6d2. It's no longer
needed.

struct.pack() no longer emit DeprecationWarning if getting a float
whereas an integer is expected. It now raises an hard error instead.

5 years agobpo-39357: Update bz2 docstring: remove buffering (GH-18036)
Victor Stinner [Fri, 17 Jan 2020 12:50:39 +0000 (13:50 +0100)] 
bpo-39357: Update bz2 docstring: remove buffering (GH-18036)

Thanks Karthikeyan Singaravelan for the report ;-)

5 years agobpo-39357: Remove buffering parameter of bz2.BZ2File (GH-18028)
Victor Stinner [Thu, 16 Jan 2020 14:33:30 +0000 (15:33 +0100)] 
bpo-39357: Remove buffering parameter of bz2.BZ2File (GH-18028)

Remove the buffering parameter of bz2.BZ2File. Since Python 3.0, it
was ignored and using it was emitting a DeprecationWarning. Pass an
open file object to control how the file is opened.

The compresslevel parameter becomes keyword-only.

5 years agobpo-31031: Unify duplicate bits_in_digit and bit_length (GH-2866)
Niklas Fiekas [Thu, 16 Jan 2020 14:09:19 +0000 (15:09 +0100)] 
bpo-31031: Unify duplicate bits_in_digit and bit_length (GH-2866)

Add _Py_bit_length() to unify duplicate bits_in_digit() and bit_length().

5 years agobpo-39350: Remove deprecated fractions.gcd() (GH-18021)
Victor Stinner [Thu, 16 Jan 2020 10:02:51 +0000 (11:02 +0100)] 
bpo-39350: Remove deprecated fractions.gcd() (GH-18021)

Remove fractions.gcd() function, deprecated since Python 3.5
(bpo-22486): use math.gcd() instead.

5 years agobpo-39351: Remove base64.encodestring() (GH-18022)
Victor Stinner [Thu, 16 Jan 2020 09:24:16 +0000 (10:24 +0100)] 
bpo-39351: Remove base64.encodestring() (GH-18022)

Remove base64.encodestring() and base64.decodestring(), aliases
deprecated since Python 3.1: use base64.encodebytes() and
base64.decodebytes() instead.

5 years agobpo-39348: Fix code highlight for the SOCK_NONBLOCK example (GH-18018)
Oz N Tiram [Wed, 15 Jan 2020 23:55:13 +0000 (00:55 +0100)] 
bpo-39348: Fix code highlight for the SOCK_NONBLOCK example (GH-18018)

The previous double colon was wrongly place directly after Therefore.
Which produced a block without syntax highlighting. This fixes it
by separating the double colon from the text. As a result, sphinx now
properly highlights the python code.

https://bugs.python.org/issue39348

5 years agobpo-37958: Adding get_profile_dict to pstats (GH-15495)
Daniel Olshansky [Wed, 15 Jan 2020 22:51:54 +0000 (17:51 -0500)] 
bpo-37958: Adding get_profile_dict to pstats (GH-15495)

pstats is really useful or profiling and printing the output of the execution of some block of code, but I've found on multiple occasions when I'd like to access this output directly in an easily usable dictionary on which I can further analyze or manipulate.

The proposal is to add a function called get_profile_dict inside of pstats that'll automatically return this data the data in an easily accessible dict.

The output of the following script:

```
import cProfile, pstats
import pprint
from pstats import func_std_string, f8

def fib(n):
    if n == 0:
        return 0
    if n == 1:
        return 1
    return fib(n-1) + fib(n-2)

pr = cProfile.Profile()
pr.enable()
fib(5)
pr.create_stats()

ps = pstats.Stats(pr).sort_stats('tottime', 'cumtime')

def get_profile_dict(self, keys_filter=None):
    """
        Returns a dict where the key is a function name and the value is a dict
        with the following keys:
            - ncalls
            - tottime
            - percall_tottime
            - cumtime
            - percall_cumtime
            - file_name
            - line_number

        keys_filter can be optionally set to limit the key-value pairs in the
        retrieved dict.
    """
    pstats_dict = {}
    func_list = self.fcn_list[:] if self.fcn_list else list(self.stats.keys())

    if not func_list:
        return pstats_dict

    pstats_dict["total_tt"] = float(f8(self.total_tt))
    for func in func_list:
        cc, nc, tt, ct, callers = self.stats[func]
        file, line, func_name = func
        ncalls = str(nc) if nc == cc else (str(nc) + '/' + str(cc))
        tottime = float(f8(tt))
        percall_tottime = -1 if nc == 0 else float(f8(tt/nc))
        cumtime = float(f8(ct))
        percall_cumtime = -1 if cc == 0 else float(f8(ct/cc))
        func_dict = {
            "ncalls": ncalls,
            "tottime": tottime, # time spent in this function alone
            "percall_tottime": percall_tottime,
            "cumtime": cumtime, # time spent in the function plus all functions that this function called,
            "percall_cumtime": percall_cumtime,
            "file_name": file,
            "line_number": line
        }
        func_dict_filtered = func_dict if not keys_filter else { key: func_dict[key] for key in keys_filter }
        pstats_dict[func_name] = func_dict_filtered

    return pstats_dict

pp = pprint.PrettyPrinter(depth=6)
pp.pprint(get_profile_dict(ps))
```

will produce:

```
{"<method 'disable' of '_lsprof.Profiler' objects>": {'cumtime': 0.0,
                                                      'file_name': '~',
                                                      'line_number': 0,
                                                      'ncalls': '1',
                                                      'percall_cumtime': 0.0,
                                                      'percall_tottime': 0.0,
                                                      'tottime': 0.0},
 'create_stats': {'cumtime': 0.0,
                  'file_name': '/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cProfile.py',
                  'line_number': 50,
                  'ncalls': '1',
                  'percall_cumtime': 0.0,
                  'percall_tottime': 0.0,
                  'tottime': 0.0},
 'fib': {'cumtime': 0.0,
         'file_name': 'get_profile_dict.py',
         'line_number': 5,
         'ncalls': '15/1',
         'percall_cumtime': 0.0,
         'percall_tottime': 0.0,
         'tottime': 0.0},
 'total_tt': 0.0}
 ```

 As an example, this can be used to generate a stacked column chart using various visualization tools which will assist in easily identifying program bottlenecks.

https://bugs.python.org/issue37958

Automerge-Triggered-By: @gpshead
5 years agoFix typo in multiprocessing.pool.AsyncResult.successful doc. (GH-17932)
Antoine [Wed, 15 Jan 2020 20:12:42 +0000 (21:12 +0100)] 
Fix typo in multiprocessing.pool.AsyncResult.successful doc. (GH-17932)

Since 3.7 `successful` raises a `ValueError` as explained in the next text block from the documentation:

_Changed in version 3.7: If the result is not ready, ValueError is raised instead of AssertionError._

No issue associated with this PR.
Should be backported in 3.7 and 3.8.

5 years agoFix compiler warning on Windows (GH-18012)
Ammar Askar [Wed, 15 Jan 2020 16:48:40 +0000 (11:48 -0500)] 
Fix compiler warning on Windows (GH-18012)

Python-ast.h contains a macro named Yield that conflicts with the Yield macro
in Windows system headers. While Python-ast.h has an "undef Yield" directive
to prevent this, it means that Python-ast.h must be included before Windows
header files or we run into a re-declaration warning. In commit c96be811fa7d
an include for pycore_pystate.h was added which indirectly includes Windows
header files. In this commit we re-order the includes to fix this warning.

5 years agobpo-38630: Fix subprocess.Popen.send_signal() race condition (GH-16984)
Victor Stinner [Wed, 15 Jan 2020 16:38:55 +0000 (17:38 +0100)] 
bpo-38630: Fix subprocess.Popen.send_signal() race condition (GH-16984)

On Unix, subprocess.Popen.send_signal() now polls the process status.
Polling reduces the risk of sending a signal to the wrong process if
the process completed, the Popen.returncode attribute is still None,
and the pid has been reassigned (recycled) to a new different
process.

5 years agobpo-1635741: Port _json extension module to multiphase initialization (PEP 489) ...
Hai Shi [Wed, 15 Jan 2020 16:32:51 +0000 (00:32 +0800)] 
bpo-1635741: Port _json extension module to multiphase initialization (PEP 489) (GH-17835)

5 years agobpo-39164: Fix compiler warning in PyErr_GetExcInfo() (GH-18010)
Victor Stinner [Wed, 15 Jan 2020 10:23:25 +0000 (11:23 +0100)] 
bpo-39164: Fix compiler warning in PyErr_GetExcInfo() (GH-18010)

The function has no return value.

5 years agoFix AsyncMock base class in the docs (GH-18008)
Elena Oat [Wed, 15 Jan 2020 09:50:57 +0000 (01:50 -0800)] 
Fix AsyncMock base class in the docs (GH-18008)

5 years agoImprove test coverage for AsyncMock. (GH-17906)
Karthikeyan Singaravelan [Wed, 15 Jan 2020 09:49:49 +0000 (15:19 +0530)] 
Improve test coverage for AsyncMock. (GH-17906)

* Add test for nested async decorator patch.
* Add test for side_effect and wraps with a function.
* Add test for side_effect with an exception in the iterable.

5 years agoAllow pgen to produce a DOT format dump of the grammar (GH-18005)
Pablo Galindo [Tue, 14 Jan 2020 22:32:55 +0000 (22:32 +0000)] 
Allow pgen to produce a DOT format dump of the grammar (GH-18005)

Originally suggested by Anthony Shaw.

5 years agobpo-39329: Add timeout parameter for smtplib.LMTP constructor (GH-17998)
Dong-hee Na [Tue, 14 Jan 2020 21:42:09 +0000 (06:42 +0900)] 
bpo-39329: Add timeout parameter for smtplib.LMTP constructor (GH-17998)

5 years agobpo-38901: Allow setting a venv's prompt to the basename of the current directory...
Vinay Sajip [Tue, 14 Jan 2020 20:49:30 +0000 (20:49 +0000)] 
bpo-38901: Allow setting a venv's prompt to the basename of the current directory. (GH-17946)

When a prompt value of '.' is specified, os.path.basename(os.getcwd()) is used to
configure the prompt for the created venv.

5 years agovenv: Suppress warning message when bash hashing is disabled. (GH-17966)
Dima [Tue, 14 Jan 2020 20:47:59 +0000 (21:47 +0100)] 
venv: Suppress warning message when bash hashing is disabled. (GH-17966)

When using python's built-in venv activaton script
warnings are printed when hashing is disabled in
bash or zsh, like;

`bash: hash: hashing disabled`

This output is not really useful to the end-user and has
been disabled in `virtualenv` for long.

This commit is based on:
https://github.com/pypa/virtualenv/commit/28e85bcd80d04b2a7ebce0e1d0b02d432b7e5593

5 years agoFix documentation in code.py (GH-17988)
Kyle Pollina [Tue, 14 Jan 2020 19:47:26 +0000 (13:47 -0600)] 
Fix documentation in code.py (GH-17988)

5 years agobpo-38361: syslog: fixed making default "ident" from sys.argv[0] (GH-16557)
Václav Bartoš [Tue, 14 Jan 2020 17:57:04 +0000 (18:57 +0100)] 
bpo-38361: syslog: fixed making default "ident" from sys.argv[0] (GH-16557)

The default value of "ident" parameter should be sys.argv[0] with leading path
components stripped, but it contained the last slash, i.e. '/program' instead
of 'program'.

BPO issue: https://bugs.python.org/issue38361

https://bugs.python.org/issue38361

5 years agobpo-39322: Add gc.is_finalized to the gc module docstring (GH-18000)
Pablo Galindo [Tue, 14 Jan 2020 17:38:15 +0000 (17:38 +0000)] 
bpo-39322: Add gc.is_finalized to the gc module docstring (GH-18000)

5 years agobpo-39322: Add gc.is_finalized to check if an object has been finalised by the gc...
Pablo Galindo [Tue, 14 Jan 2020 12:06:45 +0000 (12:06 +0000)] 
bpo-39322: Add gc.is_finalized to check if an object has been finalised by the gc (GH-17989)

5 years agobpo-39048: Look up __aenter__ before __aexit__ in async with (GH-17609)
Géry Ogam [Tue, 14 Jan 2020 11:58:29 +0000 (12:58 +0100)] 
bpo-39048: Look up __aenter__ before __aexit__ in async with (GH-17609)

* Reorder the __aenter__ and __aexit__ checks for async with
* Add assertions for async with body being skipped
* Swap __aexit__ and __aenter__ loading in the documentation

5 years agobpo-39156: Break up COMPARE_OP into four logically distinct opcodes. (GH-17754)
Mark Shannon [Tue, 14 Jan 2020 10:12:45 +0000 (10:12 +0000)] 
bpo-39156: Break up COMPARE_OP into four logically distinct opcodes. (GH-17754)

Break up COMPARE_OP into four logically distinct opcodes:
* COMPARE_OP for rich comparisons
* IS_OP for 'is' and 'is not' tests
* CONTAINS_OP for 'in' and 'is not' tests
* JUMP_IF_NOT_EXC_MATCH for checking exceptions in 'try-except' statements.

5 years agobpo-39259: smtp.SMTP/SMTP_SSL now reject timeout = 0 (GH-17958)
Dong-hee Na [Tue, 14 Jan 2020 07:49:59 +0000 (16:49 +0900)] 
bpo-39259: smtp.SMTP/SMTP_SSL now reject timeout = 0 (GH-17958)

5 years agobpo-39160 Align the verbs, grammar and defaults for `./configure --help` (GH-17747)
Anthony Shaw [Tue, 14 Jan 2020 06:40:10 +0000 (17:40 +1100)] 
bpo-39160 Align the verbs, grammar and defaults for `./configure --help` (GH-17747)

5 years agobpo-39259: ftplib.FTP/FTP_TLS now reject timeout = 0 (GH-17959)
Dong-hee Na [Mon, 13 Jan 2020 19:34:34 +0000 (04:34 +0900)] 
bpo-39259: ftplib.FTP/FTP_TLS now reject timeout = 0 (GH-17959)

5 years agoremove unused __version__ from mock.py (#17977)
Chris Withers [Mon, 13 Jan 2020 19:11:34 +0000 (19:11 +0000)] 
remove unused __version__ from mock.py (#17977)

This isn't included in `__all__` and could be a source of confusion.

5 years agobpo-38644: Pass tstate to _Py_FinishPendingCalls() (GH-17990)
Victor Stinner [Mon, 13 Jan 2020 17:46:59 +0000 (18:46 +0100)] 
bpo-38644: Pass tstate to _Py_FinishPendingCalls() (GH-17990)

_Py_FinishPendingCalls() now expects a tstate argument, instead of a
runtime argument.

5 years agobpo-39164: Add private _PyErr_GetExcInfo() function (GH-17752)
Julien Danjou [Mon, 13 Jan 2020 16:30:14 +0000 (17:30 +0100)] 
bpo-39164: Add private _PyErr_GetExcInfo() function (GH-17752)

This adds a new function named _PyErr_GetExcInfo() that is a variation of the
original PyErr_GetExcInfo() taking a PyThreadState as its first argument.
That function allows to retrieve the exceptions information of any Python
thread -- not only the current one.

5 years agobpo-39299: Add more tests for mimetypes and its cli. (GH-17949)
Karthikeyan Singaravelan [Mon, 13 Jan 2020 14:39:36 +0000 (20:09 +0530)] 
bpo-39299: Add more tests for mimetypes and its cli. (GH-17949)

* Add tests for case insensitive check of types and extensions as fallback.
* Add tests for data url with no comma.
* Add tests for read_mime_types.
* Add tests for the mimetypes cli and refactor __main__ code to private function.
* Restore mimetypes.knownfiles value at the end of the test.

5 years agobpo-20443: Update What's New In Python 3.9 (GH-17986)
Victor Stinner [Mon, 13 Jan 2020 13:57:14 +0000 (14:57 +0100)] 
bpo-20443: Update What's New In Python 3.9 (GH-17986)

The sys.argv[0] change has been reverted.

5 years agoCleanup exit code for interpreter. (GH-17756)
Mark Shannon [Mon, 13 Jan 2020 12:51:26 +0000 (12:51 +0000)] 
Cleanup exit code for interpreter. (GH-17756)

5 years agoFix typos in gcmodule.c and restructure comments for clarity (GH-17983)
Pablo Galindo [Mon, 13 Jan 2020 12:25:05 +0000 (12:25 +0000)] 
Fix typos in gcmodule.c and restructure comments for clarity (GH-17983)

5 years agoRemove unused functions in Parser/parsetok.c (GH-17365)
Emmanuel Arias [Mon, 13 Jan 2020 11:58:52 +0000 (08:58 -0300)] 
Remove unused functions in Parser/parsetok.c (GH-17365)

5 years agobpo-39310: Add math.ulp(x) (GH-17965)
Victor Stinner [Mon, 13 Jan 2020 11:44:35 +0000 (12:44 +0100)] 
bpo-39310: Add math.ulp(x) (GH-17965)

Add math.ulp(): return the value of the least significant bit
of a float.

5 years agobpo-39307: Fix memory leak on error path in parsetok (GH-17953)
Alex Henrie [Mon, 13 Jan 2020 10:35:47 +0000 (03:35 -0700)] 
bpo-39307: Fix memory leak on error path in parsetok (GH-17953)

5 years agobpo-32021: Support brotli .br encoding in mimetypes (#12200)
Philip McMahon [Sun, 12 Jan 2020 22:31:49 +0000 (22:31 +0000)] 
bpo-32021: Support brotli .br encoding in mimetypes (#12200)

Add support for brotli encoding in the encoding_map.

5 years agobpo-39313: Add an option to RefactoringTool for using exec as a function (GH-17967)
Batuhan Taşkaya [Sun, 12 Jan 2020 22:13:31 +0000 (01:13 +0300)] 
bpo-39313: Add an option to RefactoringTool for using exec as a function (GH-17967)

https://bugs.python.org/issue39313

Automerge-Triggered-By: @pablogsal
5 years agoFix outdated comment in _strptime.py (GH-17929)
Ram Rachum [Sun, 12 Jan 2020 20:53:00 +0000 (22:53 +0200)] 
Fix outdated comment in _strptime.py (GH-17929)

Can I please get the tags for skipping bpo and skipping a news item?

5 years agobpo-3530: Add advice on when to correctly use fix_missing_locations in the AST docs...
Batuhan Taşkaya [Sun, 12 Jan 2020 20:38:53 +0000 (23:38 +0300)] 
bpo-3530: Add advice on when to correctly use fix_missing_locations in the AST docs (GH-17172)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
5 years agobpo-38293: Allow shallow and deep copying of property objects (GH-16438)
Guðni Natan Gunnarsson [Sun, 12 Jan 2020 17:41:49 +0000 (17:41 +0000)] 
bpo-38293: Allow shallow and deep copying of property objects (GH-16438)

Copying property objects results in a TypeError. Steps to reproduce:

```
>>> import copy
>>> obj = property()
>>> copy.copy(obj)
````

This affects both shallow and deep copying.
My idea for a fix is to add property objects to the list of "atomic" objects in the copy module.
These already include types like functions and type objects.

I also added property objects to the unit tests test_copy_atomic and test_deepcopy_atomic. This is my first PR, and it's highly likely I've made some mistake, so please be kind :)

https://bugs.python.org/issue38293

5 years agobpo-39288: Add examples to math.nextafter() documentation (GH-17962)
Victor Stinner [Sun, 12 Jan 2020 11:57:47 +0000 (12:57 +0100)] 
bpo-39288: Add examples to math.nextafter() documentation (GH-17962)

5 years agobpo-38356: Fix ThreadedChildWatcher thread leak in test_asyncio (GH-16552)
Kyle Stanley [Sun, 12 Jan 2020 11:02:50 +0000 (06:02 -0500)] 
bpo-38356: Fix ThreadedChildWatcher thread leak in test_asyncio (GH-16552)

Motivation for this PR (comment from @vstinner in bpo issue):
```
Warning seen o AMD64 Ubuntu Shared 3.x buildbot:
https://buildbot.python.org/all/#/builders/141/builds/2593

test_devnull_output (test.test_a=syncio.test_subprocess.SubprocessThreadedWatcherTests) ...
Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, dangling: 2)
```
The following implementation details for the new method are TBD:

1) Public vs private

2) Inclusion in `close()`

3) Name

4) Coroutine vs subroutine method

5) *timeout* parameter

If it's a private method, 3, 4, and 5 are significantly less important.

I started with the most minimal implementation that fixes the dangling threads without modifying the regression tests, which I think is particularly important. I typically try to avoid directly modifying existing tests as much as possible unless it's necessary to do so. However, I am open to changing any part of this.

https://bugs.python.org/issue38356

5 years agobpo-12159: Document sys.maxsize limit in len() function reference (GH-17934)
Zac Hatfield-Dodds [Sun, 12 Jan 2020 09:04:14 +0000 (19:04 +1000)] 
bpo-12159: Document sys.maxsize limit in len() function reference (GH-17934)

5 years agobpo-16575: Disabled checks for union types being passed by value. (GH-17960)
Vinay Sajip [Sun, 12 Jan 2020 08:54:00 +0000 (08:54 +0000)] 
bpo-16575: Disabled checks for union types being passed by value. (GH-17960)

Although the underlying libffi issue remains open, adding these
checks have caused problems in third-party projects which are in
widespread use. See the issue for examples.

The corresponding tests have also been skipped.

5 years agobpo-39288: Add math.nextafter(x, y) (GH-17937)
Victor Stinner [Sun, 12 Jan 2020 01:15:42 +0000 (02:15 +0100)] 
bpo-39288: Add math.nextafter(x, y) (GH-17937)

Return the next floating-point value after x towards y.

5 years agobpo-39259: nntplib.NNTP/NNTP_SSL now reject timeout = 0 (GH-17936)
Dong-hee Na [Sat, 11 Jan 2020 17:39:15 +0000 (02:39 +0900)] 
bpo-39259: nntplib.NNTP/NNTP_SSL now reject timeout = 0 (GH-17936)

nntplib.NNTP and nntplib.NNTP_SSL now raise a ValueError
if the given timeout for their constructor is zero to
prevent the creation of a non-blocking socket.

5 years agobpo-39297: Update for importlib_metadata 1.4. (GH-17947)
Jason R. Coombs [Sat, 11 Jan 2020 15:37:28 +0000 (10:37 -0500)] 
bpo-39297: Update for importlib_metadata 1.4.  (GH-17947)

* bpo-39297: Update for importlib_metadata 1.4. Includes performance updates.

* 📜🤖 Added by blurb_it.

* Update blurb

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
5 years agobpo-39259: nntplib.NNTP/NNTP_SSL refactoring (GH-17939)
Dong-hee Na [Sat, 11 Jan 2020 15:07:36 +0000 (00:07 +0900)] 
bpo-39259: nntplib.NNTP/NNTP_SSL refactoring (GH-17939)

5 years agoFix host in address of socket.create_server example. (GH-17706)
Karthikeyan Singaravelan [Sat, 11 Jan 2020 05:16:30 +0000 (10:46 +0530)] 
Fix host in address of socket.create_server example. (GH-17706)

Host as None in address raises TypeError since it should be string, bytes or bytearray.

5 years agobpo-39292: Add missing syslog facility codes. (GH-17945)
Vinay Sajip [Fri, 10 Jan 2020 19:37:48 +0000 (19:37 +0000)] 
bpo-39292: Add missing syslog facility codes. (GH-17945)

5 years agobpo-39200: Correct the error message for min/max builtin function (GH-17814)
Dong-hee Na [Fri, 10 Jan 2020 16:31:43 +0000 (01:31 +0900)] 
bpo-39200: Correct the error message for min/max builtin function (GH-17814)

Correct the error message when calling the min() or max() with
no arguments.

5 years agobpo-39259: poplib now rejects timeout = 0 (GH-17912)
Dong-hee Na [Fri, 10 Jan 2020 14:34:05 +0000 (23:34 +0900)] 
bpo-39259: poplib now rejects timeout = 0 (GH-17912)

poplib.POP3 and poplib.POP3_SSL now raise a ValueError
if the given timeout for their constructor is zero to
prevent the creation of a non-blocking socket.

5 years agobpo-39166: Fix trace of last iteration of async for loops (#17800)
Pablo Galindo [Fri, 10 Jan 2020 09:24:22 +0000 (09:24 +0000)] 
bpo-39166: Fix trace of last iteration of async for loops (#17800)

5 years agobpo-39235: Check end_lineno and end_col_offset of AST nodes. (GH-17926)
Serhiy Storchaka [Fri, 10 Jan 2020 08:12:55 +0000 (10:12 +0200)] 
bpo-39235: Check end_lineno and end_col_offset of AST nodes. (GH-17926)

5 years agobpo-39235: Fix end location for genexp in call args (GH-17925)
Guido van Rossum [Thu, 9 Jan 2020 19:18:47 +0000 (11:18 -0800)] 
bpo-39235: Fix end location for genexp in call args (GH-17925)

The fix changes copy_location() to require an extra node from which to extract the end location, and fixing all 5 call sites.

https://bugs.python.org/issue39235

5 years agoFix typo in test's docstring (GH-17856)
Daniel Hahler [Thu, 9 Jan 2020 17:07:32 +0000 (18:07 +0100)] 
Fix typo in test's docstring (GH-17856)

* Fix typo in test's docstring. contination -> continuation.

5 years agobpo-25172: Reduce scope of crypt import tests (GH-17881)
Steve Dower [Thu, 9 Jan 2020 17:00:29 +0000 (09:00 -0800)] 
bpo-25172: Reduce scope of crypt import tests (GH-17881)

5 years agoAdd test cases for dataclasses. (#17909)
Karthikeyan Singaravelan [Thu, 9 Jan 2020 13:41:46 +0000 (19:11 +0530)] 
Add test cases for dataclasses. (#17909)

* Add test cases for dataclasses.

* Add test for repr output of field.
* Add test for ValueError to be raised when both default and default_factory are passed.

5 years agobpo-39161: Document multi-phase init modules under Py_NewInterpreter() (GH-17896)
Petr Viktorin [Thu, 9 Jan 2020 12:05:18 +0000 (13:05 +0100)] 
bpo-39161: Document multi-phase init modules under Py_NewInterpreter() (GH-17896)

\+ this also adds a stronger warning against sharing objects between (sub-)interpreters.

https://bugs.python.org/issue39161

5 years agobpo-39270: Remove dead assignment from config_init_module_search_paths (GH-17914)
Alex Henrie [Thu, 9 Jan 2020 09:14:11 +0000 (09:14 +0000)] 
bpo-39270: Remove dead assignment from config_init_module_search_paths (GH-17914)

5 years agobpo-39272: Remove dead assignment from _ssl__SSLContext_load_verify_locations_impl...
Alex Henrie [Thu, 9 Jan 2020 09:12:12 +0000 (09:12 +0000)] 
bpo-39272: Remove dead assignment from _ssl__SSLContext_load_verify_locations_impl (GH-17916)

5 years agobpo-39271: Remove dead assignment from pattern_subx (GH-17915)
Alex Henrie [Thu, 9 Jan 2020 06:27:52 +0000 (06:27 +0000)] 
bpo-39271: Remove dead assignment from pattern_subx (GH-17915)

5 years agocloses bpo-39262: Use specific out-of-memory message in _sharedexception_bind. (GH...
Alex Henrie [Thu, 9 Jan 2020 02:48:52 +0000 (02:48 +0000)] 
closes bpo-39262: Use specific out-of-memory message in _sharedexception_bind. (GH-17908)

5 years agocloses bpo-39261: Remove dead assignment from pyinit_config. (GH-17907)
Alex Henrie [Thu, 9 Jan 2020 02:46:55 +0000 (02:46 +0000)] 
closes bpo-39261: Remove dead assignment from pyinit_config. (GH-17907)