Commit Graph

23010 Commits

Author SHA1 Message Date
Jules Lasne (jlasne) b1f160a236 Add missing comma and period in unittest docs (GH-17211)
Automerge-Triggered-By: @csabella
2019-11-19 04:05:45 -08:00
Batuhan Taşkaya 24555ce2f9 bpo-21767: explicitly mention abc support in functools.singledispatch docs (#17171) 2019-11-19 09:16:46 +01:00
Steve Dower 00923c6399
bpo-38622: Add missing audit events for ctypes module (GH-17158) 2019-11-18 11:32:46 -08:00
Роман Донченко f49f6baa6b Correct the description of the 3.7 change in urllib.parse.quote (GH-17065)
`~` is now treated as an unreserved character (i.e. it doesn't get quoted), not a reserved one.
2019-11-18 07:30:53 -08:00
Vinay Sajip 5383956583
bpo-38830: Correct slot signature in Qt example. (GH-17220) 2019-11-18 12:03:22 +00:00
Raymond Hettinger 04c79d6088
bpo-38678: Improve argparse example in tutorial (GH-17207) 2019-11-17 22:06:19 -08:00
alclarks 4544e78ec4 bpo-25866: Minor cleanups to "sequence" in docs (GH-17177) 2019-11-17 14:00:43 -08:00
Serhiy Storchaka a0652328a2
bpo-28286: Deprecate opening GzipFile for writing implicitly. (GH-16417)
Always specify the mode argument for writing.
2019-11-16 18:56:57 +02:00
Serhiy Storchaka bd44a7ead9
bpo-38650: Constify PyStructSequence_UnnamedField. (GH-17005)
Make it a constant and referring to a constant string.
2019-11-16 18:55:29 +02:00
Jules Lasne (jlasne) 0fe0b88d6e Updated missing periods in cmdline.rst (GH-17173) 2019-11-15 23:18:17 +01:00
HongWeipeng 84f2528d48 Fix the description of isdatadescriptor in inspect.rst (#16645) 2019-11-15 23:47:26 +02:00
Eric Snow 73cdb0c6b2 bpo-38816: Add notes in the C-API docs about fork in subinterpreters. (GH-17176)
The C-API docs are a bit sparse on the interplay between C `fork()` and the CPython runtime.  This change adds some more information on the subject.


https://bugs.python.org/issue38816
2019-11-15 13:28:54 -08:00
Phil Connell b22030073b bpo-38778: Document that os.fork is not allowed in subinterpreters (GH-17123)
Small docs update for [bpo-34651](https://bugs.python.org/issue34651).

Other references to fork (e.g. the PyOS.*Fork functions or discussions of fork() when embedding Python) point back to os.fork, so I don't think any other updates are needed.





https://bugs.python.org/issue38778



Automerge-Triggered-By: @ericsnowcurrently
2019-11-15 08:56:03 -08:00
Andrey Doroschenko e8acc865a3 bpo-38351: Modernize email examples from %-formatting to f-strings (GH-17162) 2019-11-15 11:03:46 +02:00
Benjamin Peterson 3ccdd9b180
closes bpo-38692: Add a pidfd child process watcher to asyncio. (GH-17069) 2019-11-13 19:08:50 -08:00
Shu 2d56af7a94 Fix minor typos. (GH-17095) 2019-11-12 19:12:11 -08:00
Serhiy Storchaka 138ccbb022
bpo-38738: Fix formatting of True and False. (GH-17083)
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>".
2019-11-12 16:57:03 +02:00
Jeroen Demeyer 9a13a388f2 bpo-36974: expand call protocol documentation (GH-13844)
CC @encukou 

I'm also adding Petr Viktorin as contributor for vectorcall in the "what's new" section.


https://bugs.python.org/issue36974



Automerge-Triggered-By: @encukou

Automerge-Triggered-By: @encukou
2019-11-12 05:08:00 -08:00
David K a12255d8de bpo-38421: Update email.utils documentation (GH-16678)
Updates documentation around email.utils.parsedate_tz().

Currently, the documentation specifies that when a string without a is timezone passed to parsedate_tz(), the last tuple is returned as ```None```.

This is no longer true since Python 3.3


https://bugs.python.org/issue38421
2019-11-12 04:38:46 -08:00
Raymond Hettinger 733b9a308e
bpo-38385: Fix iterator/iterable terminology in statistics docs (GH-17111) 2019-11-11 23:35:06 -08:00
Manjusaka 051ff526b5 bpo-38565: add new cache_parameters method for lru_cache (GH-16916) 2019-11-11 23:30:18 -08:00
Jonathan Scholbach 98480cef9d bpo-38771: Explict test for None in code example (GH-17108) 2019-11-11 16:49:41 -08:00
Brandt Bucher a0ed99bca8 bpo-38438: Simplify argparse "star nargs" usage. (GH-17106) 2019-11-11 12:47:48 -08:00
Shu fc6b1bf869 Clarify amount of dots between package and subpackage (GH-17092) 2019-11-08 12:26:35 -08:00
Victor Stinner d12d0e7c0f
bpo-38733: PyErr_Occurred() caller must hold the GIL (GH-17080)
bpo-3605, bpo-38733: Optimize _PyErr_Occurred(): remove "tstate ==
NULL" test.

Py_FatalError() no longer calls PyErr_Occurred() if called without
holding the GIL. So PyErr_Occurred() no longer has to support
tstate==NULL case.

_Py_CheckFunctionResult(): use directly _PyErr_Occurred() to avoid
explicit "!= NULL" test.
2019-11-07 12:42:07 +01:00
Raymond Hettinger 7f460494d2
bpo-38382: Document the early-out behavior for a zero (GH-17037) 2019-11-06 21:50:44 -08:00
Benjamin Peterson 5c0c325453 closes bpo-38713: Expose P_PIDFD in os if it's defined. (GH-17071)
https://bugs.python.org/issue38713
2019-11-05 21:58:31 -08:00
Benjamin Peterson 6c4c45efae
bpo-38692: Add os.pidfd_open. (GH-17063) 2019-11-05 19:21:29 -08:00
Ammar Askar 56698d5769 bpo-38696: Fix usage example of HTTPStatus (GH-17066) 2019-11-05 17:29:33 -06:00
Jeroen Demeyer bf17d41826 bpo-37645: add new function _PyObject_FunctionStr() (GH-14890)
Additional note: the `method_check_args` function in `Objects/descrobject.c` is written in such a way that it applies to all kinds of descriptors. In particular, a future re-implementation of `wrapper_descriptor` could use that code.

CC @vstinner @encukou 


https://bugs.python.org/issue37645



Automerge-Triggered-By: @encukou
2019-11-05 07:48:04 -08:00
Jules Lasne (jlasne) 5e01a6542a Update interpreter.rst (GH-17059)
Fixed what seemed to be a weird phrasing.
2019-11-05 14:20:38 +01:00
Victor Stinner f4b1e3d7c6
bpo-38644: Add Py_EnterRecursiveCall() to the limited API (GH-17046)
Provide Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() as
regular functions for the limited API. Previously, there were defined
as macros, but these macros didn't work with the limited API which
cannot access PyThreadState.recursion_depth field.

Remove _Py_CheckRecursionLimit from the stable ABI.

Add Include/cpython/ceval.h header file.
2019-11-04 19:48:34 +01:00
Raymond Hettinger 1cdadf414b
bpo-37759: Show output from var_access_benchmark (GH-17040) 2019-11-03 21:47:01 -08:00
Dima Tisnek d0e0f5bf0c bpo-38388: Document pickle protocol version 5 (GH-16639) 2019-11-03 13:55:33 +02:00
Борис Верховский 99b7701978 Convert argument to snake_case (GH-16990) 2019-11-02 12:09:14 -07:00
Jon Janzen d0d9f7cfa3 Slightly improve plistlib test coverage. (GH-17025)
* Add missing test class (mistake in GH-4455)

* Increase coverage with 4 more test cases

* Rename neg_uid to huge_uid in test_modified_uid_huge

* Replace test_main() with unittest.main()

* Update plistlib docs
2019-11-01 18:45:01 +02:00
Petr Viktorin 9bc94eca0c
bpo-38159: Clarify documentation of PyState_AddModule (GH-16101)
This was never intented to be called manually from PyInit_*.

Also, clarify PyState_RemoveModule return value.
2019-11-01 16:47:05 +01:00
Simon Legner 112f2b805b Update the URL for the requests package (GH-17006)
Change the url from docs.python-requests.org to requests.readthedocs.io
2019-10-31 05:01:44 -07:00
Anthony Sottile b32cb97bce bpo-38312: Add curses.{get,set}_escdelay and curses.{get,set}_tabsize. (GH-16938) 2019-10-31 11:13:48 +02:00
Serhiy Storchaka e835b31d2b
bpo-38600: NULL -> ``NULL``. (GH-17001)
Also fix some other formatting.
2019-10-30 21:37:16 +02:00
Victor Stinner 24c6258269
bpo-38614: Add timeout constants to test.support (GH-16964)
Add timeout constants to test.support:

* LOOPBACK_TIMEOUT
* INTERNET_TIMEOUT
* SHORT_TIMEOUT
* LONG_TIMEOUT
2019-10-30 12:41:43 +01:00
Serhiy Storchaka 865c3b257f
bpo-28029: Make "".replace("", s, n) returning s for any n != 0. (GH-16981) 2019-10-30 12:03:53 +02:00
Serhiy Storchaka 25fc088607
bpo-38600: Change the mark up of NULL in the C API documentation. (GH-16950)
Replace all *NULL* with ``NULL``.
2019-10-30 12:03:20 +02:00
Géry Ogam 4c155f738d bpo-38336: Remove the __set__ method restriction on data descriptors for attribute lookup precedence (GH-16520) 2019-10-29 00:04:01 -07:00
Kyle Stanley 457306bddb Fix asyncio.wait() 3.8 whatsnew entry (GH-16975) 2019-10-28 21:53:22 -04:00
benedwards14 794616f837 bpo-38534: Replace wrong KB number references (GH-16955) 2019-10-28 10:53:51 -07:00
Victor Stinner e471e72977
bpo-37330: open() no longer accept 'U' in file mode (GH-16959)
open(), io.open(), codecs.open() and fileinput.FileInput no longer
accept "U" ("universal newline") in the file mode. This flag was
deprecated since Python 3.3.
2019-10-28 15:40:08 +01:00
Dong-hee Na 3bfc8e0fcc bpo-38602: Add fcntl.F_OFD_XXXX for fcntlmodule (GH-16956) 2019-10-28 09:31:15 +02:00
Marco Rougeth 85c6f8c65c bpo-38592 Add pt-br switcher to Python Docs website (GH-16924)
* 📜🤖 Added by blurb_it.
2019-10-27 09:30:12 +01:00
Steve Dower 894e30ce0b
bpo-38434: Fixes some audit event documentation (GH-16932) 2019-10-26 13:02:30 -07:00
Serhiy Storchaka d898d20e8c
bpo-38557: Improve documentation for list and tuple C API. (GH-16925) 2019-10-26 22:59:18 +03:00
Ammar Askar cb2cf06b0a bpo-38558: Mention `:=` in conditions tutorial (GH-16919) 2019-10-25 17:20:05 -05:00
Kyle Stanley 3bbb6db545 Add missing asyncio changes from 3.8 whatsnew (GH-16911) 2019-10-24 00:15:25 -04:00
Girts a01ba333af bpo-30618: add readlink to pathlib.Path (GH-8285)
This adds a "readlink" method to pathlib.Path objects that calls through
to os.readlink.


https://bugs.python.org/issue30618



Automerge-Triggered-By: @gpshead
2019-10-23 14:18:40 -07:00
Peter Bittner d34ac30532 Spell Bitbucket correctly. (GH-16862) 2019-10-23 12:17:30 +03:00
Daniel Baskal 91528f40c3 bpo-38466: Fix threading.excepthook doc (GH-16891) 2019-10-22 22:37:47 +02:00
Julien Palard c987090c73
Bump Sphinx to 2.2.0. (GH-16532) 2019-10-22 18:13:41 +02:00
Kyle Stanley dfe726b1ac Fix Zope URL (GH-16880) 2019-10-22 05:43:10 -04:00
Dong-hee Na 2eba6ad7bf bpo-38493: Add os.CLD_KILLED and os.CLD_STOPPED. (GH-16821) 2019-10-21 10:01:05 +03:00
Batuhan Taşkaya 74142078b3 bpo-38531: document extend action's added version (GH-16865) 2019-10-20 13:13:54 -07:00
Raymond Hettinger c93883c6af
bpo-37759: More updates to Whatsnew 3.8 (GH-16854)
* math.perm() and math.comb()

* math.isqrt()

* Add singledispatchmethod()

* itertools.accumulate()

* Optional headers for xmlrpc.client.ServerProxy

* IDLE non-BMP characters

* import collections.abc directly

* @coroutine is deprecated

* pprint.pp()

* New options for object.__reduce__()

* DictReader no longer returns OrderedDicts

* "force" option for logging.basicConfig()

* Fix spelling

* cProfile context manager

* Various markup/grammar fixes from Kyle Stanley.
Other minor fixes as well.
Also, dedup the __reduce__ entry.

* Fix markup

* Fix grammar nits found by MS Word
2019-10-20 11:25:16 -07:00
Jon Dufresne 88eeda6311 Remove doc reference to unmaitained Nose package (GH-16849)
The Nose package is no longer maintained.
2019-10-19 12:22:20 -07:00
Jero Bado b1fa72a5b7 Fix minor typos in What's New in Python 3.8. (GH-16770)
Added periods at the end of the sentences.
2019-10-18 10:48:48 +03:00
Stéphane Wirtel 93b81e1fcb
Doc: Add missing entry for functools.cached_property (GH-16803) 2019-10-18 09:14:18 +02:00
Gregory P. Smith f33c57d5c7
bpo-33604: Raise TypeError on missing hmac arg. (GH-16805)
Also updates the documentation to clarify the situation surrounding
the digestmod parameter that is required despite its position in the
argument list as of 3.8.0 as well as removing old python2 era
references to "binary strings".

We indavertently had this raise ValueError in 3.8.0 for the missing
arg.  This is not considered an API change as no reasonable code would
be catching this missing argument error in order to handle it.
2019-10-17 20:30:42 -07:00
Ned Deily 3f36043db2
Update doc switcher list for 3.8.0 (GH-16809) 2019-10-15 17:26:05 -04:00
Julien Danjou 8d59eb1b66 bpo-37961, tracemalloc: add Traceback.total_nframe (GH-15545)
Add a total_nframe field to the traces collected by the tracemalloc module.
This field indicates the original number of frames before it was truncated.
2019-10-15 14:00:16 +02:00
Steve Dower 4d202281c1
bpo-38133: Update docs to reflect fixes to py.exe launcher (GH-16791) 2019-10-14 15:45:43 -07:00
Julien Palard 4504b4500d Doc: 3.8 is now stable. (GH-16790) 2019-10-14 18:13:38 -04:00
Raymond Hettinger 274bd013da
Remove draft status. Add asyncio REPL example (GH-16785) 2019-10-14 09:01:05 -07:00
Serhiy Storchaka 298439ce3f bpo-37759: Polish What's New in Python 3.8. (#16769) 2019-10-14 15:10:40 +02:00
Stein Karlsen aad2ee0156 bpo-32498: urllib.parse.unquote also accepts bytes (GH-7768) 2019-10-14 13:36:29 +03:00
Raymond Hettinger a3291531ea
bpo-37759: Add examples for the new typing features (GH-16763) 2019-10-13 23:32:03 -07:00
Raymond Hettinger 61a6db5e79
bpo-38461 and bpo-38463: Minor fixes to Whatsnew 3.8 (GH-16761)
* bpo-38461: ncurses misspelled as curses

* bpo-38463: Fix broken link
2019-10-13 21:31:12 -07:00
Raymond Hettinger 8a6cbf8adb
bpo-38464: Document parameter for NormalDist.quantiles() (GH-16757) 2019-10-13 19:53:30 -07:00
Sebastian Rittau fdfe2833ac bpo-38467: Fix argument name of typing functions (GH-16753) 2019-10-13 19:31:35 +01:00
Ivan Levkivskyi 8144095707 bpo-28556: Remove another mention of metaclass of Generic in typing docs (GH-16743)
Metaclass was removed in Python 3.7 (there is already a `versionchanged` item about this).


https://bugs.python.org/issue28556
2019-10-13 09:53:06 -07:00
Andrew Kuchling bb78f6cfa6
Rebased version of what's new PR (#16745)
* Use Unicode character for accent
* Various grammar fixes
* Sort library modules alphabetically; remove duplicated idlelib/IDLE section
2019-10-13 11:51:36 -04:00
Serhiy Storchaka 140a7d1f35
bpo-38378: Rename parameters "out" and "in" of os.sendfile(). (GH-16742)
They conflicted with keyword "in".

Also rename positional-only parameters of private os._fcopyfile()
for consistency.
2019-10-13 11:59:31 +03:00
Gregory P. Smith f3751efb5c
bpo-38417: Add umask support to subprocess (GH-16726)
On POSIX systems, allow the umask to be set in the child process before we exec.
2019-10-12 13:24:56 -07:00
Hugo van Kemenade 547c60c96e Fix minor typos in Whatsnew 2019-10-12 10:53:36 -07:00
Phil Jones e634da2747 Announce the change in the CancelledError inheritance (GH-16730)
This is a fairly noticeable change that requires adjustments in
existing asyncio code. It should therefore be announced.
2019-10-12 13:46:13 -04:00
Samuel Colvin 822922af90 bpo-35800: Deprecate smtpd.MailmanProxy (GH-11675)
Since `smtpd.MailmanProxy` is already broken, it is not formally deprecated in 3.9. It will be removed in 3.10.


https://bugs.python.org/issue35800
2019-10-12 10:24:26 -07:00
Serhiy Storchaka cbb548130c
bpo-38442: Remove an execution bit from Doc/whatsnew/3.8.rst. (GH-16715) 2019-10-11 11:44:42 +03:00
Kyle Stanley f900064ac4 docs: Add asyncio source code links (GH-16640) 2019-10-10 19:18:46 -04:00
M. Eric Irrgang d47f0dd2e8 bpo-32996: Documentation fix-up. (GH-16646)
PR #4906 changed the typing.Generic class hierarchy, leaving an
outdated comment in the library reference. User-defined Generic ABCs now
must get a abc.ABCMeta metaclass from something other than typing.Generic
inheritance.
2019-10-10 12:11:33 +01:00
Serhiy Storchaka d05b000c6b
bpo-38371: Tkinter: deprecate the split() method. (GH-16584) 2019-10-08 14:31:35 +03:00
Ricardo Bánffy 15ae75d660 bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. (GH-16442)
Prior to 3.7, re.escape escaped many characters that don't have
special meaning in Python, but that use to require escaping in other
tools and languages. This commit aims to make it clear which characters
were, but are no longer escaped.
2019-10-07 23:54:35 +03:00
Krishna Oza 038503e08a bpo-38391: Fixing a typo for Py_DECREF (GH-16616) 2019-10-07 19:57:45 +08:00
Serhiy Storchaka ef092fe990
bpo-25988: Do not expose abstract collection classes in the collections module. (GH-10596) 2019-10-07 12:10:15 +03:00
Adam J. Stewart 9e71917e02 bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
The `required` argument to `argparse.add_subparsers` was added in #3027. This PR specifies the earliest version of Python where it is available.


https://bugs.python.org/issue26510



Automerge-Triggered-By: @merwok
2019-10-06 19:08:48 -07:00
Joannah Nanjekye 8855e47d09 bpo-38266: Revert bpo-37878: Make PyThreadState_DeleteCurrent() Internal (GH-16558)
Revert the removal of PyThreadState_DeleteCurrent() with documentation.
2019-10-04 13:35:42 +02:00
Ashley Whetter 3142c667b5 bpo-38235: Correct some arguments names in logging documentation (GH-16571) 2019-10-04 08:55:14 +01:00
Victor Stinner 8462a4936b
bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509)
PyConfig_InitPythonConfig() and PyConfig_InitIsolatedConfig() no
longer return PyStatus: they cannot fail anymore.
2019-10-01 12:06:16 +02:00
Victor Stinner 3c30a76f3d
bpo-38304: Remove PyConfig.struct_size (GH-16500) (GH-16508)
For now, we'll rely on the fact that the config structures aren't covered by the stable ABI.

We may revisit this in the future if we further explore the idea of offering a stable embedding API.

(cherry picked from commit bdace21b76)
2019-10-01 10:56:37 +02:00
Maxwell A McKinnon cf57cabef8 bpo-32689: Updates shutil.move to allow for Path objects to be used as source arg (GH-15326)
Important work originally done by @emilyemorehouse two years ago and nearly ready to go in.

This bug has affected many people and in some cases has been a dealbreaker to the adoption of the otherwise wonderful pathlib and PEP519. https://stackoverflow.com/questions/33625931/copy-file-with-pathlib-in-python.

This adds the outstanding test request from that PR @vstinner (https://github.com/python/cpython/pull/5393).

Test fails without the change, passes with it, along with every other test in test_shutil.

Some variants were experimented with to make the one line change and the most performant one was picked.


# Added Test for PathLike directory destination, the current fail case

```
Lib/test/test_shutil.py::TestMove::test_move_file_pathlike FAILED                                                               [100%]

============================================================== FAILURES ===============================================================
__________________________________________________ TestMove.test_move_file_pathlike ___________________________________________________

self = <test.test_shutil.TestMove testMethod=test_move_file_pathlike>

    def test_move_file_pathlike(self):
        # Move a file to another location on the same filesystem.
        src = pathlib.Path(self.src_file)
>       self._check_move_file(src, self.dst_dir, self.dst_file)

Lib/test/test_shutil.py:1563:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Lib/test/test_shutil.py:1545: in _check_move_file
    shutil.move(src, dst)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py:562: in move
    real_dst = os.path.join(dst, _basename(src))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

path = PosixPath('/var/folders/r2/psq74t5x3nbfzlph8bh2pvdw0000gn/T/tmp9ie0wh9_/foo')

    def _basename(path):
        # A basename() variant which first strips the trailing slash, if present.
        # Thus we always get the last component of the path, even for directories.
        sep = os.path.sep + (os.path.altsep or '')
>       return os.path.basename(path.rstrip(sep))
E       AttributeError: 'PosixPath' object has no attribute 'rstrip'

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py:526: AttributeError
============================================== 1 failed, 102 deselected in 0.30 seconds ===============================================
```

After change:

```
========================================================= test session starts =========================================================
platform darwin -- Python 3.7.4, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 -- /Users/maxwellmckinnon/.venvs/TA3.7/bin/python3.7
cachedir: .pytest_cache
rootdir: /Users/maxwellmckinnon/dev/cpython
plugins: cov-2.7.1, mock-1.10.4
collected 103 items / 102 deselected / 1 selected

Lib/test/test_shutil.py::TestMove::test_move_file_pathlike PASSED                                                               [100%]

============================================== 1 passed, 102 deselected in 0.06 seconds ===============================================
```

Running all the tests in test_shutil.py
```
╰─ pytest Lib/test/test_shutil.py -v
========================================================= test session starts =========================================================
platform darwin -- Python 3.7.4, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 -- /Users/maxwellmckinnon/.venvs/TA3.7/bin/python3.7
cachedir: .pytest_cache
rootdir: /Users/maxwellmckinnon/dev/cpython
plugins: cov-2.7.1, mock-1.10.4
collected 103 items

Lib/test/test_shutil.py::TestShutil::test_chown PASSED                                                                          [  0%]
Lib/test/test_shutil.py::TestShutil::test_copy PASSED                                                                           [  1%]
...
Lib/test/test_shutil.py::TermsizeTests::test_stty_match SKIPPED                                                                 [ 99%]
Lib/test/test_shutil.py::PublicAPITests::test_module_all_attribute PASSED                                                       [100%]

================================================ 96 passed, 7 skipped in 1.25 seconds =================================================
```

# Performance Considerations
Is it considered poor form to get rid of _basename altogether and make use of pathlib in the move function? I'm not sure if the idea is for all these modules to strictly avoid circular dependencies. They are already using os.path which is just as much a citizen in 3.8 as pathlib right?

e.g.

`real_dst = os.path.join(dst, _basename(src))`
becomes
`real_dst = Path(dst) / Path(src).name`

I've looked around and familiarized myself, and I now think importing pathlib here is fine. My only remaining concern is that of performance.

Here's the performance difference for this step. 

```
In [46]: %timeit real_dst = os.path.join("a/b/c", _basename('b/'))
2.71 µs ± 62.6 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

In [47]: %timeit real_dst = Path("a/b/c") / Path('b/').name
12.4 µs ± 65.3 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
```

Is 10us significant or insignificant compared to the least expensive operation this function will do? I don't know. Let's find out.

```
In [55]: %timeit os.rename('/tmp/a/a.txt', '/tmp/a/b.txt'); os.rename('/tmp/a/b.txt', '/tmp/a/a.txt')
124 µs ± 2.18 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
```
62us to rename. 10us seems significant enough that we wouldn't want to favor the Path sugar suggestion. 16% speed decrease from adding the 10us.

What do people think? I was hoping to get to use pathlib.Path here, but I suspect for this low level move, it should be as fast as possible, and 16% is not worth one line of sugary code to me.



https://bugs.python.org/issue32689



Automerge-Triggered-By: @gvanrossum
2019-09-30 19:41:16 -07:00
Kyle Stanley e407013089 Fix and improve `asyncio.run()` docs (GH-16403) 2019-09-30 17:12:21 -07:00
Yury Selivanov 6758e6e12a
bpo-38242: Revert "bpo-36889: Merge asyncio streams (GH-13251)" (#16482)
See https://bugs.python.org/issue38242 for more details
2019-09-29 21:59:55 -07:00
Lisa Roach 3667e1ee6c
bpo-38163: Child mocks detect their type as sync or async (GH-16471) 2019-09-29 21:56:47 -07:00
Victor Stinner fb4ae152a9
bpo-38317: Fix PyConfig.warnoptions priority (GH-16478)
Fix warnings options priority: PyConfig.warnoptions has the highest
priority, as stated in the PEP 587.

* Document options order in PyConfig.warnoptions documentation.
* Make PyWideStringList_INIT macro private: replace "Py" prefix
  with "_Py".
* test_embed: add test_init_warnoptions().
2019-09-30 01:40:17 +02:00
Pascal Chambon c5a7e0ce19 bpo-37408: Precise that Tarfile "format" argument only concerns writing. (GH-14389) 2019-09-28 08:04:44 -07:00
Victor Stinner 441b10cf28
bpo-38304: Add PyConfig.struct_size (GH-16451)
Add a new struct_size field to PyPreConfig and PyConfig structures to
allow to modify these structures in the future without breaking the
backward compatibility.

* Replace private _config_version field with public struct_size field
  in PyPreConfig and PyConfig.
* Public PyPreConfig_InitIsolatedConfig() and
  PyPreConfig_InitPythonConfig()
  return type becomes PyStatus, instead of void.
* Internal _PyConfig_InitCompatConfig(),
  _PyPreConfig_InitCompatConfig(), _PyPreConfig_InitFromConfig(),
  _PyPreConfig_InitFromPreConfig() return type becomes PyStatus,
  instead of void.
* Remove _Py_CONFIG_VERSION
* Update the Initialization Configuration documentation.
2019-09-28 04:28:35 +02:00
bariod dd6117c6d7 Fix typo in the "Porting to Python 3.8" section. (GH-16435) 2019-09-27 21:01:33 +03:00
Ammar Askar 5faff977ad bpo-38206: Clarify tp_dealloc requirements for heap allocated types. (GH-16248)
As mentioned in the bpo ticket, this mistake came up on two reviews:
- https://github.com/python/cpython/pull/16127#pullrequestreview-288312751
- https://github.com/python/cpython/pull/16071#pullrequestreview-287819525

Would be nice to have it documented in a more permanent place than 3.8's whatsnew entry.


https://bugs.python.org/issue38206



Automerge-Triggered-By: @encukou
2019-09-27 04:11:27 -07:00
Prateek Nayak a7414571a1 bpo-38244: [Documentation] Fix unreliable link to sever in ftplib.rst (#16319) 2019-09-26 17:22:31 +08:00
Mohammad Dehghan 1ad7be2f16 bpo-38130: Fix error in explaining when an exception is re-raised (GH-16016)
Co-Authored-By: Ashwin Ramaswami <aramaswamis@gmail.com>
2019-09-26 11:09:05 +02:00
Kyle Stanley 6a10d59541 Doc: Several fixes and improvements for 3.9 whatsnew (GH-16375) 2019-09-26 09:06:46 +02:00
Stéphane Wirtel 5d326abf2c
Doc: Use the `with` statement in the first example of the ftplib doc. (GH-16271) 2019-09-26 09:01:18 +02:00
Lumír 'Frenzy' Balhar 8e7bb991de bpo-38112: Compileall improvements (GH-16012)
* Raise the limit of maximum path depth to actual  recursion limit

* Add posibilities to adjust a path compiled in .pyc  file.

Now, you can:
- Strip a part of path from a beggining of path into compiled file
   example "-s /test /test/build/real/test.py" → "build/real/test.py"
- Append some new path to a beggining of path into compiled file
   example "-p /boo real/test.py" → "/boo/real/test.py"

You can also use both options in the same time. In that case,
striping is done before appending.

* Add a possibility to specify multiple optimization levels

Each optimization level then leads to separated compiled file.
Use `action='append'` instead of `nargs='+'` for the -o option.
Instead of `-o 0 1 2`, specify `-o 0 -o 1 -o 2`. It's more to type,
but much more explicit.

* Add a symlinks limitation feature

This feature allows us to limit byte-compilation of symbolic
links if they are pointing outside specified dir (build root
for example).
2019-09-26 08:28:26 +02:00
Victor Stinner 88feaecd46
bpo-38234: Complete init config documentation (GH-16404) 2019-09-26 03:15:07 +02:00
Victor Stinner 8bf39b606e
bpo-38234: Add test_init_setpath_config() to test_embed (GH-16402)
* Add test_embed.test_init_setpath_config(): test Py_SetPath()
  with PyConfig.
* test_init_setpath() and test_init_setpythonhome() no longer call
  Py_SetProgramName(), but use the default program name.
* _PyPathConfig: isolated, site_import  and base_executable
  fields are now only available on Windows.
* If executable is set explicitly in the configuration, ignore
  calculated base_executable: _PyConfig_InitPathConfig() copies
  executable to base_executable.
* Complete path config documentation.
2019-09-26 02:22:35 +02:00
Raymond Hettinger 15ccc4fac0
bpo-38255: super() can search attributes as well as methods (GH-16368)
Improvement suggested by Géry Ogam.
2019-09-25 08:13:19 -07:00
Petr Viktorin 468f8a6ee0
bpo-38140: Document offsets in PyMemberDef (GH-16354)
bpo-38140: Document offsets in PyMemberDef

Co-Authored-By: Ammar Askar <ammar_askar@hotmail.com>
2019-09-25 13:06:16 +02:00
Emmanuel Arias 17deb16883 bpo-38260: Add Docs on asyncio.run (GH-16337)
Add docs about return and raise exception on asyncio.run





https://bugs.python.org/issue38260



Automerge-Triggered-By: @asvetlov
2019-09-25 01:53:49 -07:00
Victor Stinner 1ce152a42e
bpo-38234: Py_SetPath() uses the program full path (GH-16357)
Py_SetPath() now sets sys.executable to the program full path
(Py_GetProgramFullPath()), rather than to the program name
(Py_GetProgramName()).

Fix also memory leaks in pathconfig_set_from_config().
2019-09-24 17:44:15 +02:00
Lisa Roach ef04851775
bpo-38136: Updates await_count and call_count to be different things (GH-16192) 2019-09-23 20:49:40 -07:00
Victor Stinner fcdb027234
bpo-38236: Dump path config at first import error (GH-16300)
Python now dumps path configuration if it fails to import the Python
codecs of the filesystem and stdio encodings.
2019-09-23 14:45:47 +02:00
Kyle Stanley 030fe8e34d Doc: Add whatsnew entry for loop.shutdown_default_executor() (GH-16308) 2019-09-21 08:18:40 +02:00
Ammar Askar 87d6cd3604 bpo-38237: Make pow's arguments have more descriptive names and be keyword passable (GH-16302)
Edit: `math.pow` changes removed on Mark's request.


https://bugs.python.org/issue38237



Automerge-Triggered-By: @rhettinger
2019-09-20 21:28:49 -07:00
Kyle Stanley 77af2290e5 Doc: Remove provisional note for asyncio.run() (GH-16310)
Based on a comment from @asvetlov https://github.com/python/cpython/pull/15735#discussion_r323619076, this removes the provisional note for ``asyncio.run()`` in the documentation.

Automerge-Triggered-By: @1st1
2019-09-20 16:46:21 -07:00
Ram Rachum 9c2682efc6 bpo-37937: Mention frame.f_trace in sys.settrace docs (GH-15439)
Mention frame.f_trace in sys.settrace docs, as well as the fact you still
need to call `sys.settrace` to enable the tracing machinery before setting
`frame.f_trace` will have any effect.
2019-09-21 01:19:02 +10:00
Prateek Nayak 062cfe3b11 bpo-37353: Updated parser note about source code compatibility(GH-14277) 2019-09-20 08:55:26 -05:00
Lisa Roach 8b03f943c3
bpo-38093: Correctly returns AsyncMock for async subclasses. (GH-15947) 2019-09-19 21:04:18 -07:00
Eddie Elizondo 3368f3c6ae bpo-38140: Make dict and weakref offsets opaque for C heap types (#16076)
* Make dict and weakref offsets opaque for C heap types

* Add news
2019-09-19 17:29:05 +01:00
Kyle Stanley 9fdc64cf12 bpo-34037: Fix test_asyncio failure and add loop.shutdown_default_executor() (GH-15735) 2019-09-19 15:47:22 +03:00
toonarmycaptain 3171d67a6a Doc: Clarify dict equality irrespective of ordering. (GH-16266) 2019-09-19 07:51:23 +02:00
Jason Plurad 9ab6038fe8 Doc: Corrected syntax for return annotation (GH-16265)
Signed-off-by: Jason Plurad <pluradj@us.ibm.com>
2019-09-19 07:24:29 +02:00
Victor Stinner 0a963fbc9c
bpo-38203: faulthandler.dump_traceback_later() is always available (GH-16249)
dump_traceback_later() and cancel_dump_traceback_later() functions of
the faulthandler module are always available since Python 3.7.
2019-09-18 14:15:10 +02:00
Diego Alberto Barriga Martínez b57481318e bpo-37904: Edition on python tutorial - section 4 (GH-16169)
A little change on first paragraph of python tutorial to be more clearly



https://bugs.python.org/issue37904



Automerge-Triggered-By: @ericvsmith
2019-09-17 09:57:55 -07:00
Jörn Heissler 219fb9d65e Doc: Fix grammar/spelling in ssl.VERIFY_CRL_CHECK_LEAF docs (GH-16221) 2019-09-17 12:42:30 +02:00
Hrvoje Nikšić 5d359cc62e bpo-38192: Fix remaining passing of "loop" in the protocol examples (GH-16202)
See https://bugs.python.org/issue38192 .



https://bugs.python.org/issue38192
2019-09-17 00:16:43 -07:00
Adorilson Bezerra 63dedef48b Doc: Add list(dict) in stdtypes library (GH-16209) 2019-09-17 06:57:14 +02:00
Ivan Levkivskyi 81528ba2e8
bpo-28556: Update the opening note in typing docs (GH-16204)
This PR replaces the old note mentioning that `typing` is a provisional module with a new one mentioning types are not enforced at runtime. I am not sure if there was any official announcement about making `typing` non-provisional, but _de-facto_ no new features were added during Python 3.7, and no backwards incompatible changes were made except for few small things that were considered bugs.
2019-09-16 23:04:06 +01:00
Adorilson Bezerra f18242be16 Doc: Add link of GNU Readline library to interpreter tutorial (GH-16152) 2019-09-16 18:18:04 +02:00
Adorilson Bezerra b7af4e7565 Doc: remove duplicate word in controlflow tutorial (GH-16163) 2019-09-16 09:04:58 +02:00
Hrvoje Nikšić c717c73fa3 bpo-38178: Don't explicitly pass "loop" to EchoClientProtocol. (GH-16159)
https://bugs.python.org/issue38178
2019-09-15 10:06:02 -07:00
t k 8b31a11a69 bpo38158: Removing nonexistant member "doc" from PyType_Spec documentation (GH-16142) 2019-09-15 07:50:05 +01:00
Kyle Stanley ff603f6c3d bpo-37635: Update arg name for seek() in IO tutorial (GH-16147)
Typically, the second positional argument for ``seek()`` is *whence*. That is the POSIX standard name (http://man7.org/linux/man-pages/man3/lseek.3p.html) and the name listed in the documentation for ``io`` module (https://docs.python.org/3/library/io.html#io.IOBase.seek). 

The tutorial for IO is the only location where the second positional argument for ``seek()`` is referred to as *from_what*. I suspect this was created at an early point in Python's history, and was never updated (as this section predates the GitHub repository):

```
$ git grep "from_what"
Doc/tutorial/inputoutput.rst:To change the file object's position, use ``f.seek(offset, from_what)``.  The position is computed
Doc/tutorial/inputoutput.rst:the *from_what* argument.  A *from_what* value of 0 measures from the beginning
Doc/tutorial/inputoutput.rst:the reference point.  *from_what* can be omitted and defaults to 0, using the
```

For consistency, I am suggesting that the tutorial be updated to use the same argument name as the IO documentation and POSIX standard for ``seek()``, particularly since this is the only location where *from_what* is being used.

Note: In the POSIX standard, *whence* is technically the third positional argument, but the first argument *fildes* (file descriptor) is implicit in Python.


https://bugs.python.org/issue37635
2019-09-14 13:29:23 -07:00
Anthony Sottile a26ace19bd Doc: Fix link to window.getch in curses documentation (GH-16132) 2019-09-14 07:17:09 +01:00
Xtreak bdd6945d4d bpo-33095: Add reference to isolated mode in -m and script option (GH-7764)
Attempt to make isolated mode easier to discover via additional inline documentation.

Co-Authored-By: Julien Palard <julien@palard.fr>
2019-09-14 10:35:44 +10:00
Eric O. LEBIGOT (EOL) 77cd0ceab2 Doc: fcntl.lockf() is more powerful than written (GH-6750) 2019-09-13 18:32:28 +01:00
bchhabra2490 d44542f9a2 bpo-32790: Add info about alt format using # for 'g' in chart (GH-6624) 2019-09-13 18:20:21 +01:00
Windson yang 9585f46b97 bpo-26468: Doc: improve the documentation of shutil.copy2 when it can fail. (GH-13765) 2019-09-13 14:36:09 +01:00
Julien Palard 375a3e2bdb
bpo-29986: Doc: Delete tip to raise TypeError from tp_richcompare. (GH-16095) 2019-09-13 15:07:37 +02:00
Kexuan Sun 53f78ec9e1 Doc: Improve consistency of os.path.normcase with other os.path functions (GH-14004) 2019-09-13 14:01:02 +01:00
Ashwin Ramaswami ff2e182865 bpo-12707: deprecate info(), geturl(), getcode() methods in favor of headers, url, and status properties for HTTPResponse and addinfourl (GH-11447)
Co-Authored-By: epicfaace <aramaswamis@gmail.com>
2019-09-13 12:40:07 +01:00
Xtreak d31b31516c bpo-36889: Document Stream class and add docstrings (GH-14488)
* This just copies the docs from `StreamWriter` and `StreamReader`.
* Add docstring for asyncio functions.


https://bugs.python.org/issue36889



Automerge-Triggered-By: @asvetlov
2019-09-13 03:52:38 -07:00
Rémi Lapeyre 6a517c6749 bpo-8538: Add support for boolean actions to argparse (GH-11478)
Co-Authored-By: remilapeyre <remi.lapeyre@henki.fr>
2019-09-13 11:17:43 +01:00
Kishore Vancheeshwaran 7183064e9e Doc: Add example snippet for str.isupper() (GH-14681) 2019-09-13 10:20:01 +01:00
Christian Heimes 7cad53e6b0 bpo-9216: Add usedforsecurity to hashlib constructors (GH-16044)
The usedforsecurity keyword only argument added to the hash constructors is useful for FIPS builds and similar restrictive environment with non-technical requirements that legacy algorithms be forbidden by their implementations without being explicitly annotated as not being used for any security related purposes.  Linux distros with FIPS support benefit from this being standard rather than making up their own way(s) to do it.

Contributed and Signed-off-by: Christian Heimes christian@python.org
2019-09-12 19:30:00 -05:00
Patrick McLean 2b2ead7438 bpo-36046: Add user and group parameters to subprocess (GH-11950)
* subprocess: Add user, group and extra_groups paremeters to subprocess.Popen

This adds a `user` parameter to the Popen constructor that will call
setreuid() in the child before calling exec(). This allows processes
running as root to safely drop privileges before running the subprocess
without having to use a preexec_fn.

This also adds a `group` parameter that will call setregid() in
the child process before calling exec().

Finally an `extra_groups` parameter was added that will call
setgroups() to set the supplimental groups.
2019-09-12 18:15:44 +01:00
Matti Picus 57b7dbc46e Emphasize the need to always call PySequence_Fast. (GH-11140) 2019-09-12 17:19:06 +01:00
Hai Shi b1a2abdb06 bpo-37908: Add an example of ArgumentParser.exit() (GH-15455)
Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>
2019-09-12 16:34:24 +01:00
Raymond Hettinger 4210ad5ebd
bpo-38096: Complete the "structseq" and "named tuple" cleanup (GH-16010) 2019-09-12 07:56:28 -07:00
Julien Palard a45b0efdea Doc: Add -m reference in context of code execution (GH-16045) 2019-09-12 14:19:06 +01:00
Christian Heimes ed4b3216e5 bpo-37363: Document internal audit events (GH-14663)
Three internal cpython events were not documented, yet.

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



https://bugs.python.org/issue37363
2019-09-12 06:13:02 -07:00
Andrew Svetlov a488879cba
bpo-36373: Deprecate explicit loop in task and subprocess API (GH-16033) 2019-09-12 15:40:40 +03:00
Brandt Bucher 224b8aaa7e bpo-26868: Fix example usage of PyModule_AddObject. (#15725)
* Add a note to the PyModule_AddObject docs.

* Correct example usages of PyModule_AddObject.

* Whitespace.

* Clean up wording.

* 📜🤖 Added by blurb_it.

* First code review.

* Add < 0 in the tests with PyModule_AddObject
2019-09-12 13:11:20 +01:00
Windson yang 967b84c913 bpo-35325: Doc: imp.find_module() return value documentation discrepancy (GH-11040) 2019-09-12 14:10:50 +02:00
Emmanuel Arias 31a82e25b6 bpo-35685: Add examples of unittest.mock.patch.dict usage (GH-11456) 2019-09-12 13:29:54 +02:00
Julien Palard 2c910c1e73 bpo-36675: Remove obsolete code. (GH-16024)
Does no longer work since Sphinx moved the trim_doctest_flag option in
the configuration.
2019-09-12 12:23:53 +01:00
Christian Heimes 894d0f7d55 bpo-32008: Prefer client or TLSv1_2 in examples (GH-5797)
Prefer client or TLSv1_2 in examples

Signed-off-by: Christian Heimes <christian@python.org>
2019-09-12 12:10:05 +01:00
Hai Shi f545638b57 bpo-9938: Add optional keyword argument exit_on_error to argparse.ArgumentParser (GH-15362)
Co-Authored-by: Xuanji Li <xuanji@gmail.com>


https://bugs.python.org/issue9938



Automerge-Triggered-By: @matrixise
2019-09-12 03:56:05 -07:00
Harmandeep Singh 2d32bf1ef2 bpo-13927: time.ctime and time.asctime return string explantion (GH-11303)
* bpo-13927: time.ctime and time.asctime return string explantion

* Add note explaining that time.ctime and time.asctime returns a space padded date value in case it contains a single digit date

* Reformat linebreaks
2019-09-12 11:22:30 +01:00
Georgy Frolov 7544497ad3 Doc: Add example of dict() function with positional and keyword arguments (GH-15220) 2019-09-12 10:41:36 +01:00
Joannah Nanjekye 92777d5e5a bpo-18578: Rename and document test.bytecode_helper as test.support.bytecode_helper (GH-15168)
Rename and document test.bytecode_helper as test.support.bytecode_helper
2019-09-12 10:02:59 +01:00
Géry Ogam 891e9e3b44 Correct typos in the codecs module documentation (#15135) 2019-09-12 08:41:32 +01:00
Björn Meier 9936371af2 bpo-36270: Doc: add link to traceback object reference (GH-13119) 2019-09-11 19:55:02 +02:00
Hai Shi 15f5a7527b bpo-37698: Update doc of PyBuffer_ToContiguous (GH-14992)
https://bugs.python.org/issue37698
2019-09-11 10:25:55 -07:00
Marc e24594bfe7 Doc: recursive glob ** follows symlinks to directories (GH-12918) 2019-09-11 19:17:05 +02:00
Joannah Nanjekye 8d120f75fb bpo-28724: Add methods send_fds and recv_fds to the socket module (GH-12889)
The socket module now has the socket.send_fds() and socket.recv.fds() functions.
Contributed by Joannah Nanjekye, Shinya Okano (original patch)
and Victor Stinner.

Co-Authored-By: Victor Stinner <vstinner@redhat.com>
2019-09-11 19:12:21 +02:00
Hai Shi 5a56ce4a0e bpo-37750: Add doc of PyBuffer_FromContiguous (GH-15988)
https://bugs.python.org/issue37750



Automerge-Triggered-By: @matrixise
2019-09-11 09:38:47 -07:00
Julien Palard 1fae844451 Doc: Fix missing negation. (GH-14640)
Reported by Hug Capella on docs@.



Automerge-Triggered-By: @matrixise
2019-09-11 08:55:22 -07:00
toonarmycaptain 0cc27417f2 Improve clarity of try-return-finally-return (GH-15677)
Clarify execution in try-return-finally-return case.
2019-09-11 17:37:13 +02:00
Lysandros Nikolaou af636f4f91 bpo-36182: Update pathlib.Path.write_text() docs (GH-12161)
with the case of an existing file
2019-09-11 17:08:10 +02:00
JunWei Song 3ba51d587f bpo-36260: Add pitfalls to zipfile module documentation (#13378)
* bpo-36260: Add pitfalls to zipfile module documentation

We saw vulnerability warning description (including zip bomb) in Doc/library/xml.rst file.
This gave us the idea of documentation improvement. 

So, we moved a little bit forward :P
And the doc patch can be found (pr).

* fix trailing whitespace

* 📜🤖 Added by blurb_it.

* Reformat text for consistency.
2019-09-11 16:04:11 +01:00
Géry Ogam 3b58a70d9c Improve the io module documentation (GH-15099)
* Update io.rst

* Apply suggestions from code review

Co-Authored-By: Ashwin Ramaswami <aramaswamis@gmail.com>

Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
2019-09-11 15:55:13 +01:00
Emily Morehouse 6357c95716 bpo-35224: Additional documentation for Assignment Expressions (GH-15935)
Add or update assignment expression documentation for:
- FAQ - Design
- Reference - Expressions
- Reference - Lexical Analysis


https://bugs.python.org/issue35224



Automerge-Triggered-By: @matrixise
2019-09-11 07:37:12 -07:00
Simon Willison 1abf54336f Doc: Indicate locations of parse_qs, parse_qsl, escape (GH-14828)
Since they have been removed from cgi it's useful to remind people where they
can be found instead.
2019-09-11 16:25:25 +02:00
Andrew Scheller 51adfc6ed2 Update ftplib.all_errors documentation to match code (#15026)
The documentation doesn't mention the `EOFError` that https://github.com/python/cpython/blob/master/Lib/ftplib.py#L66 includes
2019-09-11 16:18:00 +02:00
Raymond Hettinger 7117074410 bpo-38096: Clean up the "struct sequence" / "named tuple" docs (GH-15895)
* bpo-38096: Clean up the "struct sequence" / "named tuple" docs

* Fix remaining occurrences of "struct sequence"

* Repair a user visible docstring
2019-09-11 15:17:32 +01:00
Xtreak 7b69069e9a bpo-37651: Document CancelledError is now a subclass of BaseException (GH-15950)
https://bugs.python.org/issue37651



Automerge-Triggered-By: @1st1
2019-09-11 07:12:51 -07:00
Anjali Bansal 97b817eae3 bpo-33187: Document ElementInclude (XInclude) support in ElementTree (GH-8861) 2019-09-11 15:09:53 +01:00
Brennan D Baraban 1660a61a10 bpo-23460: Fix documentation for decimal string :g formatting (GH-11850) 2019-09-11 15:59:37 +02:00
Joannah Nanjekye 1a53c785e6 bpo-37488 : Document a warning for datetime.utcnow() and utcfromtimestamp() (GH-15773)
https://bugs.python.org/issue37488



Automerge-Triggered-By: @pganssle
2019-09-11 06:58:42 -07:00
hui shang 088a09af4b bpo-31163: Added return values to pathlib.Path instance's rename and replace methods. (GH-13582)
* bpo-31163: Added return values to pathlib.Path instance's rename and replace methods.
2019-09-11 14:26:49 +01:00
native-api f9b5840fb4 bpo-33944: note about the intended use of code in .pth files (GH-10131)
https://bugs.python.org/issue33944
2019-09-11 06:21:04 -07:00
Andre Delfino dc26997109 bpo-33459: Fix "tuple displays" term in Expressions.rst (GH-6760)
https://bugs.python.org/issue33459



Automerge-Triggered-By: @matrixise
2019-09-11 06:16:11 -07:00
Géry Ogam 781266ebb6 bpo-35640: Allow passing PathLike arguments to SimpleHTTPRequestHandler (GH-11398) 2019-09-11 14:03:46 +01:00
Julien Palard e1d455f3a3 Doc: Use walrus operator in example. (GH-15934) 2019-09-11 15:01:18 +02:00
Ashwin Ramaswami 62cf698142 bpo-35649: update http client example (GH-11441) 2019-09-11 14:41:54 +02:00
Tim Hoffmann 1a13efb7e0 Minor ReST formatting fixes in subprocess docs (#14876) 2019-09-11 13:26:31 +02:00
Xtreak c78dae8d2b bpo-35603: Add a note on difflib table header interpreted as HTML (GH-11439) 2019-09-11 13:21:30 +02:00
Alex 972cf5c06a bpo-35168: Make shlex.punctuation_chars read-only (#11631)
* bpo-35168: Documentation about shlex.punctuation_chars now states that it should be set in __init__.py

* bpo-35168: Convert shlex.punctuation_chars to read-only property

* Add NEWS.d entry
2019-09-11 12:04:04 +01:00
Xtreak 6a9fd66f6e bpo-32972: Document IsolatedAsyncioTestCase of unittest module (GH-15878)
* Document `unittest.IsolatedAsyncioTestCase` API
* Add a simple example with respect to order of evaluation of setup and teardown calls.


https://bugs.python.org/issue32972



Automerge-Triggered-By: @asvetlov
2019-09-11 04:02:14 -07:00
Ezio Melotti 2d8d597bb8 bpo-38103: fix conflicting labels in the docs. (GH-15906) 2019-09-11 11:57:59 +01:00
smokephil 7a0023e8d1 bpo-25810: Clarify eval() docs, it does not keywords (GH-15173) 2019-09-11 05:30:04 -05:00
Kyle Stanley 6472ece5a0 bpo-37585: Add clarification regarding comparing dict.values() (GH-14954) 2019-09-11 11:01:41 +01:00
Anjali 4576b5431b bpo-16438: Doc: confusing text regarding numeric precedence corrected (GH-10521) 2019-09-11 11:58:27 +02:00
Brad 3fb1363fe8 Overhaul datetime documentation (GH-13410)
This is a restructuring of the datetime documentation to hopefully make
them more user-friendly and approachable to new users without losing any
of the detail.

Changes include:
 - Creating dedicated subsections for some concepts such as:
    - "Constants"
    - "Naive vs Aware"
    - "Determining if an Object is Aware"
 - Give 'naive vs aware' its own subsection
 - Give 'constants' their own subsection
 - Overhauling the strftime-strptime section by:
    - Breaking it into logical, linkable, and digestable parts
    - Adding a high-level comparison table
    - Moving the technical detail to bottom: readers come to this
      section primarily to remind themselves to things:
      - How do I write the format code for X?
      - strptime/strftime: which one is which again?
 - Touching up fromisoformat + isoformat sections by:
    - Revising fromisoformat + isoformat for date, time, and
      datetime
    - Adding basic examples
    - Enforcing consistency about putting formats (i.e. ``HH:MM``)
      in double backticks.  This was previously done in some places
      but not all
    - Putting long 'supported formats', on their own line to improve
      readability
 - Moving the 'seealso' section to the top and add a link to dateutil
    Rationale: This doesn't really belong nested under the
    'constants' section.  Let readers know right away that
    datetime is one of several related tools.
 - Moving common features of several types into one place:
    Previously, each type went out of its way to note separately
    that it was hashable and picklable.  These can be brought
    into one single place that is more prominent.
 - Reducing some verbose explanations to improve readability
 - Breaking up long paragraphs into digestable chunks
 - Displaying longer "equivalent to" examples, as short code blocks
 - Using the dot notation for datetime/time classes:
    Use :class:`.time` and :class:`.datetime` rather than :class:`time` and
    :class:`datetime`; otherwise, the generated links will route to the
    respective modules, not classes.
 - Rewording the tzinfo class description
    The top paragraph should get straight to the point of telling the reader
    what subclasses of tzinfo _do_.  Previously, that was hidden in a later
    paragraph.
 - Adding a note on .today() versus .now()
 - Rearranging and expanding example blocks, including:
    - Moved long, multiline inline examples to standalone examples
    - Simplified the example block for timedelta arithmetic:
        - Broke the example into two logical sections:
          1. normalization/parameter 'merging'
          2. timedelta arithmetic
        - Reduced the complexity of the some of the examples.  Show
          reasonable, real-world uses cases that are easy to follow
          along with and progres in difficult slightly.
    - Broke up the example sections for date and datetime sections by putting
      the easy examples first, progressing to more esoteric situations and
      breaking it up into logical sections based on what the methods are
      doing at a high level.
    - Simplified the KabulTz example:
        - Put the class definition itself into a non-REPL block since there is
          no interactive output involved there
        - Briefly explained what's happening before launching into the code
        - Broke the example section into visually separate chunks
 - Various whitespace, formatting, style and grammar fixes including:
    - Consistently using backctics for 'date_string' formats
    - Consistently using one space after periods.
    - Consistently using bold for vocab terms
    - Consistently using italics when referring to params:
      See https://devguide.python.org/documenting/#id4
    - Using '::' to lead into code blocks
        Per https://devguide.python.org/documenting/#source-code, this will
        let the reader use the 'expand/collapse' top-right button for REPL
        blocks to hide or show the prompt.
    - Using consistent captialization schemes
    - Removing use of the default role
    - Put 'example' blocks in Markdown subsections

This is a combination of 66 commits.

See bpo-36960: https://bugs.python.org/issue36960
2019-09-11 10:19:05 +01:00
wwuck efd5741ae9 bpo-38034: Fix typo in logging.handlers.rst (GH-15708) 2019-09-11 07:44:37 +01:00
jdkandersson 9cbb97b29e bpo-37574: Mention helper functions for find_spec documentation (GH-14739) 2019-09-10 17:06:22 +01:00
Andre Delfino 912108891d bpo-33602: Doc: Remove set and queue references from Data Types (GH-7055) 2019-09-10 17:11:16 +02:00
Kyle Stanley b6dafe5139 Docs: Small tweaks to c-api/intro#Include_Files (GH-14698) 2019-09-10 16:09:34 +01:00
William Andrea faff81c05f Correct info about "f.read(size)". (GH13852)
In text mode, the "size" parameter indicates the number of characters, not bytes.
2019-09-10 15:50:26 +01:00
Andre Delfino 05184515f9 Correct minor grammatical mistake in open docs (GH-15865) 2019-09-10 15:48:05 +01:00
Dmitry Shachnev c3d679fd39 bpo-37504: Fix documentation build with texinfo builder (GH-14606)
In the table model used by docutils, the `cols` attribute of `tgroup`
nodes is mandatory, see [1]. It is used in texinfo builder in [2].

[1]: https://www.oasis-open.org/specs/tm9901.htm#AEN348
[2]: https://github.com/sphinx-doc/sphinx/blob/v2.1.2/sphinx/writers/texinfo.py#L1129

* Doc: Add texinfo support to the Makefile
2019-09-10 15:40:50 +01:00
Steve Dower a39a4c7439
bpo-37913: Link to NotImplemented from new docs (GH-15860) 2019-09-10 15:25:12 +01:00
Jeroen Demeyer 009ef2955d bpo-37913: document that __length_hint__ can return NotImplemented (GH-15383) 2019-09-10 15:01:13 +01:00
Jason R. Coombs 17499d8270 bpo-38086: Sync importlib.metadata with importlib_metadata 0.21. (GH-15840)
https://gitlab.com/python-devs/importlib_metadata/-/tags/0.21
2019-09-10 14:53:31 +01:00
Zach Thompson c2f056be82 Fix typo in ssl.RAND_bytes documentation (GH-14791)
It looks like "cryptographically strong" is the preferred phrase from the surrounding documentation.

Automerge-Triggered-By: @tiran
2019-09-10 06:40:14 -07:00
Andre Delfino c1d8c1cb8e Note regarding + mode truncation applies to both text and binary mode (#11314)
* Improve doc on open's mode +

* Improve wording

* Address comment from Rémi
2019-09-10 14:04:22 +01:00
Arun Persaud 9a94093189 bpo-21018: added missing documentation about escaping characters for configparser (GH-6137)
Document how $ and % can be escaped in configparser.
2019-09-10 14:51:09 +02:00
Emmanuel Arias 9008be303a bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [queue] (GH-13950)
This PR deprecate explicit loop parameters in all public asyncio APIs

This issues is split to be easier to review.

fourth step: queue.py





https://bugs.python.org/issue36373
2019-09-10 04:46:12 -07:00
Emmanuel Arias 537877d85d bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [locks] (GH-13920)
This PR deprecate explicit loop parameters in all public asyncio APIs

This issues is split to be easier to review.

Third step: locks.py





https://bugs.python.org/issue36373
2019-09-10 03:55:07 -07:00
Jeroen Demeyer 9669931e5e bpo-36971: add subsections in C API "Common Object Structures" page (#13446) 2019-09-10 11:41:59 +01:00
Xtreak c8dfa7333d bpo-37052: Add examples for mocking async iterators and context managers (GH-14660)
Add examples for mocking asynchronous iterators and asynchronous context managers.


https://bugs.python.org/issue37052
2019-09-10 03:37:17 -07:00
Nikhil 80428ed4e1 bpo-25237: Documentation for tkinter modules (GH-1870) 2019-09-10 10:55:34 +02:00
Jean-François B b5381f6697 bpo-34293: Fix PDF documentation paper size (GH-8585)
The "A4" pdfs were previously the wrong size due to a change in the options in Sphinx 1.5.

See also sphinx-doc/sphinx#5235
2019-09-09 22:52:03 +01:00
Serhiy Storchaka 832e864008
bpo-38049: Add command-line interface for the ast module. (GH-15724) 2019-09-09 23:36:13 +03:00
Lisa Roach b9f65f01fd
bpo-37383: Updates docs to reflect AsyncMock call_count after await. (#15761)
* bpo-351428: Updates documentation to reflect AsyncMock call_count after await.

* Adds skip and fixes warning.

* Removes extra >>>.

* Adds ... in front of await mock().
2019-09-09 17:54:13 +01:00
Greg Price 64c6ac74e2 bpo-36502: Update link to UAX #44, the Unicode doc on the UCD. (GH-15301)
The link we have points to the version from Unicode 6.0.0, dated 2010.
There have been numerous updates to it since then:
  https://www.unicode.org/reports/tr44/#Modifications

Change the link to one that points to the current version. Also, use HTTPS.
2019-09-09 09:37:13 -07:00
Serhiy Storchaka 850573b836
bpo-37995: Add an option to ast.dump() to produce a multiline output. (GH-15631) 2019-09-09 19:33:13 +03:00
Anthony Sottile 370138ba9c bpo-35803: Document and test dir=PathLike for tempfile (GH-11644)
Co-Authored-By: Ammar Askar <ammar_askar@hotmail.com>
2019-09-09 10:54:34 -05:00
Boris Verhovsky 9488a5289d Clarify that shutil's copy functions can accept path-like values (GH-15141) 2019-09-09 08:51:56 -07:00
Richard Sanger bb668f798a Fix docs bz.open default mode (GH-15100)
bz2.open()'s default mode is rb, not r
2019-09-09 08:49:47 -07:00
Antoine 88b24f96ae Minor changes in Doc/faq/library. (#15449)
* Minor changes.

* Update Doc/faq/library.rst

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>

* Apply suggestions from aeros167.

* Update Doc/faq/library.rst

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>

* Apply suggestions from aeros167 + re-add a "a" that was accidentally deleted.
2019-09-09 17:00:43 +02:00
Mario Corchero f5e7f39d29 docs: Add references to AsyncMock in unittest.mock.patch (#13681)
Update the docs as patch can now return an AsyncMock if the patched
object is an async function.
2019-09-09 15:18:06 +01:00
Jon Janzen 24b11b8c95 bpo-38053 Update documentation for plistlib (GH-15727)
* Update documentation for plistlib

-  Update "Mac OS X" to "Apple" since plists are used more widely than just macOS
-  Re-add the UID class documentation (oops, removed in GH-15615)
2019-09-09 16:13:43 +02:00
Vinay Sajip 264e034f99
bpo-37662: Documented venv.EnvBuilder.upgrade_dependencies(). (GH-15768) 2019-09-09 14:50:38 +01:00
Ashwin Vishnu 1a8de82d3a Fix typo in math.prod example (GH-15614) 2019-09-09 13:42:27 +01:00
David Röthlisberger 4f0f9f066e logging.Formatter docs: Add missing `validate` parameter, clarify `style` parameter (GH-15222) 2019-09-09 12:29:54 +01:00
Julien Palard 63c98ed2d2
Doc: Fix PDF build (NoUri). (GH-15739) 2019-09-09 12:54:56 +02:00
Serhiy Storchaka 526a01467b
bpo-34410: Fix a crash in the tee iterator when re-enter it. (GH-15625)
RuntimeError is now raised in this case.
2019-09-09 11:47:14 +03:00
Serhiy Storchaka 918b468b7d
Revert "Raise a RuntimeError when tee iterator is consumed from different threads (GH-15567)" (GH-15736)
This reverts commit fa220ec763.
2019-09-09 11:18:16 +03:00
Raymond Hettinger 4db25d5c39
bpo-36018: Address more reviewer feedback (GH-15733) 2019-09-08 16:57:58 -07:00
Greg Price 32a960f8e1 Correct Roman-numeral example in Unicode HOWTO. (GH-15541) 2019-09-08 12:42:13 +03:00
Joannah Nanjekye 3ccdbc3338 bpo-20806: Reference both times(2) and times(3) and link to MSDN. (GH-15479) 2019-09-07 10:05:29 +03:00
Joannah Nanjekye 74b662cf20 bpo-15088 : Remove PyGen_NeedsFinalizing() (GH-15702)
Remove PyGen_NeedsFinalizing(): it was not
documented, tested or used anywhere within CPython after
the implementation of PEP 442.
2019-09-06 17:41:38 +02:00
Raymond Hettinger d8c93aa5d2
More refinements to the statistics docs (GH-15713) 2019-09-05 23:02:27 -07:00
Joannah Nanjekye 2bc43cdc01 bpo-37878: Remove PyThreadState_DeleteCurrent() function (GH-15315)
* Rename PyThreadState_DeleteCurrent()
  to _PyThreadState_DeleteCurrent()
* Move it to the internal C API

Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
2019-09-05 18:06:49 +02:00
Miro Hrončok 2c2b561967 bpo-36797: Fix a dead link in Doc/distutils/apiref (GH-15700)
https://bugs.python.org/issue36797
2019-09-05 08:06:45 -07:00
Andre Delfino 3038e87ba8 Correct minor gramatical mistake in sys.settrace doc (GH-15637) 2019-09-05 13:10:37 +02:00
Jon Janzen ce81a925ef bpo-36409: Remove old plistlib API deprecated in 3.4 (GH-15615)
* Remove implementation for old plistlib API deprecated in 3.4
2019-09-05 10:11:35 +02:00
Raymond Hettinger 9b51570ffd
bpo-36324: Apply review comment from Jake Vanderplas (GH-15695) 2019-09-05 01:03:14 -07:00
Raymond Hettinger e4810b2a6c
bpo-36324: Apply review comments from Allen Downey (GH-15693) 2019-09-05 00:18:47 -07:00
Roger Iyengar 675d17cec4 Fix grammar in asyncio-dev.rst (GH-15672)
Automerge-Triggered-By: @ned-deily
2019-09-03 23:04:09 -07:00
Greg Price 2f09413947 closes bpo-37966: Fully implement the UAX #15 quick-check algorithm. (GH-15558)
The purpose of the `unicodedata.is_normalized` function is to answer
the question `str == unicodedata.normalized(form, str)` more
efficiently than writing just that, by using the "quick check"
optimization described in the Unicode standard in UAX #15.

However, it turns out the code doesn't implement the full algorithm
from the standard, and as a result we often miss the optimization and
end up having to compute the whole normalized string after all.

Implement the standard's algorithm.  This greatly speeds up
`unicodedata.is_normalized` in many cases where our partial variant
of quick-check had been returning MAYBE and the standard algorithm
returns NO.

At a quick test on my desktop, the existing code takes about 4.4 ms/MB
(so 4.4 ns per byte) when the partial quick-check returns MAYBE and it
has to do the slow normalize-and-compare:

  $ build.base/python -m timeit -s 'import unicodedata; s = "\uf900"*500000' \
      -- 'unicodedata.is_normalized("NFD", s)'
  50 loops, best of 5: 4.39 msec per loop

With this patch, it gets the answer instantly (58 ns) on the same 1 MB
string:

  $ build.dev/python -m timeit -s 'import unicodedata; s = "\uf900"*500000' \
      -- 'unicodedata.is_normalized("NFD", s)'
  5000000 loops, best of 5: 58.2 nsec per loop

This restores a small optimization that the original version of this
code had for the `unicodedata.normalize` use case.

With this, that case is actually faster than in master!

$ build.base/python -m timeit -s 'import unicodedata; s = "\u0338"*500000' \
    -- 'unicodedata.normalize("NFD", s)'
500 loops, best of 5: 561 usec per loop

$ build.dev/python -m timeit -s 'import unicodedata; s = "\u0338"*500000' \
    -- 'unicodedata.normalize("NFD", s)'
500 loops, best of 5: 512 usec per loop
2019-09-03 19:45:44 -07:00
Anthony Sottile e1786b5416 bpo-36853: Fix suspicious.py to actually print the unused rules (#13579)
* Fix suspicious.py to actually print the unused rules

* Fix the other `self.warn` calls
2019-09-02 12:01:23 -04:00
Jason R. Coombs 102e9b40ff
bpo-38010 Sync importlib.metadata with importlib_metadata 0.20. (GH-15646)
Sync importlib.metadata with importlib_metadata 0.20.
2019-09-02 11:08:03 -04:00