Commit Graph

2303 Commits

Author SHA1 Message Date
Miss Islington (bot) d1d42bf4a4
bpo-37372: Fix error unpickling datetime.time objects from Python 2 with seconds>=24. (GH-14307)
(cherry picked from commit 122376df55)

Co-authored-by: Justin Blanchard <UncombedCoconut@gmail.com>
2019-08-29 00:56:04 -07:00
Serhiy Storchaka 097eae5b9b
[3.8] bpo-37950: Fix ast.dump() when call with incompletely initialized node. (GH-15510) (GH-15582)
(cherry picked from commit e64f948e76)
2019-08-29 10:50:28 +03:00
Miss Islington (bot) 38d311d79e bpo-36871: Ensure method signature is used when asserting mock calls to a method (GH15578)
* Fix call_matcher for mock when using methods

* Add NEWS entry

* Use None check and convert doctest to unittest

* Use better name for mock in tests. Handle _SpecState when the attribute was not accessed and add tests.

* Use reset_mock instead of reinitialization. Change inner class constructor signature for check

* Reword comment regarding call object lookup logic
(cherry picked from commit c96127821e)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-08-29 07:58:27 +01:00
Miss Islington (bot) f92bb6ed33
bpo-18049: Define THREAD_STACK_SIZE for AIX to pass default recursion limit test (GH-15081)
* Define THREAD_STACK_SIZE for AIX to pass default recursion limit test
(cherry picked from commit 9670ce76b8)

Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
2019-08-28 22:35:41 -07:00
Miss Islington (bot) 4adcaf8151 bpo-34775: Return NotImplemented in PurePath division. (GH-9509) (GH-15172)
(cherry picked from commit 4c69be22df)

Co-authored-by: aiudirog <aiudirog@gmail.com>
2019-08-29 01:05:59 -04:00
Miss Islington (bot) e471a543a4
bpo-18378: Recognize "UTF-8" as a valid name in locale._parse_localename (GH-14736)
(cherry picked from commit b0caf32981)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2019-08-28 21:56:00 -07:00
bsiem bd127b1b7d [3.8] bpo-37482: Fix email address name with encoded words and special chars (GH-14561) (GH-15380)
Special characters in email address header display names are normally
put within double quotes. However, encoded words (=?charset?x?...?=) are
not allowed withing double quotes. When the header contains a word with
special characters and another word that must be encoded, the first one
must also be encoded.

In the next example, the display name in the From header is quoted and
therefore the comma is allowed; in the To header, the comma is not
within quotes and not encoded, which is not allowed and therefore
rejected by some mail servers.

From: "Foo Bar, France" <foo@example.com>
To: Foo Bar, =?utf-8?q?Espa=C3=B1a?= <foo@example.com>

https://bugs.python.org/issue37482
(cherry picked from commit df0c21ff46)

Co-authored-by: bsiem <52461103+bsiem@users.noreply.github.com>
2019-08-29 00:47:15 -04:00
Miss Islington (bot) 23985c6a64 closes bpo-37965: Fix compiler warning of distutils CCompiler.test_function. (GH-15561)
https://bugs.python.org/issue37965

https://bugs.python.org/issue37965

Automerge-Triggered-By: @benjaminp
(cherry picked from commit 55aabee075)

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2019-08-28 10:32:34 -07:00
Miss Islington (bot) 2cb82d2a88 bpo-36582: Make collections.UserString.encode() return bytes, not str (GH-13138) (GH-15557)
(cherry picked from commit 2a16eea71f)

Co-authored-by: Daniel Fortunov <asqui@users.noreply.github.com>
2019-08-27 21:59:54 -07:00
Miss Islington (bot) 03c52f2f63
bpo-37951: Lift subprocess's fork() restriction (GH-15544)
(cherry picked from commit 98d90f745d)

Co-authored-by: Christian Heimes <christian@python.org>
2019-08-27 14:56:27 -07:00
Miss Islington (bot) 91020fade6
bpo-36205: Fix the rusage implementation of time.process_time() (GH-15538)
(cherry picked from commit 8bf5fef873)

Co-authored-by: vrajivk <3413293+vrajivk@users.noreply.github.com>
2019-08-26 21:34:32 -07:00
Steve Dower 04b750740b
bpo-37664: Update ensurepip bundled wheels, again (GH-15483) 2019-08-26 12:57:57 -07:00
Pablo Galindo 3769425abd
[3.8] bpo-37947: Adjust correctly the recursion level in symtable for named expressions (GH-15499) (GH-15515)
(cherry picked from commit 0e4ea16336)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-08-26 16:27:31 +01:00
Miss Islington (bot) 69d22b8fee
bpo-34679: Restore instantiation Windows IOCP event loop from non-main thread (GH-15492)
* Restore running proactor event loop from non-main thread

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 1c06009986)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-08-26 03:14:54 -07:00
Miss Islington (bot) 522a394a72 [3.8] bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant(). (GH-15490) (GH-15509)
It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
(cherry picked from commit c3ea41e9bf)
2019-08-26 10:43:33 +03:00
Miss Islington (bot) a3875171d7
bpo-37805: Add tests for json.dump(..., skipkeys=True) (GH-15489)
https://bugs.python.org/issue37805

