Commit Graph

44857 Commits

Author SHA1 Message Date
Steve Dower 374be59b8e
bpo-37834: Fix test on Windows 7 (GH-15377) 2019-08-21 17:42:56 -07:00
Steve Dower 06be2c7f35
bpo-9949: Call normpath() in realpath() and avoid unnecessary prefixes (GH-15369) 2019-08-21 16:45:02 -07:00
Steve Dower 7ebdda0dbe
bpo-36311: Fixes decoding multibyte characters around chunk boundaries and improves decoding performance (GH-15083) 2019-08-21 16:22:33 -07:00
bsiem df0c21ff46 bpo-37482: Fix email address name with encoded words and special chars (GH-14561)
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
2019-08-21 16:00:39 -07:00
Brett Cannon 48ede6b8f6
bpo-37663: have venv activation scripts all consistently use __VENV_PROMPT__ for prompt customization (GH-14941)
The activation scripts generated by venv were inconsistent in how they changed the shell's prompt. Some used `__VENV_PROMPT__` exclusively, some used `__VENV_PROMPT__` if it was set even though by default `__VENV_PROMPT__` is always set and the fallback matched the default, and one ignored `__VENV_PROMPT__` and used `__VENV_NAME__` instead (and even used a differing format to the default prompt). This change now has all activation scripts use `__VENV_PROMPT__` only and relies on the fact that venv sets that value by default.

