Commit graph

104996 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
Stefan Krah bcc446f525
Revert mode change that loses information in directory listings on Linux. (#15366) 2019-08-21 23:00:04 +02: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
Roger Iyengar 092911d5c0 Update asyncio.ensure_future() documentation (GH-15347)
Added back mention that ensure_future actually scheduled obj. This documentation just mentions what ensure_future returns, so I did not realize that ensure_future also schedules obj.
2019-08-21 11:59:11 -04:00
Jordon Xu 20f59fe1f7 bpo-37751: Fix codecs.lookup() normalization (GH-15092)
Fix codecs.lookup() to normalize the encoding name the same way
than encodings.normalize_encoding(), except that codecs.lookup()
also converts the name to lower case.
2019-08-21 14:26:20 +01:00
Ashwin Ramaswami 87bc3b7a0b bpo-37860: Add netlify deploy preview for docs (GH-15288)
* add netlify deploy preview

* fix publish path

* install python3 venv

* add sudo

* try without venv

* install right dependencies

* use python3, not python

* use pip3

* python3.7

* use requirements.txt

* move requirements.txt to Doc

* use python 3.7 in runtime.txt

* move runtime.txt

* Update requirements.txt
2019-08-21 22:08:47 +09:00
Victor Stinner d8c5adf6f8
bpo-37851: faulthandler allocates its stack on demand (GH-15358)
The faulthandler module no longer allocates its alternative stack at
Python startup. Now the stack is only allocated at the first
faulthandler usage.

faulthandler no longer ignores memory allocation failure when
allocating the stack. sigaltstack() failure now raises an OSError
exception, rather than being ignored.

The alternative stack is no longer used if sigaction() is
not available. In practice, sigaltstack() should only be available
when sigaction() is avaialble, so this change should have no effect
in practice.

faulthandler.dump_traceback_later() internal locks are now only
allocated at the first dump_traceback_later() call, rather than
always being allocated at Python startup.
2019-08-21 13:40:42 +01:00
Michael Anckaert e0b6117e27 bpo-37823: Fix open() link in telnetlib doc (GH-15281)
Fixed wrong link to Telnet.open() method in telnetlib documentation.
2019-08-21 12:13:34 +01: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
Benjamin Peterson d33e46d17d
abstract.c should not be executable. (GH-15348) 2019-08-20 19:19:43 -07:00
Brett Cannon 1407038e0b
Remove a dead comment from ossaudiodev.c (#15346) 2019-08-20 12:20:47 -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
Victor Stinner 18f8dcfa10
bpo-37732: Fix GCC warning in _PyObject_Malloc() (GH-15333)
pymalloc_alloc() now returns directly the pointer, return NULL on
memory allocation error.

allocate_from_new_pool() already uses NULL as marker for "allocation
failed".
2019-08-20 12:28:02 +01:00
Eric V. Smith b0f4dab873
bpo-37868: Improve is_dataclass for instances. (GH-15325) 2019-08-20 01:40:28 -04:00
Antoine d3c8d73514 Minor documentation fixes on library/enum (GH-15234)
* Minor documentation fixes on library/enum
2019-08-19 18:41:31 -07:00
Hansraj Das d13968b1be Delete stale comment in Python/getopt.c. (GH-14719) 2019-08-19 18:35:13 -07: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
Steve Dower cf9360e524
Remove 'unstable' warning for Windows Store package in docs (GH-15334) 2019-08-19 10:07:25 -07:00
shireenrao 24fe46081b bpo-36266: Add module name in ImportError when DLL not found on Windows (GH-15180) 2019-08-17 13:50:39 -07:00
cocoatomo 455856391c Insert a missing close parenthesis (GH-15316) 2019-08-18 05:40:23 +09:00
Éric Araujo 1b1d0514ad fix link to time function from time_ns doc (GH-15285)
Because mod, func, class, etc all share one namespace, :func:time creates a link to the time module doc page rather than the time.time function.
2019-08-17 13:34:08 -07: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
Hansraj Das 69f37bcb28 Indent code inside if block. (GH-15284)
Without indendation, seems like strcpy line is parallel to `if` condition.
2019-08-15 09:19:07 -07:00
Jeroen Demeyer 37806f404f bpo-37207: enable vectorcall for type.__call__ (GH-14588)
Base PR for other PRs that want to play with `type.__call__` such as #13930 and #14589.

The author is really @markshannon I just made the PR.


https://bugs.python.org/issue37207



Automerge-Triggered-By: @encukou
2019-08-15 08:49:46 -07:00
Alex Gaynor 40dad9545a Replace usage of the obscure PEM_read_bio_X509_AUX with the more standard PEM_read_bio_X509 (GH-15303)
X509_AUX is an odd, note widely used, OpenSSL extension to the X509 file format. This function doesn't actually use any of the extra metadata that it parses, so just use the standard API.

Automerge-Triggered-By: @tiran
2019-08-15 05:31:28 -07:00
Greg Price 3e4498d35c bpo-37760: Avoid cluttering work tree with downloaded Unicode files. (GH-15128) 2019-08-14 18:18:53 -07:00
Hai Shi 68e495df90 bpo-37775: Update compileall doc for invalidation_mode parameter (GH-15148) 2019-08-15 00:03:11 +02:00
Victor Stinner ac827edc49
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.
2019-08-14 23:35:27 +02:00
Artem Khramov 2814620657 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.
2019-08-14 23:21:48 +02:00
Abhilash Raj dcfe111eb5 bpo-37826: Document exception chaining in Python tutorial for errors. (GH-15243)
https://bugs.python.org/issue37826
2019-08-14 14:11:32 -07:00
Tal Einat 71662dc2f1 bpo-37849: IDLE: fix completion window positioning above line (GH-15267) 2019-08-14 13:06:06 -04:00
Sergey Fedoseev 4fa10dde40 bpo-36030: Improve performance of some tuple operations (GH-12052) 2019-08-14 16:10:33 +02: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
Victor Stinner 077af8c2c9
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.
2019-08-14 12:31:43 +02:00
Hai Shi 7e479c8221 bpo-37681: no_sanitize_thread support from GCC 5.1 (GH-15096)
Fix the following warning with GCC 4.8.5:
Objects/obmalloc.c: warning: ‘no_sanitize_thread’ attribute directive ignored
2019-08-14 11:50:19 +02:00
Zackery Spytz 43d564c18c bpo-37337: Fix a GCC 9 warning in Objects/descrobject.c (GH-14814)
Commit b1263d5a60 causes GCC 9.1.0 to
give a warning in Objects/descrobject.c.
2019-08-14 14:51:06 +09:00
Greg Price c03e698c34 bpo-37760: Factor out standard range-expanding logic in makeunicodedata. (GH-15248)
Much like the lower-level logic in commit ef2af1ad4, we had
4 copies of this logic, written in a couple of different ways.
They're all implementing the same standard, so write it just once.
2019-08-13 19:28:38 -07:00