Automerge-Triggered-By: @methane
(cherry picked from commit 44cd86bbdd)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-08-26 00:27:31 -07:00
Miss Islington (bot) 077887059a bpo-37824: Properly handle user input warnings in IDLE shell. (GH-15500)
Cease turning SyntaxWarnings into SyntaxErrors.
(cherry picked from commit 1039f39c9c)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-08-26 02:52:45 -04:00
Nick Coghlan 6ca030765d
[3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15491)
- drop TargetScopeError in favour of raising SyntaxError directly
  as per the updated PEP 572
- comprehension iteration variables are explicitly local, but
  named expression targets in comprehensions are nonlocal or
  global. Raise SyntaxError as specified in PEP 572
- named expression targets in the outermost iterable of a
  comprehension have an ambiguous target scope. Avoid resolving
  that question now by raising SyntaxError. PEP 572
  originally required this only for cases where the bound name
  conflicts with the iteration variable in the comprehension,
  but CPython can't easily restrict the exception to that case
  (as it doesn't know the target variable names when visiting
  the outermost iterator expression)

(cherry picked from commit 5dbe0f59b7)
2019-08-26 00:41:47 +10:00
Miss Islington (bot) e266d062e0
bpo-37929: IDLE: avoid Squeezer-related config dialog crashes (GH-15452)
These were caused by keeping around a reference to the Squeezer
instance and calling it's load_font() upon config changes, which
sometimes happened even if the shell window no longer existed.

This change completely removes that mechanism, instead having the
editor window properly update its width attribute, which can then
be used by Squeezer.
(cherry picked from commit d4b4c00b57)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-08-24 23:18:01 -07:00
Raymond Hettinger 21161d73d9
[3.8] bpo-37942: Improve argument clinic float converter (GH-15470) (GH-15480)
(cherry picked from commit aef9ad82f7)
2019-08-24 19:45:12 -07:00
Miss Islington (bot) bf99801cf7
Fix typo and rearrange words in IDLE news item (GH-15471)
Redo of GH-15402 by GeeTransit and Kyle Stanley.
(cherry picked from commit 0dfc025ccc)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-08-24 14:42:16 -07:00
Miss Islington (bot) d5a66bc56f bpo-37798: Test both Python and C versions in test_statistics.py (GH-15453) (GH-15467)
(cherry picked from commit 8ad22a4226)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-08-24 11:14:20 -07:00
Miss Islington (bot) c410f381bf bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170) (#15461)
* fix Path._add_implied_dirs to include all implied directories

* fix Path._add_implied_dirs to include all implied directories

* Optimize code by using sets instead of lists

* 📜🤖 Added by blurb_it.

* fix Path._add_implied_dirs to include all implied directories

* Optimize code by using sets instead of lists

* 📜🤖 Added by blurb_it.

* Add tests to zipfile.Path.iterdir() fix

* Update test for zipfile.Path.iterdir()

* remove whitespace from test file

* Rewrite NEWS blurb to describe the user-facing impact and avoid implementation details.

* remove redundant [] within set comprehension

* Update to use unique_everseen to maintain order and other suggestions in review

* remove whitespace and add back add_dirs in tests

* Add new standalone function parents using posixpath to get parents of a directory

* removing whitespace (sorry)

* Remove import pathlib from zipfile.py

* Rewrite _parents as a slice on a generator of the ancestry of a path.

* Remove check for '.' and '/', now that parents no longer returns those.

* Separate calculation of implied dirs from adding those

* Re-use _implied_dirs in tests for generating zipfile with dir entries.

* Replace three fixtures (abcde, abcdef, abde) with one representative example alpharep.

* Simplify implementation of _implied_dirs by collapsing the generation of parent directories for each name.
(cherry picked from commit a4e2991bdc)

Co-authored-by: shireenrao <shireenrao@gmail.com>
2019-08-24 12:03:52 -04:00
Serhiy Storchaka ed146b52a3
[3.8] bpo-37830: Fix compilation of break and continue in finally. (GH-15320) (GH-15456)
Fix compilation of "break" and "continue" in the
"finally" block when the corresponding "try" block
contains "return" with a non-constant value.
(cherry picked from commit ef61c524dd)
2019-08-24 13:41:53 +03:00
Miss Islington (bot) 920ec4b776
bpo-28269: Replace strcasecmp with system function _stricmp. (GH-13095)
(cherry picked from commit 05f2d84cae)

Co-authored-by: Minmin Gong <gongminmin@msn.com>
2019-08-24 03:22:14 -07:00
Miss Islington (bot) 5779c53632 bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266) (GH-15441)
(cherry picked from commit 0a18ee4be7)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-08-23 15:39:27 -07:00
Victor Stinner af84a88ef8
bpo-36763: PyConfig_Read() handles PySys_AddXOption() (GH-15431) (GH-15435)
PyConfig_Read() is now responsible to handle early calls to
PySys_AddXOption() and PySys_AddWarnOption().

Options added by PySys_AddXOption() are now handled the same way than
PyConfig.xoptions and command line -X options.

For example, PySys_AddXOption(L"faulthandler") enables faulthandler
as expected.