The color of the customization is also now set in fish to the blue from the Python logo for as hex color support is built into that shell (much like PowerShell where the built-in green color is used).
2019-08-21 15:58:01 -07:00
Steve Dower df2d4a6f3d
bpo-37834: Normalise handling of reparse points on Windows (GH-15231)
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:27:33 -07:00
Steve Dower 75e064962e
bpo-9949: Enable symlink traversal for ntpath.realpath (GH-15287) 2019-08-21 13:43:06 -07:00
Anthony Sottile e1c638da6a Fix difflib `?` hint in diff output when dealing with tabs (#15201) 2019-08-21 13:59:25 -05:00
Victor Stinner de2d9eed8b
bpo-37531: Enhance regrtest multiprocess timeout (GH-15345)
* Write a message when killing a worker process
* Put a timeout on the second popen.communicate() call
  (after killing the process)
* Put a timeout on popen.wait() call
* Catch popen.kill() and popen.wait() exceptions
2019-08-21 10:59:20 +01:00
Greg Price 9ece4a5057 Unmark files as executable that can't actually be executed. (GH-15353)
There are plenty of legitimate scripts in the tree that begin with a
`#!`, but also a few that seem to be marked executable by mistake.

Found them with this command -- it gets executable files known to Git,
filters to the ones that don't start with a `#!`, and then unmarks
them as executable:

    $ git ls-files --stage \
      | perl -lane 'print $F[3] if (!/^100644/)' \
      | while read f; do
          head -c2 "$f" | grep -qxF '#!' \
          || chmod a-x "$f"; \
        done

Looking at the list by hand confirms that we didn't sweep up any
files that should have the executable bit after all.  In particular

 * The `.psd` files are images from Photoshop.

 * The `.bat` files sure look like things that can be run.
   But we have lots of other `.bat` files, and they don't have
   this bit set, so it must not be needed for them.



Automerge-Triggered-By: @benjaminp
2019-08-20 21:53:59 -07:00
Greg Price 5b95a1507e bpo-35518: Skip test that relies on a deceased network service. (GH-15349)
If this service had thoroughly vanished, we could just ignore the
test until someone gets around to either recreating such a service
or redesigning the test to somehow work locally.  The
`support.transient_internet` mechanism catches the failure to
resolve the domain name, and skips the test.

But in fact the domain snakebite.net does still exist, as do its
nameservers -- and they can be quite slow to reply.  As a result
this test can easily take 20-30s before it gets auto-skipped.

So, skip the test explicitly up front.
2019-08-20 20:50:50 -07:00
Zackery Spytz 46a7564578 bpo-32793: Fix a duplicate debug message in smtplib (GH-15341)
_get_socket() already prints a debug message for the host and port.



https://bugs.python.org/issue32793



Automerge-Triggered-By: @maxking
2019-08-20 10:52:25 -07:00
Joannah Nanjekye 9e66aba999 bpo-15913: Implement PyBuffer_SizeFromFormat() (GH-13873)
Implement PyBuffer_SizeFromFormat() function (previously
documented but not implemented): call struct.calcsize().
2019-08-20 15:46:36 +01:00
Eric V. Smith b0f4dab873
bpo-37868: Improve is_dataclass for instances. (GH-15325) 2019-08-20 01:40:28 -04:00
Victor Stinner d11c2c6077
Revert "bpo-37788: Fix a reference leak if a thread is not joined (GH-15228)" (GH-15338)
This reverts commit d3dcc92778.
2019-08-20 00:47:07 +01:00
Victor Stinner d3dcc92778
bpo-37788: Fix a reference leak if a thread is not joined (GH-15228)
Add threading.Thread.__del__() method to ensure that the thread state
lock is removed from the _shutdown_locks list when a thread
completes.
2019-08-19 23:37:17 +01:00
Tim Peters 29bb227a0c
Add a minor `Fraction.__hash__()` optimization (GH-15313)
* Add a minor `Fraction.__hash__` optimization that got lost in the shuffle.

Document the optimizations.
2019-08-16 21:09:16 -05:00
Jeroen Demeyer 0567786d26 bpo-37540: vectorcall: keyword names must be strings (GH-14682)
The fact that keyword names are strings is now part of the vectorcall and `METH_FASTCALL` protocols. The biggest concrete change is that `_PyStack_UnpackDict` now checks that and raises `TypeError` if not.

CC @markshannon @vstinner 


https://bugs.python.org/issue37540
2019-08-16 03:41:27 -07:00
Raymond Hettinger f3cb68f2e4
bpo-37863: Optimize Fraction.__hash__() (#15298) 2019-08-15 20:58:26 -07:00
Tal Einat 71662dc2f1 bpo-37849: IDLE: fix completion window positioning above line (GH-15267) 2019-08-14 13:06:06 -04:00
Victor Stinner b0c8369c60
bpo-37531: Fix regrtest timeout for subprocesses (GH-15072)
Co-Authored-By: Joannah Nanjekye <joannah.nanjekye@ibm.com>
2019-08-14 14:18:51 +02:00
Greg Price 6bccbe7dfb bpo-36502: Correct documentation of str.isspace() (GH-15019)
The documented definition was much broader than the real one:
there are tons of characters with general category "Other",
and we don't (and shouldn't) treat most of them as whitespace.

Rewrite the definition to agree with the comment on
_PyUnicode_IsWhitespace, and with the logic in makeunicodedata.py,
which is what generates that function and so ultimately governs.

Add suitable breadcrumbs so that a reader who wants to pin down
exactly what this definition means (what's a "bidirectional class"
of "B"?) can do so.  The `unicodedata` module documentation is an
appropriate central place for our references to Unicode's own copious
documentation, so point there.

Also add to the isspace() test a thorough check that the
implementation agrees with the intended definition.
2019-08-14 13:05:19 +02:00
shireenrao 243a73deee bpo-25172: Add test for crypt ImportError on Windows (GH-15252) 2019-08-13 14:27:34 -07:00
Hai Shi 82642a052d bpo-37689: add Path.is_relative_to() method (GH-14982) 2019-08-13 21:54:02 +02:00
Hai Shi 1ac2a83f30 bpo-37583: Add err 113 to support.get_socket_conn_refused_errs() (GH-14729)
Add error number 113 EHOSTUNREACH to get_socket_conn_refused_errs()
of test.support.
2019-08-13 19:37:59 +02:00
Greg Price def97c988b bpo-37758: Clean out vestigial script-bits from test_unicodedata. (GH-15126)
This file started life as a script, before conversion to a
`unittest` test file.  Clear out some legacies of that conversion
that are a bit confusing about how it works.

Most notably, it's unlikely there's still a good reason to try
to recover from `unicodedata` failing to import -- as there was
when that logic was first added, when the module was very new.
So take that out entirely.  Keep `self.db` working, though, to
avoid a noisy diff.
2019-08-12 22:58:01 -07:00
Derek Keeler 732775d6be 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
2019-08-12 13:06:02 -07:00
Dong-hee Na 44046fe4fc bpo-37804: Remove the deprecated method threading.Thread.isAlive() (GH-15225) 2019-08-12 19:41:08 +02:00
Raymond Hettinger f03b4c8a48
bpo-37819: Add Fraction.as_integer_ratio() (GH-15212) 2019-08-11 14:40:59 -07:00
Abhilash Raj 09a1872a80 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
2019-08-11 13:45:09 -07:00
Gregory P. Smith b4be87a04a bpo-32912: Revert SyntaxWarning on invalid escape sequences. (GH-15195)
DeprecationWarning will continue to be emitted for invalid escape
sequences in string and bytes literals 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.

(Applies 4c5b6bac24 to the master branch).
(This is https://github.com/python/cpython/pull/15142 for master/3.9)


https://bugs.python.org/issue32912



Automerge-Triggered-By: @gpshead
2019-08-10 00:19:07 -07:00
Ngalim Siregar 92c7e30adf bpo-37642: Update acceptable offsets in timezone (GH-14878)
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
2019-08-09 10:22:16 -04:00
Paul Monson ed70a344b5 bpo-36511: Fix failures in Windows ARM32 buildbot (GH-15181) 2019-08-08 16:12:33 -07:00
Pablo Galindo aa542c2cf2
bpo-37795: Capture DeprecationWarnings in the test suite (GH-15184) 2019-08-08 23:25:46 +01:00
Zackery Spytz 10a0a09323 bpo-37268: test_parser fails when run with -Werror (GH-15183)
Use warnings.filterwarnings() when importing the deprecated parser
module.

@pablogsal 


https://bugs.python.org/issue37268



Automerge-Triggered-By: @pablogsal
2019-08-08 14:48:00 -07:00
shireenrao f4e725f224 bpo-25172: Raise appropriate ImportError msg when crypt module used on Windows (GH-15149) 2019-08-08 21:02:49 +01:00
Serhiy Storchaka 7d44e7a456
bpo-37685: Use singletons ALWAYS_EQ and NEVER_EQ in more tests. (GH-15167) 2019-08-08 08:43:18 +03:00
Serhiy Storchaka 662db125cd
bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)
They now return NotImplemented for unsupported type of the other operand.
2019-08-08 08:42:54 +03:00
aiudirog 4c69be22df bpo-34775: Return NotImplemented in PurePath division. (GH-9509) 2019-08-08 08:41:10 +03:00
Barry Warsaw 3a5c433fce Make importlib.metadata a simple module (#15153) 2019-08-06 19:59:07 -04:00
Terry Jan Reedy 1213123005
bpo-36419: IDLE - Refactor autocompete and improve testing. (#15121) 2019-08-04 19:48:52 -04:00
Terry Jan Reedy 14070299cd
bpo-37748: Re-order the Run menu. (GH-15115)
Put the most common choice, Run Module, at the top.
2019-08-04 16:45:15 -04:00
Raymond Hettinger b1c8ec010f
bpo-28292: Mark calendar.py helper functions as private. (GH-15113) 2019-08-04 13:14:03 -07:00
Raymond Hettinger 8183bb8150
bpo-36324: Update comments to include the target hash sums (GH-15110) 2019-08-04 11:52:04 -07:00
Tal Einat 86f1a18abf bpo-37706: IDLE - fix sidebar code bug and drag tests (GH-15103)
Convert mouse y to line number in the sidebar rather than the text.
2019-08-04 12:25:27 -04:00
Serhiy Storchaka 18b711c5a7
bpo-37648: Fixed minor inconsistency in some __contains__. (GH-14904)
The collection's item is now always at the left and
the needle is on the right of ==.
2019-08-04 14:12:48 +03:00
Serhiy Storchaka 17e52649c0
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.
2019-08-04 12:38:46 +03:00
Florian Wendelborn 5c72badd06 Correct description of HTTP status code 308. (GH-15078)
Permanent redirect was explained as a temporary redirect.
2019-08-03 11:16:34 -07:00
Ngalim Siregar c5fa44944e bpo-37444: Update differing exception between builtins and importlib (GH-14869)
Imports now raise `TypeError` instead of `ValueError` for relative import failures. This makes things consistent between `builtins.__import__` and `importlib.__import__` as well as using a more natural import for the failure.


https://bugs.python.org/issue37444



Automerge-Triggered-By: @brettcannon
2019-08-02 22:46:02 -07:00
Timo Furrer 8e568ef266 bpo-30974: Change os.path.samefile docstring to match docs (GH-7337) 2019-08-02 15:44:25 -07:00
Timothy Hopper 7ea9a85f13 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>
2019-08-02 15:20:14 -07:00
Greg Bowser 8fbece135d bpo-36590: Add Bluetooth RFCOMM and support for Windows. (GH-12767)
Support for RFCOMM, L2CAP, HCI, SCO is based on the BTPROTO_* macros
being defined. Winsock only supports RFCOMM, even though it has a
BTHPROTO_L2CAP macro. L2CAP support would build on windows, but not
necessarily work.

This also adds some basic unittests for constants (all of which existed
prior to this commit, just not on windows) and creating sockets.

pair: Nate Duarte <slacknate@gmail.com>
2019-08-02 13:29:52 -07:00
Vinay Sajip cb65b3a4f4
bpo-37742: Return the root logger when logging.getLogger('root') is c… (#15077)
* bpo-37742: Return the root logger when logging.getLogger('root') is called.

* Added type check guard on logger name in logging.getLogger() and refined a test.
2019-08-02 16:53:00 +01:00
tmblweed 4b3e975923 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
2019-08-01 21:57:13 -07:00
Bernhard M. Wiedemann 0d30ae1a03 bpo-36302: Sort list of sources (GH-12341)
When building packages (e.g. for openSUSE Linux)
(random) filesystem order of input files
influences ordering of functions in the output .so files.
Thus without the patch, builds (in disposable VMs) would usually differ.

Without this patch, all callers have to be patched individually
https://github.com/dugsong/libdnet/pull/42
https://github.com/sass/libsass-python/pull/212
https://github.com/tahoe-lafs/pycryptopp/pull/41
https://github.com/yt-project/yt/pull/2206
https://github.com/pyproj4/pyproj/pull/142
https://github.com/pytries/datrie/pull/49
https://github.com/Roche/pyreadstat/pull/37
but that is an infinite effort.

See https://reproducible-builds.org/ for why this matters.
2019-08-01 15:18:03 +02:00
Ronald Oussoren 1a057bab0f
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.
2019-08-01 07:43:07 +02:00
yannvgn 9f55551f3d bpo-37723: Fix performance regression on regular expression parsing. (GH-15030)
Improve performance of sre_parse._uniq function.
2019-07-31 21:50:39 +03:00
karl ding 31c4fd2a10 bpo-37085: Expose SocketCAN bcm_msg_head flags (#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.
2019-07-31 10:47:16 +02:00
Terry Jan Reedy fff5cb21ae
bpo-34162: Add missing items to idlelib/NEWS.txt. (GH-15034) 2019-07-31 00:58:45 -04:00
Min ho Kim c4cacc8c5e Fix typos in comments, docs and test names (#15018)
* Fix typos in comments, docs and test names

* Update test_pyparse.py

account for change in string length

* Apply suggestion: splitable -> splittable

Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>

* Apply suggestion: splitable -> splittable

Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>

* Apply suggestion: Dealloccte -> Deallocate

Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu>

* Update posixmodule checksum.

* Reverse idlelib changes.
2019-07-30 18:16:13 -04:00
Terry Jan Reedy 0acb646b8e
Fix idlelib typos discovered by min ho, pr 15018. (GH-15029) 2019-07-30 18:14:58 -04:00
Neil Schemenauer eca7ffc61c
Don't skip pickle check_frame_opcodes() (GH-15025)
This looks like the only place that proto 4 framing gets exercised
so leave it as part of the PGO task.
2019-07-30 12:08:17 -07:00
Neil Schemenauer 52a48e62c6
bpo-37707: Exclude expensive unit tests from PGO task (GH-15009)
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.
2019-07-30 11:08:18 -07:00
Victor Stinner 27eeaf0f2c
bpo-37704: Remove Tools/scripts/h2py.py (GH-15000)
Use cffi to access a C API in Python.
2019-07-30 17:45:09 +02:00
Pablo Galindo 9211e2fd81 bpo-37268: Add deprecation notice and a DeprecationWarning for the parser module (GH-15017)
Deprecate the parser module and add a deprecation warning triggered on import and a warning block in the documentation.





https://bugs.python.org/issue37268



Automerge-Triggered-By: @pablogsal
2019-07-30 04:04:01 -07:00
Terry Jan Reedy f35c51d2ea
bpo-34162: Update idlelib/news.txt. (#15011) 2019-07-29 18:12:14 -04:00
Terry Jan Reedy e8874b85b4
bpo-37706: Disable 3 IDLE scrollbar tests on Mac. (#15010)
They pass with tk 8.5.9 (Azure) but fail with the 8.6.x we install.
2019-07-29 17:57:36 -04:00
Anthony Sottile 44212ec811 Add additional test for multi-line SyntaxError (GH-15003) 2019-07-29 16:05:55 +01:00
Anthony Sottile 5b94f3578c Fix `SyntaxError` indicator printing too many spaces for multi-line strings (GH-14433) 2019-07-29 14:59:13 +01:00
Steve Dower e1b9002472 bpo-36044: Avoid warnings in Windows PGO build and add lzma, bz2 and sqlite coverage (GH-14985)
https://bugs.python.org/issue36044



Automerge-Triggered-By: @zooba
2019-07-28 18:01:12 -07:00
Jason R. Coombs 049460da9c
bpo-37697: Sync with importlib_metadata 0.19 (#14993)
* bpo-37697: Sync with importlib_metadata 0.19

* Run make regen-importlib

* 📜🤖 Added by blurb_it.
2019-07-28 14:59:24 -04:00
Terry Jan Reedy b222955355
bpo-37692: Improve highlight config sample (#14983)
Use an example shell interaction in the sample and better labels for shell elements.
2019-07-28 12:04:31 -04:00
Raymond Hettinger 6b5f1b496f
bpo-37691: Let math.dist() accept sequences and iterables for coordinates (GH-14975) 2019-07-27 14:04:29 -07:00
Tal Einat 3221a63c69 bpo-37628: Fix IDLE config sample sizes (#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.
2019-07-27 12:57:48 -04:00
Tal Einat 46ebd4a6a2 bpo-17535: Increase line number horizontal padding by 2 pixels (GH-14959) 2019-07-26 23:24:36 -04:00
Steve Dower b1eb20e68e
bpo-37664: Update regex for ignoring cache warning on some buildbots (GH-14960) 2019-07-26 09:06:04 -07:00
Flavian Hautbois 76b645124b bpo-29446: tkinter 'import *' only imports what it should (GH-14864)
Add __all__ to tkinter.__init__ and submodules.  Replace 'import *'
with explicit imports in some submodules.
2019-07-25 21:30:33 -04:00
Markus Mohrhard 898318b53d bpo-37502: handle default parameter for buffers argument of pickle.loads correctly (GH-14593) 2019-07-25 18:00:34 +02:00
Benjamin Peterson 93e8aa62cf
closes bpo-37675: Use pkgutil.iter_modules to find fixers in a package rather than listdir. (14942) 2019-07-24 16:38:50 -07:00
Pradyun Gedam 5380def826 bpo-37664: Update bundled pip to 19.2.1 and setuptools to 41.0.1 (GH-14934) 2019-07-24 12:08:02 -07:00
Stefan Behnel c6cb4cdd21
bpo-37399: Correctly attach tail text to the last element/comment/pi (GH-14856)
* bpo-37399: Correctly attach tail text to the last element/comment/pi, even when comments or pis are discarded.
Also fixes the insertion of PIs when "insert_pis=True" is configured for a TreeBuilder.
2019-07-24 20:08:02 +02:00
Gregory P. Smith e95ac20103
bpo-37667: Add regression test for regrtest. (GH-14929)
Verify that it appears to find roughly the right number of tests in the stdlib's testsuite.
2019-07-23 22:28:48 -07:00
Gregory P. Smith f0807ab24c
Only setup PGO tests when --pgo is enabled. (GH-14927) 2019-07-23 21:33:48 -07:00
Terry Jan Reedy c6fd6c83b7
bpo-29446: IDLE -- add explicit imports (GH-14919)
Stop depending on tkinter import *.
2019-07-23 16:14:59 -04:00
Tal Einat 7123ea009b
bpo-17535: IDLE editor line numbers (GH-14030) 2019-07-23 15:22:11 +03:00
Tal Einat 1ebee37dde
bpo-33610: validate non-negative integer inputs in IDLE's config (GH-14822) 2019-07-23 13:02:11 +03:00
Neil Schemenauer 4e16a4a311
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.
2019-07-22 12:54:25 -07:00
Xtreak 7397cda997 bpo-21478: Record calls to parent when autospecced objects are used as child with attach_mock (GH 14688)
* 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.
2019-07-22 08:38:22 +01:00
Min ho Kim 96e12d5f4f Fix typos in docs, comments and test assert messages (#14872) 2019-07-21 16:12:33 -04:00
Terry Jan Reedy 8e3a7380ec
Fix typo found by Min ho Kim (#14879) 2019-07-21 15:24:45 -04:00
Raymond Hettinger 1c0e9bb94b
Minor whitespace, indentation, and quoting changes to improve internal consistency and appease linters (GH-14888) 2019-07-21 12:13:07 -07:00
Ngalim Siregar 35b87e6001 bpo-37627: Initialize IDLE Custom Run dialog with previous entries (#14870)
Repeat the command line arguments most recently entered before so the user can edit them.
2019-07-21 11:37:28 -04:00
Raymond Hettinger 02c91f59b6
bpo-36324: Make internal attributes for statistics.NormalDist() private. (GH-14871)
* Make internals private

* Finish making mu and sigma private

* Add missing __hash__() method

* Add blurb
2019-07-21 00:34:47 -07:00
Hai Shi 5623ac87bb bpo-37476: Adding tests for asutf8 and asutf8andsize (GH-14531) 2019-07-20 15:56:23 +08:00
Raymond Hettinger eed5e9a956
bpo-36546: Clean-up comments (GH-14857) 2019-07-19 01:57:22 -07:00
Tal Einat e0a1f8fb5c bpo-33610: IDLE's code-context always shows current context immediately (GH-14821)
Eliminate delay of up to 100ms and accompanying visual artifact.
Fix bug of never showing context when hide and show.
2019-07-18 16:03:18 -04:00
Walter Dörwald 323842c279 bpo-34443: Use __qualname__ instead of __name__ in enum exception messages. (GH-14809)
* Use __qualname__ instead of __name__ in enum exception messages.
2019-07-18 11:37:13 -07:00
Paul Monson 9cd39b16e2 bpo-37552: Skip failing tests in strptime/strftime with UCRT version 17763.615 (#14460)
A bug in MSVC UCRT version 17763.615 (which has been fixed in newer versions) is causing test failures in some strptime/strftime tests when the default code page is c65001. This change selectively skips the tests affected by this.
2019-07-18 15:56:59 +02:00
Terry Jan Reedy 1b38922434
bpo-36390: Gather IDLE Format menu functions into format.py (#14827)
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.
2019-07-17 20:48:36 -04:00
jpic 8cb65d1381 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
2019-07-17 14:54:25 -07:00
Abhilash Raj 719a062bcb 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.
2019-07-17 09:48:52 -07:00
Abhilash Raj a4a994bd3e 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.
2019-07-17 09:44:27 -07:00
Cheryl Sabella 82494aa6d9 bpo-36390: IDLE: Combine region formatting methods. (GH-12481)
Rename paragraph.py to format.py and add region formatting methods
from editor.py.  Add tests for the latter.
2019-07-17 09:44:44 -04:00
Tal Einat 7036e1de3a
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
2019-07-17 11:15:53 +03:00
Cheryl Sabella f8d4cc7dbb bpo-27452: IDLE: Cleanup config.py code (GH-14577) 2019-07-16 16:58:25 -04:00
Paul Ganssle f69d5c6198 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
2019-07-16 10:50:01 -07:00
Pablo Galindo 18c5f9d44d bpo-37500: Make sure dead code does not generate bytecode but also detect syntax errors (GH-14612)
https://bugs.python.org/issue37500

Add a new field to the compiler structure that allows to be configured
so no bytecode is emitted. In this way is possible to detect errors by
walking the nodes while preserving optimizations.


https://bugs.python.org/issue37500
2019-07-15 02:15:01 -07:00
Pablo Galindo cd6e83b481 bpo-37593: Swap the positions of posonlyargs and args in the constructor of ast.parameters nodes (GH-14778)
https://bugs.python.org/issue37593
2019-07-14 16:32:18 -07:00
Victor Stinner 8b7db5a111
bpo-37473: Don't import importlib ASAP in tests (GH-14661)
bpo-15386, bpo-37473: test_import, regrtest and libregrtest no longer
import importlib as soon as possible, as the first import, "to test
bpo-15386".

It is tested by test_import.test_there_can_be_only_one().

Sort test_import imports.
2019-07-14 19:31:12 +02:00
Collin Styles 0d4f4352ef Clarify that plistlib's load and dump functions take a binary file object (GH-9825)
The documentation says that the fp parameter to plistlib.load "should be a
readable and binary file object" but the docstring only mentions that it
should be readable. Similarly, plistlib.dump's docstring only mentions
"writable". This commit clarifies that fp should also be binary.

https://docs.python.org/3/library/plistlib.html#plistlib.load
https://docs.python.org/3/library/plistlib.html#plistlib.dump
2019-07-14 11:01:48 +02:00
Paul Monson 52c8c09087 bpo-37553: SendfileUsingSendTest tests timeout too short for Windows ARM32 (GH-14716) 2019-07-14 10:30:28 +02:00
Zac Hatfield-Dodds dffca9e925 bpo-26967: fix flag grouping with allow_abbrev=False (GH-14316)
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/pytest#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
2019-07-13 22:35:58 -07:00
Xtreak e6b46aafad bpo-37579: Improve equality behavior for pure Python datetime and time (GH-14726)
Returns NotImplemented for timedelta and time in __eq__ for different types in Python implementation, which matches the C implementation.

This also adds tests to enforce that these objects will fall back to the right hand side's __eq__ and/or __ne__ implementation.

bpo-37579
2019-07-13 15:22:21 +02:00
gescheit b9a0376b0d closes bpo-37347: Fix refcount problem in sqlite3. (GH-14268) 2019-07-12 20:15:48 -07:00
Kyle Stanley a65c977552 bpo-19696: Move threaded_import_hangers (GH-14655)
Move `threaded_import_hangers`, a dependency of `test_threaded_import`, to the directory `test_importlib/`. Also update the import references for `threaded_import_hangers` in `test_threaded_import`.





https://bugs.python.org/issue19696
2019-07-12 14:22:05 -07:00
Hai Shi c8e7146de2 closes bpo-37566: Remove _realsocket from socket.py. (GH-14711) 2019-07-11 19:17:52 -07:00
Jakub Kulík 4737265622 bpo-37558: Shared memory tests are failing due to double slashes (GH-14703)
With the addition of shared memory into Python 3.8, we now have three tests failing on Solaris, namely `test_multiprocessing_fork`, `test_multiprocessing_forkserver` and `test_multiprocessing_spawn`. The reason seems to be incorrect name handling which results in two slashes being prepended.


https://bugs.python.org/issue37558
2019-07-11 11:04:09 -07:00
Tal Einat 9b5ce62cac
bpo-36390: simplify classifyws(), rename it and add unit tests (GH-14500) 2019-07-11 17:20:14 +03:00
Terry Jan Reedy 6aeb2fe606
bpo-26806: IDLE should run without docstrings (#14657)
After fcf1d00, IDLE startup failed with python compiled without docstrings.
2019-07-09 14:37:25 -04:00
Victor Stinner 73ea54620a
bpo-37322: ssl test_pha_required_nocert() ignores expected SSLError (GH-14670)
test_ssl.test_pha_required_nocert() now uses
support.catch_threading_exception() to ignore the expected SSLError
in ConnectionHandler of ThreadedEchoServer (it is only raised
sometimes on Windows).
2019-07-09 14:33:49 +02:00
Carl Friedrich Bolz-Tereick 430a9f44fe bpo-18374: fix tests to check the correct thing about line numbers (GH-14659) 2019-07-09 13:20:01 +01:00
Victor Stinner 61b1bc5606
Revert "bpo-37322: Fix test_ssl.test_pha_required_nocert() ResourceWarning (GH-14662)" (GH-14669)
This reverts commit cf9c41c422.
2019-07-09 13:35:47 +02:00
Victor Stinner 91b4f7ab7f
bpo-37526: Add support.catch_threading_exception() (GH-14664)
Context manager catching threading.Thread exception using
threading.excepthook.
2019-07-09 13:00:23 +02:00
Victor Stinner cf9c41c422
bpo-37322: Fix test_ssl.test_pha_required_nocert() ResourceWarning (GH-14662)
Close the TLS connection in test_pha_required_nocert() of test_ssl to
fix a ResourceWarning.
2019-07-09 12:36:55 +02:00
Carl Friedrich Bolz-Tereick 110a47c4f4 bpo-18374: fix wrong col_offset of some ast.BinOp instances (GH-14607)
Nested BinOp instances (e.g. a+b+c) had a wrong col_offset for the
second BinOp (e.g. 2 instead of 0 in the example). Fix it by using the
correct st node to copy the line and col_offset from in ast.c.
2019-07-08 22:17:56 +01:00
Victor Stinner e676244235
bpo-37421: test_concurrent_futures stops ForkServer (GH-14643)
test_concurrent_futures now explicitly stops the ForkServer instance
if it's running.
2019-07-08 10:49:11 +02:00
Jason R. Coombs 38f44b4a4a
bpo-37520: Correct behavior for zipfile.Path.parent (GH-14638)
* bpo-37520: Correct behavior for zipfile.Path.parent

* 📜🤖 Added by blurb_it.
2019-07-07 17:37:50 -04:00
Tal Einat fcf1d003bf
bpo-26806: add 30 to the recursion limit in IDLE's shell (GH-13944)
This is done to compensate for the extra stack frames added by
IDLE itself, which cause problems when setting the recursion limit
to low values.

This wraps sys.setrecursionlimit() and sys.getrecursionlimit()
as invisibly as possible.
2019-07-06 15:35:24 +03:00
Kyle Stanley bad02cc3c8 Move test_threaded_import.py to test_importlib/ (GH-14582) 2019-07-05 14:22:42 -07:00
Victor Stinner 8fbeb14312
bpo-37421: multiprocessing tests now stop ForkServer (GH-14601)
multiprocessing tests now stop the ForkServer instance if it's
running: close the "alive" file descriptor to ask the server to stop
and then remove its UNIX address.
2019-07-05 16:15:39 +02:00
Jeroen Demeyer 0d722f3cd6 bpo-36974: separate vectorcall functions for each calling convention (GH-13781) 2019-07-05 14:48:24 +02:00
Victor Stinner 1da4462765
bpo-37481: Deprecate distutils bdist_wininst command (GH-14553)
The distutils bdist_wininst command is now deprecated, use
bdist_wheel (wheel packages) instead.
2019-07-05 10:44:12 +02:00
thatneat 2f19e82fbe bpo-37479: on Enum subclasses with mixins, __format__ uses overridden __str__ (GH-14545)
* bpo-37479: on Enum subclasses with mixins, __format__ uses overridden __str__
2019-07-04 11:28:37 -07:00
Victor Stinner 9d40554e0d
bpo-37421: Fix multiprocessing get_temp_dir() finalizer (GH-14572)
Fix multiprocessing.util.get_temp_dir() finalizer: clear also the
'tempdir' configuration of the current process, so next call to
get_temp_dir() will create a new temporary directory, rather than
reusing the removed temporary directory.
2019-07-04 12:28:55 +02:00
Kyle Stanley 56ec4f1fde bpo-19696: Replace deprecated method in "test_import_pkg.py" (GH-14466)
Replacing the deprecated method "random.choose" to "random.choice" was technically not part of the original issue. However, it was discussed in the talk page and involved one of the files being moved. I assumed this was too minor to justify the creation of a separate issue. 

Also, I added my name to the contributors list in Misc/ACKS. This will be my third PR to cpython, forgot to do it in the previous ones. 



https://bugs.python.org/issue19696
2019-07-03 11:22:40 -07:00
Victor Stinner 74c9dd5777
bpo-37421: Fix test_distutils.test_build_ext() (GH-14564)
test_distutils.test_build_ext() is now able to remove the temporary
directory on Windows: don't import the newly built C extension ("xx")
in the current process, but test it in a separated process.
2019-07-03 11:12:27 +02:00
Victor Stinner 684cb47fff
bpo-37421: test_concurrent_futures cleans up multiprocessing (GH-14563)
test_concurrent_futures now cleans up multiprocessing to remove
immediately temporary directories created by
multiprocessing.util.get_temp_dir().

The test now uses setUpModule() and tearDownModule().
2019-07-03 11:10:30 +02:00
Victor Stinner b71d8d6795
bpo-37421: test_winconsoleio doesn't leak temp file anymore (GH-14562)
test_winconsoleio doesn't leak a temporary file anymore: use
tempfile.TemporaryFile() to remove it when the test completes.
2019-07-03 11:09:56 +02:00
Christian Heimes 477b1b2576 bpo-37463: match_hostname requires quad-dotted IPv4 (GH-14499)
ssl.match_hostname() no longer accepts IPv4 addresses with additional text
after the address and only quad-dotted notation without trailing
whitespaces. Some inet_aton() implementations ignore whitespace and all data
after whitespace, e.g. '127.0.0.1 whatever'.

Short notations like '127.1' for '127.0.0.1' were already filtered out.

The bug was initially found by Dominik Czarnota and reported by Paul Kehrer.

Signed-off-by: Christian Heimes <christian@python.org>



https://bugs.python.org/issue37463
2019-07-02 11:39:42 -07:00
Victor Stinner 7cb9204ee1
bpo-37421: urllib.request tests call urlcleanup() (GH-14529)
urllib.request tests now call urlcleanup() to remove temporary files
created by urlretrieve() tests and to clear the _opener global
variable set by urlopen() and functions calling indirectly urlopen().

regrtest now checks if urllib.request._url_tempfiles and
urllib.request._opener are changed by tests.
2019-07-02 14:50:19 +02:00
Victor Stinner 039fb49c18
bpo-37421: multiprocessing tests call _run_finalizers() (GH-14527)
multiprocessing tests now call explicitly _run_finalizers() to remove
immediately temporary directories created by
multiprocessing.util.get_temp_dir().
2019-07-02 13:32:32 +02:00
Jakub Kulík 61bf97e916 bpo-37335, test_c_locale_coercion: Remove unnecessary code (GH-14447)
Python initialization now ensures that sys stream encoding
names are always normalized by codecs.lookup(encoding).name.
Simplify test_c_locale_coercion: it doesn't have to normalize
encoding names anymore.
2019-07-02 12:48:28 +02:00
Ned Deily 5bbbc733e6
bpo-34602: Avoid failures setting macOS stack resource limit (GH-14546)
Under some conditions the earlier fix for bpo-18075, "Infinite recursion
tests triggering a segfault on Mac OS X", now causes failures on macOS
when attempting to change stack limit with resource.setrlimit
resource.RLIMIT_STACK, like regrtest does when running the test suite.
The reverted change had specified a non-default stack size when linking
the python executable on macOS.  As of macOS 10.14.4, the previous
code causes a hard failure when running tests, although similar
failures had been seen under some conditions under some earlier
systems.  Reverting the change to the interpreter stack size at link
time helped for release builds but caused some tests to fail when
built --with-pydebug.  Try the opposite approach: continue to build
the interpreter with an increased stack size on macOS and remove
the failing setrlimit call in regrtest initialization.  This will
definitely avoid the resource.RLIMIT_STACK error and should have
no, or fewer, side effects.
2019-07-02 03:12:18 -04:00
Steve Dower e226e83d36
bpo-37363: Add audit events on startup for the run commands (GH-14524) 2019-07-01 16:03:53 -07:00
Victor Stinner 67310023f2
bpo-36763: Use PyConfig_Clear() (GH-14445)
Stop using "static PyConfig", PyConfig must now always use
dynamically allocated strings: use PyConfig_SetString(),
PyConfig_SetArgv() and PyConfig_Clear().
2019-07-01 19:52:45 +02:00
Victor Stinner e21b45a8e7
bpo-37472: Remove Lib/test/outstanding_bugs.py (GH-14516) 2019-07-01 18:35:07 +02:00
Victor Stinner 8f4ef3b019
Remove unused imports in tests (GH-14518) 2019-07-01 18:28:25 +02:00
Victor Stinner f9b7457bd7
bpo-37467: Fix PyErr_Display() for bytes filename (GH-14504)
Fix sys.excepthook() and PyErr_Display() if a filename is a bytes
string. For example, for a SyntaxError exception where the filename
attribute is a bytes string.

Cleanup also test_sys:

* Sort imports.
* Rename numruns global var to INTERN_NUMRUNS.
* Add DisplayHookTest and ExceptHookTest test case classes.
* Don't save/restore sys.stdout and sys.displayhook using
  setUp()/tearDown(): do it in each test method.
* Test error case (call hook with no argument) after the success case.
2019-07-01 16:51:18 +02:00
Miro Hrončok 72cd653c4e bpo-10945: Drop support for bdist_wininst on non-Windows systems (GH-14506)
bdist_wininst depends on MBCS codec, unavailable on non-Windows,
and bdist_wininst have not worked since at least Python 3.2, possibly
never on Python 3.

Here we document that bdist_wininst is only supported on Windows,
and we mark it unsupported otherwise to skip tests.

Distributors of Python 3 can now safely drop the bdist_wininst .exe files
without the need to skip bdist_wininst related tests.
2019-07-01 14:12:40 +02:00
Christian Heimes d1bd6e79da bpo-37440: Enable TLS 1.3 post-handshake auth in http.client (GH-14448)
Post-handshake authentication is required for conditional client cert authentication with TLS 1.3.


https://bugs.python.org/issue37440
2019-06-30 23:32:24 -07:00