(cherry picked from commit 120b707a6d)
2019-08-23 21:16:51 +02:00
Miss Islington (bot) 3921d12174
bpo-37549: os.dup() fails for standard streams on Windows 7 (GH-15389)
(cherry picked from commit 5be666010e)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-08-23 12:04:27 -07:00
Miss Islington (bot) 761e5a7c7f bpo-26589: Add http status code 451 (GH-15413) (GH-15436)
(cherry picked from commit 8f080b0995)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-23 10:56:44 -07:00
GeeTransit fe64ba611b [3.8] Fix typo (inifite -> infinite) (GH-15429)
The same typo exists in the changelogs of 3.6 and 3.7.

Automerge-Triggered-By: @Mariatta
2019-08-23 09:23:43 -07:00
Victor Stinner ca9ae94a2a
bpo-37926: Fix PySys_SetArgvEx(0, NULL, 0) crash (GH-15415) (GH-15420)
empty_argv is no longer static in Python 3.8, but it is declared in
a temporary scope, whereas argv keeps a reference to it.
empty_argv memory (allocated on the stack) is reused by
make_sys_argv() code which is inlined when using gcc -O3.

Define empty_argv in PySys_SetArgvEx() body, to ensure
that it remains valid for the whole lifetime of
the PySys_SetArgvEx() call.

(cherry picked from commit c48682509d)
2019-08-23 12:22:14 +01:00
Miss Islington (bot) 5c77730300
bpo-37915: Fix comparison between tzinfo objects and timezone objects (GH-15390)
https://bugs.python.org/issue37915

Automerge-Triggered-By: @pablogsal
(cherry picked from commit 4be11c009a)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-08-23 01:48:40 -07:00
Miss Islington (bot) f93c15aedc
bpo-36311: Fixes decoding multibyte characters around chunk boundaries and improves decoding performance (GH-15083)
(cherry picked from commit 7ebdda0dbe)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-08-21 16:53:56 -07:00
Steve Dower 9eb3d54639
bpo-37834: Normalise handling of reparse points on Windows (GH-15370)
bpo-37834: Normalise handling of reparse points on Windows
* ntpath.realpath() and nt.stat() will traverse all supported reparse points (previously was mixed)
* nt.lstat() will let the OS traverse reparse points that are not name surrogates (previously would not traverse any reparse point)
* nt.[l]stat() will only set S_IFLNK for symlinks (previous behaviour)
* nt.readlink() will read destinations for symlinks and junction points only

bpo-1311: os.path.exists('nul') now returns True on Windows
* nt.stat('nul').st_mode is now S_IFCHR (previously was an error)
2019-08-21 15:52:42 -07:00
Miss Islington (bot) c30c869e8d
bpo-9949: Enable symlink traversal for ntpath.realpath (GH-15287)
(cherry picked from commit 75e064962e)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-08-21 14:09:33 -07:00
Miss Islington (bot) 7e293f5e4c
Fix difflib `?` hint in diff output when dealing with tabs (GH-15201)
(cherry picked from commit e1c638da6a)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2019-08-21 12:18:26 -07:00
Miss Islington (bot) 1271ee8187
bpo-37868: Improve is_dataclass for instances. (GH-15325)
(cherry picked from commit b0f4dab873)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2019-08-19 22:59:21 -07:00
Miss Islington (bot) 786a4e1cef
bpo-36266: Add module name in ImportError when DLL not found on Windows (GH-15180)
(cherry picked from commit 24fe46081b)

Co-authored-by: shireenrao <shireenrao@gmail.com>
2019-08-17 14:11:28 -07:00
Miss Islington (bot) f991912146
bpo-37256: Wording in Request class docs (GH-14792)
* bpo-37256: Wording in Request class docs

* 📜🤖 Added by blurb_it.

* Update Misc/NEWS.d/next/Documentation/2019-07-16-14-48-12.bpo-37256.qJTrBb.rst

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 38c7199beb)

Co-authored-by: Ngalim Siregar <ngalim.siregar@gmail.com>
2019-08-16 01:27:35 -07:00
Paul Ganssle 27b38b99b3
bpo-37642: Update acceptable offsets in timezone (GH-14878) (#15227)
This fixes an inconsistency between the Python and C implementations of
the datetime module. The pure python version of the code was not
accepting offsets greater than 23:59 but less than 24:00. This is an
accidental legacy of the original implementation, which was put in place
before tzinfo allowed sub-minute time zone offsets.

GH-14878

(cherry picked from commit 92c7e30adf)
2019-08-15 15:08:57 -04:00
Miss Islington (bot) b8e682427a
bpo-21131: Fix faulthandler.register(chain=True) stack (GH-15276)
faulthandler now allocates a dedicated stack of SIGSTKSZ*2 bytes,
instead of just SIGSTKSZ bytes. Calling the previous signal handler
in faulthandler signal handler uses more than SIGSTKSZ bytes of stack
memory on some platforms.
(cherry picked from commit ac827edc49)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-08-14 15:02:12 -07:00
Miss Islington (bot) 123f6c4914
bpo-37811: FreeBSD, OSX: fix poll(2) usage in sockets module (GH-15202)
FreeBSD implementation of poll(2) restricts the timeout argument to be
either zero, or positive, or equal to INFTIM (-1).

Unless otherwise overridden, socket timeout defaults to -1. This value
is then converted to milliseconds (-1000) and used as argument to the
poll syscall. poll returns EINVAL (22), and the connection fails.

This bug was discovered during the EINTR handling testing, and the
reproduction code can be found in
https://bugs.python.org/issue23618 (see connect_eintr.py,
attached). On GNU/Linux, the example runs as expected.

This change is trivial:
If the supplied timeout value is negative, truncate it to -1.
(cherry picked from commit 2814620657)

Co-authored-by: Artem Khramov <akhramov@pm.me>
2019-08-14 14:47:43 -07:00
Miss Islington (bot) 557802dc17
bpo-37849: IDLE: fix completion window positioning above line (GH-15267)
(cherry picked from commit 71662dc2f1)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-08-14 10:24:04 -07:00
Victor Stinner d85c5670ff
[3.8] bpo-37531: Fix regrtest timeout for subprocesses (GH-15072) (GH-15279)
* bpo-37531: Fix regrtest timeout for subprocesses (GH-15072)

Co-Authored-By: Joannah Nanjekye <joannah.nanjekye@ibm.com>
(cherry picked from commit b0c8369c60)

* bpo-36511: Fix failures in Windows ARM32 buildbot (GH-15181)

(cherry picked from commit ed70a344b5)

Backport also minor fixes from master (fix typo, remove importlib import).
2019-08-14 16:31:32 +02:00
Miss Islington (bot) 984226962b
bpo-37738: Fix curses addch(str, color_pair) (GH-15071)
Fix the implementation of curses addch(str, color_pair): pass the
color pair to setcchar(), instead of always passing 0 as the color
pair.
(cherry picked from commit 077af8c2c9)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-08-14 03:49:13 -07:00
Miss Islington (bot) 7f7f74734a
bpo-25172: Raise appropriate ImportError msg when crypt module used on Windows (GH-15149)
(cherry picked from commit f4e725f224)

Co-authored-by: shireenrao <shireenrao@gmail.com>
2019-08-13 14:27:14 -07:00
Miss Islington (bot) 0c64b57e01 [3.8] bpo-37354: Make Powershell Activate.ps1 script static to allow for signing (GH-14967)
- Remove use of replacement text in the script
- Make use of the pyvenv.cfg file for prompt value.
- Add parameters to allow more flexibility
- Make use of the current path, and assumptions about where env puts things, to compensate
- Make the script a bit more 'idiomatic' Powershell
- Add script documentation (Get-Help .\.venv\Scripts\Activate.ps1 shows PS help page now
(cherry picked from commit 732775d6be)

Co-authored-by: Derek Keeler <d3r3kk@users.noreply.github.com>
2019-08-12 14:09:26 -07:00
Miss Islington (bot) 5ba1cb0393 bpo-37819: Add Fraction.as_integer_ratio() (GH-15212) (GH-15215)
(cherry picked from commit f03b4c8a48)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-11 15:02:23 -07:00
Miss Islington (bot) 9500bbe937
bpo-32178: Fix IndexError trying to parse 'To' header starting with ':'. (GH-15044)
This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.

https://bugs.python.org/issue32178
(cherry picked from commit 09a1872a80)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
2019-08-11 14:04:31 -07:00
Serhiy Storchaka 4c5b6bac24 [3.8] bpo-32912: Revert SyntaxWarning on invalid escape sequences (GH-15142)
* bpo-32912: Revert warnings for invalid escape sequences.

DeprecationWarning will continue to be emitted for invalid escape sequences in string and bytes literals in 3.8 just as it did in 3.7.

SyntaxWarning may be emitted in the future. But per mailing list discussion, we don't yet know when because we haven't settled on how to do so in a non-disruptive manner.
2019-08-09 15:34:22 -07:00
Miss Islington (bot) 217077440a
bpo-34155: Dont parse domains containing @ (GH-13079)
Before:

        >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses
        (Address(display_name='', username='a', domain='malicious.org'),)

        >>> parseaddr('a@malicious.org@important.com')
        ('', 'a@malicious.org')

    After:

        >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses
        (Address(display_name='', username='', domain=''),)

        >>> parseaddr('a@malicious.org@important.com')
        ('', 'a@')

https://bugs.python.org/issue34155
(cherry picked from commit 8cb65d1381)

Co-authored-by: jpic <jpic@users.noreply.github.com>
2019-08-09 01:31:27 -07:00
Miss Islington (bot) dc6653fd06
bpo-37778: Fixes the icons used for file associations to the Microsoft Store package (GH-15150)
(cherry picked from commit 87ce9588ce)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-08-07 11:15:15 -07:00
Miss Islington (bot) eab76c3c75
bpo-37734: Fix use of registry values to launch Python from Microsoft Store app (GH-15146)
(cherry picked from commit 1fab9cbfba)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-08-07 11:07:43 -07:00
Miss Islington (bot) 1a3a40c1cb bpo-37004: Documented asymmetry of string arguments in difflib.SequenceMatcher for ratio method (GH-13482) (#15157)
https://bugs.python.org/issue37004
(cherry picked from commit e9cbcd0018)

Co-authored-by: sweeneyde <36520290+sweeneyde@users.noreply.github.com>
2019-08-07 11:39:14 -04:00
Miss Islington (bot) 26f91db5ba bpo-37759: First round of major edits to Whatsnew 3.8 (GH-15127) (GH-15139)
(cherry picked from commit 4f9ffc9d1a)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-05 15:22:13 -07:00
Miss Islington (bot) 5349f8cd78
bpo-36419: IDLE - Refactor autocompete and improve testing. (GH-15121)
(cherry picked from commit 1213123005)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-08-04 17:08:16 -07:00
Miss Islington (bot) 9c95fc752c
bpo-37748: Re-order the Run menu. (GH-15115)
Put the most common choice, Run Module, at the top.
(cherry picked from commit 14070299cd)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-08-04 14:04:49 -07:00
Miss Islington (bot) 0c16f6b307 bpo-28292: Mark calendar.py helper functions as private. (GH-15113) (GH-15116)
(cherry picked from commit b1c8ec010f)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-04 13:34:56 -07:00
Miss Islington (bot) dde944f9df
bpo-37685: Fixed comparisons of datetime.timedelta and datetime.timezone. (GH-14996)
There was a discrepancy between the Python and C implementations.

Add singletons ALWAYS_EQ, LARGEST and SMALLEST in test.support
to test mixed type comparison.
(cherry picked from commit 17e52649c0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-08-04 03:01:55 -07:00
Miss Islington (bot) 79af3bd1d1
bpo-20523: pdb searches for .pdbrc in ~ instead of $HOME (GH-11847)
Previously pdb checked the $HOME environmental variable
to find the user .pdbrc. If $HOME is not set, the user
.pdbrc would not be found.

Change pdb to use `os.path.expanduser('~')` to determine
the user's home directory. Thus, if $HOME is not set (as
in tox or on Windows), os.path.expanduser('~') falls
back on other techniques for locating the user's home
directory.

This follows pip's implementation for loading .piprc.

Co-authored-by: Dan Lidral-Porter <dlp@aperiodic.org>
(cherry picked from commit 7ea9a85f13)

Co-authored-by: Timothy Hopper <tdhopper@users.noreply.github.com>
2019-08-02 15:42:50 -07:00
Miss Islington (bot) 375f35be06 bpo-36487: Make C-API docs clear about what the main interpreter is. (gh-15080)
(cherry picked from commit 854d0a4b98) (gh-12666)

Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
2019-08-02 11:49:38 -06:00
Miss Islington (bot) 1cc70322c9
bpo-16970: Adding error message for invalid args (GH-14844)
BPO -16970: Adding error message for invalid args

Applied the patch argparse-v2 patch issue 16970, ran patch check and the test suite, test_argparse with 0 errors

https://bugs.python.org/issue16970
(cherry picked from commit 4b3e975923)

Co-authored-by: tmblweed <tmblweed@users.noreply.github.com>
2019-08-01 22:16:44 -07:00
Miss Islington (bot) 8399641c34
bpo-18049: Sync thread stack size to main thread size on macOS (GH-14748)
This changeset increases the default size of the stack
for threads on macOS to the size of the stack
of the main thread and reenables the relevant
recursion test.
(cherry picked from commit 1a057bab0f)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2019-08-01 07:38:57 -07:00
Miss Islington (bot) dcc53ebbff bpo-37726: Prefer argparse over getopt in stdlib tutorial (GH-15052) (#15070)
(cherry picked from commit 2491134029)

Co-authored-by: mental <m3nta1@yahoo.com>
2019-08-01 07:34:57 -07:00
Miss Islington (bot) 462f07040b
bpo-37695: Correct unget_wch error message. (GH-14986)
(cherry picked from commit c9345e382c)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2019-07-31 13:44:59 -07:00
Miss Islington (bot) 77fcccb532
bpo-37723: Fix performance regression on regular expression parsing. (GH-15030)
Improve performance of sre_parse._uniq function.
(cherry picked from commit 9f55551f3d)

Co-authored-by: yannvgn <hi@yannvgn.io>
2019-07-31 13:22:09 -07:00
Miss Islington (bot) d8b914a30b
bpo-37085: Expose SocketCAN bcm_msg_head flags (GH-13646)
Expose the CAN_BCM SocketCAN constants used in the bcm_msg_head struct
flags (provided by <linux/can/bcm.h>) under the socket library.

This adds the following constants with a CAN_BCM prefix:

  * SETTIMER
  * STARTTIMER
  * TX_COUNTEVT
  * TX_ANNOUNCE
  * TX_CP_CAN_ID
  * RX_FILTER_ID
  * RX_CHECK_DLC
  * RX_NO_AUTOTIMER
  * RX_ANNOUNCE_RESUME
  * TX_RESET_MULTI_IDX
  * RX_RTR_FRAME
  * CAN_FD_FRAME

The CAN_FD_FRAME flag was introduced in the 4.8 kernel, while the other
ones were present since SocketCAN drivers were mainlined in 2.6.25. As
such, it is probably unnecessary to guard against these constants being
missing.
(cherry picked from commit 31c4fd2a10)

Co-authored-by: karl ding <karlding@users.noreply.github.com>
2019-07-31 02:10:38 -07:00
Miss Islington (bot) 8194a2050d
IDLE: changelog correction and addition (GH-15042)
(cherry picked from commit d04f8907ba)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-30 22:42:17 -07:00
Miss Islington (bot) 382cb85401 bpo-37707: Exclude expensive unit tests from PGO task (GH-15009) (#15024)
Mark some individual tests to skip when --pgo is used.  The tests
marked increase the PGO task time significantly and likely don't
help improve optimization of the final executable.
(cherry picked from commit 52a48e62c6)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2019-07-30 11:34:32 -07:00
Miss Islington (bot) 9265a87742
bpo-37587: Make json.loads faster for long strings (GH-14752)
When scanning the string, most characters are valid, so
checking for invalid characters first means never needing
to check the value of strict on valid strings, and only
needing to check it on invalid characters when doing
non-strict parsing of invalid strings.

This provides a measurable reduction in per-character
processing time (~11% in the pre-merge patch testing).
(cherry picked from commit 8a758f5b99)

Co-authored-by: Marco Paolini <mpaolini@users.noreply.github.com>
2019-07-30 07:37:28 -07:00
Łukasz Langa 6f53a6824b Python 3.8.0b3
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl0+9AAACgkQsmmV4xAl
 BWjXqg//aKCwPmf0ZE8ZsW6Qlikrn/fovyiA37Uw3Lp7byI8AWpmjTGyDfbbOWvG
 VlifRgMTjdo4z4CrDBMumzDvQhud8/3ok1H/JpCo8Lwb/wEwOxmAQ8qZAtCo5oyA
 5yW/QyFkclsW/t7OAXSFvqkk0F6BzAvbMuaWwwzdfQP+MCTSrkrG3S29JJvBQ2VU
 DPZtfZ2RIkJo9pyI77OCsxILNVTtxLoD8EsqFEvEAanjDNqGSbyD7gxRSg5s27z7
 Tc7qw573oAYVRBb1GuYzeI7AhwwanH4JudUleROBvq3APgYNch6ROBcqlxLdGbvo
 c/hhXJAtCcrjxGLPllGgwfUboJe2ftw8Ory4uvkyAiaW5+3/17iETxXul0uFx0Mc
 dWRjXl47EYsyCkvNA8qckB/VGPunRbW6k4LEKiBWtig9SXmzRqoLYKiCETx0xdfK
 mP/8bX+LP1PG1ti2sYrUr6znRbVBL4u3e1yixQeqNZdzDN9PQykdW34svxxXBHOK
 hvQoGRB4L6zhbnrk2bsSUbAK1P+Ohl9oeNo6c7TNAxzxOeZcQ+CYBUY8aKCR8v5z
 c49YHT33bheaPAa5Sa4f1eVl/W0w6Pu5vT/r7g4ayvnS3f/Bz3+0Zk9FKy5NzJcl
 0yZ7gbsjVkJWbBFanZ0jRs5vgYefjacR7i/sE3Ha79s1950NZdI=
 =Azjr
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl0/XNcQHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaMIrD/wLevGsmaVYOXngPZagB+iJA6Xexe+hhaNF
 /+zdiRevPA3z1zXbF2rJ7BmrJsL5AwvgZMDutj6Wdpg2//AwNly5XcrvbPCtrrPR
 qM6XFpgVGOsAM74E4VAr0a3OgHQJIgUMCYkqZ9EqWdEKHyk9tHeOUcxFlQgvd3Nn
 93jj5B8BuynkLEcgXJ5hxbn8dB7fC5gUNloQ+zcqdOgqvo3S4JZ2VCjvEaZlUprC
 pbhaRGzAbu6hUT6gbGUOB6qNBDfiZdSybps8AYpzYqj/+WKUWc5Cojr7N/KCeGRG
 9K+zH2WOzcD0UFLeXJmuAUL3rUtUjYtix/rLlpDY1p8VOkzfIR4F2iKnjtmNmTB9
 WnBDcpy0ITJF+meBhBX3xkfzzY9chj6AgEHZ/iXYhtIrZYTgIey/oyUyFNbZvsaO
 8BVkNoaa4DQFBVfz9bzIn/CVKS+cjrrv+4hxArqvlTpvqr5ueqYfRP2dXRHwYzum
 WczP3t2cq8GUj5MeEbHaRQV/JTY2CNtENazKG2OPCwsBNCfDxJ3DbSTpxJWSzz4P
 AnmhjLng7LAPsS8FZ4KuAmOKKlCbpgiVcZcYJdD+RUUtQufZLz7WOaRA0s8YnwjM
 7mhOHGIfUPZZFFLXDt3BefiwEVb5d16JWw6nKXItIpL4IJc8j2Q64ki9WbRZGH/m
 Oh32VYhYzw==
 =C154
 -----END PGP SIGNATURE-----

Merge tag 'v3.8.0b3' into 3.8

Python 3.8.0b3
2019-07-29 22:53:25 +02:00
Miss Islington (bot) cf52bd0b9b
Fix `SyntaxError` indicator printing too many spaces for multi-line strings (GH-14433)
(cherry picked from commit 5b94f3578c)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2019-07-29 07:18:47 -07:00
Łukasz Langa 4336222407
Python 3.8.0b3 2019-07-29 15:26:01 +02:00
Miss Islington (bot) f96334c179 bpo-37697: Sync with importlib_metadata 0.19 (GH-14993) (GH-14995)
* bpo-37697: Sync with importlib_metadata 0.19

* Run make regen-importlib

* 📜🤖 Added by blurb_it.
(cherry picked from commit 049460da9c)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-07-28 15:45:46 -04:00
Miss Islington (bot) c94386d013
bpo-37692: Improve highlight config sample (GH-14983)
Use an example shell interaction in the sample and better labels for shell elements.
(cherry picked from commit b222955355)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-28 09:39:03 -07:00
Miss Islington (bot) 76821bab9c bpo-37691: Let math.dist() accept sequences and iterables for coordinates (GH-14975) (GH-14984)
(cherry picked from commit 6b5f1b496f)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-07-27 14:26:58 -07:00
Miss Islington (bot) 171019354a
bpo-37628: Fix IDLE config sample sizes (GH-14958)
The boxes for the font and highlight samples are now constrained by the overall config dialog size.  They gain scrollbars when the when a large font size makes the samples too large for the box.
(cherry picked from commit 3221a63c69)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-07-27 10:19:12 -07:00
Miss Islington (bot) 06e8fc95d1
bpo-32910: Remove implementation detail in venv documentation. (GH-14968)
(cherry picked from commit 91e4957509)

Co-authored-by: Derek Keeler <d3r3kk@users.noreply.github.com>
2019-07-26 15:04:28 -07:00
Miss Islington (bot) 25cb4fd4fb
bpo-37502: handle default parameter for buffers argument of pickle.loads correctly (GH-14593)
(cherry picked from commit 898318b53d)

Co-authored-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2019-07-25 09:18:20 -07:00
Miss Islington (bot) 69802f6163
closes bpo-37675: Use pkgutil.iter_modules to find fixers in a package rather than listdir. (14942)
(cherry picked from commit 93e8aa62cf)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-07-24 17:00:39 -07:00
Miss Islington (bot) 4b7ce105ff
bpo-37672: Switch Windows Store package to use pip.ini for user mode (GH-14939)
(cherry picked from commit 123536fdab)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-07-24 15:31:48 -07:00
Miss Islington (bot) 0cdb21d6eb
bpo-37664: Update bundled pip to 19.2.1 and setuptools to 41.0.1 (GH-14934)
(cherry picked from commit 5380def826)

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2019-07-24 12:28:12 -07:00
Miss Islington (bot) 1da6a313dd
bpo-17535: IDLE editor line numbers (GH-14030)
(cherry picked from commit 7123ea009b)

Co-authored-by: Tal Einat <taleinat@gmail.com>
2019-07-23 06:04:13 -07:00
Jeroen Demeyer bf8e82f976 [3.8] bpo-36974: separate vectorcall functions for each calling convention (GH-13781) (#14782) 2019-07-23 12:39:51 +02:00
Miss Islington (bot) 2406672984
bpo-36044: Reduce number of unit tests run for PGO build (GH-14702)
Reduce the number of unit tests run for the PGO generation task.  This
speeds up the task by a factor of about 15x.  Running the full unit test
suite is slow.  This change may result in a slightly less optimized build
since not as many code branches will be executed.  If you are willing to
wait for the much slower build, the old behavior can be restored using
'./configure [..] PROFILE_TASK="-m test --pgo-extended"'.  We make no
guarantees as to which PGO task set produces a faster build.  Users who
care should run their own relevant benchmarks as results can depend on
the environment, workload, and compiler tool chain.
(cherry picked from commit 4e16a4a311)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2019-07-22 13:17:23 -07:00
Miss Islington (bot) 22fd679dc3 bpo-21478: Record calls to parent when autospecced objects are used as child with attach_mock (GH 14688) (GH-14902)
* Clear name and parent of mock in autospecced objects used with attach_mock

* Add NEWS entry

* Fix reversed order of comparison

* Test child and standalone function calls

* Use a helper function extracting mock to avoid code duplication and refactor tests.
(cherry picked from commit 7397cda997)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-07-22 08:59:00 +01:00
Kyle Stanley 24b5b360fa [3.8] Fix typos in docs, comments and test assert messages (GH-14872). (#14900)
(cherry picked from commit 96e12d5f4f)

Co-authored-by: Min ho Kim <minho42@gmail.com>
2019-07-21 22:48:45 -04:00
Miss Islington (bot) 9325f4091b
bpo-37627: Initialize IDLE Custom Run dialog with previous entries (GH-14870)
Repeat the command line arguments most recently entered before so the user can edit them.
(cherry picked from commit 35b87e6001)

Co-authored-by: Ngalim Siregar <ngalim.siregar@gmail.com>
2019-07-21 13:25:43 -07:00
Miss Islington (bot) c613c3319e bpo-36324: Make internal attributes for statistics.NormalDist() private. (GH-14871) (GH-14875) 2019-07-21 00:55:13 -07:00
Miss Islington (bot) 86eb5daaf3 bpo-33610: IDLE's code-context always shows current context immediately (GH-14821) (#14846)
Eliminate delay of up to 100ms and accompanying visual artifact.
Fix bug of never showing context when hide and show.
(cherry picked from commit e0a1f8fb5c)

Co-authored-by: Tal Einat <taleinat@gmail.com>
2019-07-18 16:47:26 -04:00
Miss Islington (bot) 028f1d2479 bpo-36390: Gather IDLE Format menu functions into format.py (GH-14827) (GH-14829)
Add two indent spec methods from editor and Rstrip to existing file.
Tests are not added for indent methods because they need change
in lights of 3.x's prohibition on mixing tabs and spaces.
(cherry picked from commit 1b38922434)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-17 21:21:08 -04:00
Miss Islington (bot) 635743355d
Fix IndexError when parsing unexpectedly ending quoted-string. (GH-14813)
This exception was caused because the input ended unexpectedly with only one
single quote instead of a pair with some value inside it.
(cherry picked from commit 719a062bcb)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
2019-07-17 10:29:18 -07:00
Miss Islington (bot) 6816ca30af
bpo-37461: Fix infinite loop in parsing of specially crafted email headers (GH-14794)
* bpo-37461: Fix infinite loop in parsing of specially crafted email headers.

Some crafted email header would cause the get_parameter method to run in an
infinite loop causing a DoS attack surface when parsing those headers. This
patch fixes that by making sure the DQUOTE character is handled to prevent
going into an infinite loop.
(cherry picked from commit a4a994bd3e)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
2019-07-17 10:13:54 -07:00
Miss Islington (bot) 1fc43a3faf bpo-36390: IDLE: Combine region formatting methods. (GH-12481) (GH-14811)
Rename paragraph.py to format.py and add region formatting methods
from editor.py.  Add tests for the latter.
(cherry picked from commit 82494aa6d9)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2019-07-17 10:45:20 -04:00
Miss Islington (bot) 6cf7c45cb5
bpo-37530: simplify, optimize and clean up IDLE code context (GH-14675)
* Only create CodeContext instances for "real" editors windows, but
  not e.g. shell or output windows.
* Remove configuration update Tk event fired every second, by having
  the editor window ask its code context widget to update when
  necessary, i.e. upon font or highlighting updates.
* When code context isn't being shown, avoid having a Tk event fired
  every 100ms to check whether the code context needs to be updated.
* Use the editor window's getlineno() method where applicable.
* Update font of the code context widget before the main text widget
(cherry picked from commit 7036e1de3a)

Co-authored-by: Tal Einat <taleinat@gmail.com>
2019-07-17 01:44:55 -07:00
Miss Islington (bot) 178f09f8b7 bpo-27452: IDLE: Cleanup config.py code (GH-14577) (GH-14802)
(cherry picked from commit f8d4cc7dbb)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2019-07-16 17:19:10 -04:00
Miss Islington (bot) 6a2aec0ff5
Fix infinite loop in email folding logic (GH-12732)
As far as I can tell, this infinite loop would be triggered if:

1. The value being folded contains a single word (no spaces) longer than
   max_line_length
2. The max_line_length is shorter than the encoding's name + 9
   characters.

bpo-36564: https://bugs.python.org/issue36564
(cherry picked from commit f69d5c6198)

Co-authored-by: Paul Ganssle <pganssle@users.noreply.github.com>
2019-07-16 11:08:36 -07:00
Miss Islington (bot) 1ff4c42774
bpo-37284: Add note to sys.implementation doc (GH-14328)
Add a brief note to indicate that any new required attributes must go through the PEP process.

https://bugs.python.org/issue37284
(cherry picked from commit 52693c10e8)

Co-authored-by: Giovanni Cappellotto <gcappellotto@fb.com>
2019-07-15 07:45:12 -07:00
Miss Islington (bot) cf9a63c6c7
bpo-37593: Swap the positions of posonlyargs and args in the constructor of ast.parameters nodes (GH-14778)
https://bugs.python.org/issue37593
(cherry picked from commit cd6e83b481)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-07-14 16:49:52 -07:00
Miss Islington (bot) b1e4d1b603 bpo-26967: fix flag grouping with allow_abbrev=False (GH-14316) (GH-14759)
The `allow_abbrev` option for ArgumentParser is documented and intended to disable support for unique prefixes of --options, which may sometimes be ambiguous due to deferred parsing.

However, the initial implementation also broke parsing of grouped short flags, such as `-ab` meaning `-a -b` (or `-a=b`).  Checking the argument for a leading `--` before rejecting it fixes this.

This was prompted by pytest-dev/pytestGH-5469, so a backport to at least 3.8 would be great 😄
And this is my first PR to CPython, so please let me know if I've missed anything!

https://bugs.python.org/issue26967
(cherry picked from commit dffca9e925)

Co-authored-by: Zac Hatfield-Dodds <Zac-HD@users.noreply.github.com>
2019-07-14 07:59:56 +02:00