Commit Graph

22098 Commits

Author SHA1 Message Date
Andre Delfino 548cb6060a bpo-34085: Improve wording on classmethod/staticmethod (#8228)
* bpo-34085: Improve wording on classmethod/staticmethod

* Address comments from Éric

* Address comments from Éric
2019-03-25 18:53:43 -04:00
Stéphane Wirtel 360e1e4c51 bpo-36345: Add a new example in the documentation of wsgiref (#12511) 2019-03-25 15:52:56 -07:00
Raymond Hettinger d1e768a677
bpo-36326: Let inspect.getdoc() find docstrings for __slots__ (GH-12498) 2019-03-25 13:01:13 -07:00
Stephen Rosen 713a8ae792 Add note to Queue.get() docs about block=True (GH-2223) 2019-03-25 12:55:20 -07:00
Lisa Roach 13c1f72cd1 bpo-31822: Document that urllib.parse.{Defrag,Split,Parse}Result are namedtuples (GH-4434) 2019-03-24 17:28:48 -04:00
Ned Deily 6661c1720e
Replace "DOS box" with link to Windows FAQ. (GH-12390) 2019-03-24 15:03:54 -04:00
Inada Naoki d3c72a223a
bpo-36381: warn when no PY_SSIZE_T_CLEAN defined (GH-12473)
We will remove int support from 3.10 or 4.0.
2019-03-23 21:04:40 +09:00
Gregory P. Smith 7a2e84c348
bpo-33319: Clarify subprocess call docs. (GH-12508)
Clarify capturing or suppressing stdout and stderr on the old call APIs.

Do not state that they are equivalent to run() calls when they are not implemented using run as that was misleading. Unlike run they cannot handle stdout or stderr being set to PIPE without a risk of deadlock.
2019-03-23 00:40:28 -07:00
Xavier GUIHOT 7c822e50f0 Fix typo in doc for pprint.pp (GH-12500) 2019-03-22 18:17:29 -07:00
Denton Liu dd7c4ceed9 bpo-35155: clarify protocol handler method naming (GH-10313)
Clarify that the naming of protocol handler methods shouldn't be literally called "protocol" but should be named after the actual protocol.



https://bugs.python.org/issue35155
2019-03-22 14:49:55 -07:00
Rémi Lapeyre 96831c7fcf bpo-30670: Add pp function to the pprint module (GH-11769) 2019-03-22 10:22:20 -07:00
Kumar Akshay b0df45e55d bpo-21269: Provide args and kwargs attributes on mock call objects GH11807 2019-03-22 08:10:40 +00:00
Benedikt Werner 14e3c447c1 Fix table formatting in itertools doc (GH-12228) 2019-03-21 08:28:49 -07:00
CAM Gerlach e680c3db80 bpo-36268: Change default tar format to pax from GNU. (GH-12355) 2019-03-21 16:44:51 +02:00
Shubham Aggarwal abbdd1fc5c bpo-23984: Improve descriptor documentation (GH-1034)
https://bugs.python.org/issue23984
2019-03-19 19:55:55 -07:00
Raymond Hettinger 714c60d7ac
bpo-36324: Add inv_cdf() to statistics.NormalDist() (GH-12377) 2019-03-18 20:17:14 -07:00
Raymond Hettinger f7b57df0c0 bpo-36320: Switch typing.NamedTuple from OrderedDict to regular dict (GH-12396)
Also,  deprecate the *_field_types* attributes which duplicated the information in *\__annotations__*.


https://bugs.python.org/issue36320
2019-03-18 09:53:56 -07:00
Stéphane Wirtel 09a9f1799c bpo-36329: Declare the version of Python to use for Tools/scripts/serve.py (#12385)
* bpo-36329: Declare the version of Python to use for Tools/scripts/serve.py

* Add the blurb entry
2019-03-18 11:47:55 +01:00
Raymond Hettinger 23581c018f
bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375) 2019-03-18 00:27:39 -07:00
Inada Naoki 6a16b18224
bpo-36297: remove "unicode_internal" codec (GH-12342) 2019-03-18 15:44:11 +09:00
Joan Massich dc69f69f14 Fix typo in unittest.mock documentation: manger -> manager (GH-12352) 2019-03-17 16:34:22 -07:00
Diego Rojas 06e1e68822 bpo-34160: Update news entry for XML order attributes (#12335) 2019-03-16 16:44:56 -07:00
Raymond Hettinger 9c68543f02 Update the seealso entries for namedtuple() (GH-12373)
* Replace external recipe link with a link to the dataclasses module.

* Highlight the class definition syntax for typing.NamedTuple
  and add an example for clarity.
2019-03-16 12:53:23 -07:00
Raymond Hettinger 5927cfdf3a Minor grammar fix in docs (GH-12371) 2019-03-16 11:16:29 -07:00
Yasser A f40b4a0b62 bpo-36138: Clarify docs about converting datetime.timedelta to scalars. (GH-12137)
Be explicit that timedelta division converts an overall duration to the interval
units given by the denominator.
2019-03-16 13:56:58 +10:00
Eric Snow d2fdd1fedf
bpo-36124: Add PyInterpreterState.dict. (gh-12132) 2019-03-15 17:47:43 -06:00
Stéphane Wirtel 7c4fcb6b05 Add the meaning of the returned value of PyTypeObject.tp_init (GH-12325) 2019-03-15 09:18:36 -07:00
Raymond Hettinger 1c668d1657 Correct the heading levels (GH-12338) 2019-03-14 21:46:31 -07:00
Andre Delfino b420428cf5 Document actual string.punctuation value. (GH-12270) 2019-03-14 21:28:31 +02:00
Serhiy Storchaka 3191391515
bpo-36127: Argument Clinic: inline parsing code for keyword parameters. (GH-12058) 2019-03-14 10:32:22 +02:00
Steve Dower 8ef864d50f
bpo-36264: Updates documentation for change to expanduser on Windows (GH-12294) 2019-03-12 15:15:26 -07:00
Raymond Hettinger fc06a192fd
bpo-35892: Fix mode() and add multimode() (#12089) 2019-03-12 00:43:27 -07:00
Julien Palard d9bd8ec2a4
Doc: Fix inconsistency in multiprocessing (GH-12273) 2019-03-11 14:54:48 +01:00
Raymond Hettinger cc353a0cd9 Various refinements to the NormalDist examples and recipes (GH-12272) 2019-03-10 23:43:33 -07:00
Lysandros Nikolaou 1aeeaeb79e bpo-21314: Add a FAQ entry about positional only parameters (GH-10641) 2019-03-10 21:30:11 +10:00
Andre Delfino 11205b8030 Fix padding on asyncio.IncompleteReadError docs (GH-12258) 2019-03-10 04:02:17 -07:00
Benjamin Peterson 738c19f4c5
closes bpo-33376: Update to Unicode 12.0.0. (GH-12256) 2019-03-09 16:25:55 -08:00
Raymond Hettinger d70a359adf Make a documentation link target more specific (GH-12249) 2019-03-09 00:42:23 -08:00
Guido van Rossum 495da29225 bpo-35975: Support parsing earlier minor versions of Python 3 (GH-12086)
This adds a `feature_version` flag to `ast.parse()` (documented) and `compile()` (hidden) that allow tweaking the parser to support older versions of the grammar. In particular if `feature_version` is 5 or 6, the hacks for the `async` and `await` keyword from PEP 492 are reinstated. (For 7 or higher, these are unconditionally treated as keywords, but they are still special tokens rather than `NAME` tokens that the parser driver recognizes.)



https://bugs.python.org/issue35975
2019-03-07 12:38:08 -08:00
Raymond Hettinger 14bab7abee NormalDist.overlap() only needs one example (GH-12218) 2019-03-07 08:54:31 -08:00
Steve Dower 16e6f7dee7
bpo-36216: Add check for characters in netloc that normalize to separators (GH-12201) 2019-03-07 08:02:26 -08:00
Raymond Hettinger 1f58f4fa6a Refine statistics.NormalDist documentation and improve test coverage (GH-12208) 2019-03-06 23:23:55 -08:00
Raymond Hettinger 318d537daa
bpo-36169 : Add overlap() method to statistics.NormalDist (GH-12149) 2019-03-06 22:59:40 -08:00
Andre Delfino e942e7b5c9 Fix the documentation for set.copy() (GH-12176)
Remove 's' mention as there's no argument.
2019-03-07 07:23:21 +02:00
Emmanuel Arias ecc161d120 bpo-36185: Fix typo in Doc/c-api/objbuffer.rst. (GH-12204) 2019-03-07 07:16:41 +02:00
Martijn Pieters b727239575 closes bpo-36188: Clean up 'unbound' method left-overs. (GH-12169)
Methods are always bound, and `__self__` can no longer be `NULL`
(`method_new()` and `PyMethod_New()` both explicitly check for this).

Moreover, once a bound method is bound, it *stays* bound and won't be re-bound
to something else, so the section in the datamodel that talks about accessing
an methods in a different descriptor-binding context doesn't apply any more in
Python 3.
2019-03-04 21:19:34 -08:00
NAKAMURA Osamu 0983fcd0d5 Doc: Use `option` word for command line interface. (GH-12142)
For command line option, `option` is better than `parameter`.
2019-03-04 20:43:43 -08:00
Jules Lasne (jlasne) 7e9ce4c89e Fixed a missing . and a missing capital letter. (GH-12170) 2019-03-04 20:12:04 +02:00
pxinwr f4b0a1c0da bpo-31904: Add encoding support for VxWorks RTOS (GH-12051)
Use UTF-8 as the system encoding on VxWorks.

The main reason are:

1. The locale is frequently misconfigured.
2. Missing some functions to deal with locale in VxWorks C library.
2019-03-04 10:02:06 +01:00
Andrew Kuchling 97c288df61
bpo-20906: Various revisions to the Unicode howto (#8394)
* bpo-20906: Corrections & revisions to Unicode HOWTO

* bpo-34484: don't describe range as a Private Use Area
2019-03-03 23:10:28 -05:00
Mark Williams 8b50400fbe bpo-36170: posix_spawn doesn't exist on 3.7 (GH-12143)
The 3.8 docs claim that `os.posix_spawn` was introduced in 3.7, but it wasn't; it will be introduced in 3.8.
2019-03-03 12:42:25 -05:00
Inada Naoki 4f19030618
bpo-36103: change default buffer size of shutil.copyfileobj() (GH-12115)
It is changed from 16KiB to 64KiB.  The previous default value
is used since 1990.

coreutils chose 128 KiB as minimum buffer size for block device I/O.

But shutil.copyfileobj() can be used for non block devices.
So I choose more conservative value.

As my quick benchmark, performance difference between 64KiB and
128 KiB is up to ~5%.  On the other hand, performance difference
between 32 KiB and 64 KiB can be more than 10% when file is fully
buffered.

This is why 64 KiB is rational value.
2019-03-02 13:31:01 +09:00
Stéphane Wirtel 4b219ce81e bpo-36043: FileCookieJar supports os.PathLike (GH-11945)
https://bugs.python.org/issue36043
2019-03-01 12:40:54 -08:00
Raymond Hettinger 9add4b3317 bpo-36018: Add documentation link to "random variable" (GH-12114)
https://bugs.python.org/issue36018
2019-02-28 21:47:26 -08:00
Raymond Hettinger ef17fdbc1c bpo-36018: Add special value tests and make minor tweaks to the docs (GH-12096)
https://bugs.python.org/issue36018
2019-02-28 09:16:25 -08:00
Zhiming Wang ae2ea33d5d Add versionadded directives to ssl.minimum_version and ssl.maximum_version (GH-11894) 2019-02-28 12:15:04 -05:00
Gregory P. Smith 4173772031
Document the surprising sideeffect PyErr_Print(). (#12081)
Did you know an API documented as printing the pending traceback would sometimes exit the process?

You do now.
2019-02-27 15:27:32 -08:00
Shiv Dhar 4064089fce Fix grammar error in timeit module docs (GH-12066)
skip issue
skip news
2019-02-27 15:21:15 -08:00
Ned Deily ccb92e814d
Update FAQ to point to Infrastructure Team website. (GH-12077) 2019-02-27 17:23:34 -05:00
Andre Delfino 55e335d7d5 Remove empty Dictionaries section from programming FAQ (GH-12026) 2019-02-25 11:22:07 -05:00
Serhiy Storchaka a180b007d9
bpo-28450: Fix and improve the documentation for unknown escapes in RE. (GH-11920) 2019-02-25 17:58:30 +02:00
Serhiy Storchaka 6a44f6eef3
bpo-36048: Use __index__() instead of __int__() for implicit conversion if available. (GH-11952)
Deprecate using the __int__() method in implicit conversions of Python
numbers to C integers.
2019-02-25 17:57:58 +02:00
Sergey Fedoseev d90a141bb9 Correct name of 'defaultobj' parameter in PyDict_SetDefault() signature. (GH-11929) 2019-02-25 16:52:40 +02:00
Raymond Hettinger 9e456bc70e bpo-36018: Add properties for mean and stdev (GH-12022)
Responding to suggestions on the tracker and some off-line suggestions.

Davin suggested that english named accessors instead of greek letters would result in more intelligible user code. Steven suggested that the parameters still need to be *mu* and *theta* which are used elsewhere (and I noted those parameter names are used in linked-to resources). 

Michael suggested proving-out the API by seeing whether it generalized to *Lognormal*.  I did so and found that Lognormal distribution parameters *mu* and *sigma*  do not represent the mean and standard deviation of the lognormal distribution (instead, they are for the underlying regular normal distribution).

Putting these ideas together, we have NormalDist parameterized by *mu* and *sigma* but offering English named properties for accessors.  That gives lets us match other API that access mu and sigma, it matches the external resources on the topic, gives us clear english names in user code. The API extends nicely to LogNormal where the parameters and the summary statistic accessors are not the same.


https://bugs.python.org/issue36018
2019-02-24 11:44:55 -08:00
Davin Potts e895de3e7f
bpo-35813: Tests and docs for shared_memory (#11816)
* Added tests for shared_memory submodule.

* Added tests for ShareableList.

* Fix bug in allocationn size during creation of empty ShareableList illuminated by existing test run on Linux.

* Initial set of docs for shared_memory module.

* Added docs for ShareableList, added doctree entry for shared_memory submodule, name refactoring for greater clarity.

* Added examples to SharedMemoryManager docs, for ease of documentation switched away from exclusively registered functions to some explicit methods on SharedMemoryManager.

* Wording tweaks to docs.

* Fix test failures on Windows.

* Added tests around SharedMemoryManager.

* Documentation tweaks.

* Fix inappropriate test on Windows.

* Further documentation tweaks.

* Fix bare exception.

* Removed __copyright__.

* Fixed typo in doc, removed comment.

* Updated SharedMemoryManager preliminary tests to reflect change of not supporting all registered functions on SyncManager.

* Added Sphinx doctest run controls.

* CloseHandle should be in a finally block in case MapViewOfFile fails.

* Missed opportunity to use with statement.

* Switch to self.addCleanup to spare long try/finally blocks and save one indentation, change to use decorator to skip test instead.

* Simplify the posixshmem extension module.

Provide shm_open() and shm_unlink() functions.  Move other
functionality into the shared_memory.py module.

* Added to doc around size parameter of SharedMemory.

* Changed PosixSharedMemory.size to use os.fstat.

* Change SharedMemory.buf to a read-only property as well as NamedSharedMemory.size.

* Marked as provisional per PEP411 in docstring.

* Changed SharedMemoryTracker to be private.

* Removed registered Proxy Objects from SharedMemoryManager.

* Removed shareable_wrap().

* Removed shareable_wrap() and dangling references to it.

* For consistency added __reduce__ to key classes.

* Fix for potential race condition on Windows for O_CREX.

* Remove unused imports.

* Update access to kernel32 on Windows per feedback from eryksun.

* Moved kernel32 calls to _winapi.

* Removed ShareableList.copy as redundant.

* Changes to _winapi use from eryksun feedback.

* Adopt simpler SharedMemory API, collapsing PosixSharedMemory and WindowsNamedSharedMemory into one.

* Fix missing docstring on class, add test for ignoring size when attaching.

* Moved SharedMemoryManager to managers module, tweak to fragile test.

* Tweak to exception in OpenFileMapping suggested by eryksun.

* Mark a few dangling bits as private as suggested by Giampaolo.
2019-02-23 22:08:16 -06:00
Terry Jan Reedy d610116a2e
bpo-24310: Document IDLE settings dialog font tab sample (GH-12007) 2019-02-23 23:04:53 -05:00
Raymond Hettinger 11c7953165
bpo-36018: Add the NormalDist class to the statistics module (GH-11973) 2019-02-23 14:44:07 -08:00
Gregory P. Smith 06babb2422
bpo-1054041: Add What's New docs. (GH-11999)
Add What's New docs about the Ctrl-C improvement. Correct the issue number in the NEWS entry.
2019-02-23 10:43:49 -08:00
Eric Snow be3b295838
bpo-35886: Make PyInterpreterState an opaque type in the public API. (GH-11731)
Move PyInterpreterState into the "internal" header files.
2019-02-23 11:35:52 -07:00
Pablo Galindo 175421b58c bpo-36016: Add generation option to gc.getobjects() (GH-11909) 2019-02-23 12:02:06 +09:00
Emmanuel Arias df5cdc1112 bpo-36074: Result of `asyncio.Server.sockets` after `Server.close()` after is not clear (GH-11987)
[bpo-36074](https://bugs.python.org/issue36074): It becomes clear on  that the None is still return for server closed.





https://bugs.python.org/issue36074
2019-02-22 09:34:41 -08:00
Stéphane Wirtel a40681dd5d bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941) 2019-02-22 14:45:36 +01:00
Holger Frey 3208880f1c Include the --prompt flag in venv's help output (GH-10711)
Document usage of the existing `--prompt` option in the command line help.
2019-02-22 06:05:20 -05:00
Julien Palard 6e240ddd0d Doc: Missing backquotes. (GH-11982) 2019-02-22 00:22:27 -08:00
Manjusaka e5458bdb6a bpo-28235: Fix xml.etree.ElementTree.fromstring docs (GH-11903) 2019-02-21 19:33:57 -05:00
Raymond Hettinger 47d9987247
bpo-35904: Add statistics.fmean() (GH-11892) 2019-02-21 15:06:29 -08:00
Joe Jevnik f36f89257b bpo-36068: Make _tuplegetter objects serializable (GH-11981) 2019-02-21 13:00:40 -08:00
Raymond Hettinger 407c734326
bpo-36057 Update docs and tests for ordering in collections.Counter [no behavior change] (#11962)
* Add tests for Counter order.  No behavior change.

* Update docs and tests

* Fix doctest output and capitalization
2019-02-21 09:19:00 -08:00
Raymond Hettinger 86f093f71a
bpo-36060: Document how collections.ChainMap() determines iteration order (GH-11969) 2019-02-21 09:12:15 -08:00
Raymond Hettinger 7463884f69 Document other performance implication for __slots__ (GH-11974) 2019-02-21 03:34:04 -08:00
Raymond Hettinger 49fd6dd887
bpo-36059: Update OrderedDict() docs to reflect that regular dicts are now ordered (GH-11966) 2019-02-21 00:05:30 -08:00
Cristian Ciupitu 11fa0e48a9 Doc: fix example for iter() function. (GH-11959)
read() returns bytes for a file opened in binary mode,
so b'' should be used as a sentinel instead of ''.
Otherwise the loop will be infinite.
2019-02-21 09:53:06 +02:00
Raymond Hettinger 9b0c681e2d bpo-31982: Improve sequence of presentation in ChainMap docs (GH-11960)
https://bugs.python.org/issue31982
2019-02-20 13:49:23 -08:00
Stefan Behnel d8b9e1fc2e bpo-36012: Avoid linear slot search for non-dunder methods (GH-11907) 2019-02-20 09:29:24 -08:00
Raymond Hettinger 3bacf61265 bpo-35584: Clarify role of caret in a class class (GH-11946)
https://bugs.python.org/issue35584
2019-02-19 11:32:18 -08:00
Cédric Krier beda52ed36 bpo-35153: Add headers parameter to xmlrpc.client.ServerProxy (GH-10308)
Allow to add HTTP headers to XML-RPC requests sent to the server.
2019-02-19 17:18:50 +01:00
Julien Palard 513e9b4425 Doc: Fix typo. (GH-11315)
From: https://mail.python.org/pipermail/docs/2018-December/038583.html
2019-02-19 06:46:07 -08:00
Serhiy Storchaka e7a4bb554e
bpo-35798: Add test.support.check_syntax_warning(). (#11895)
It checks that a SyntaxWarning is raised when compile specified
statement, that it is raised only once, that it is converted to
a SyntaxError when raised as exception, and that both warning and
exception objects have corresponding attributes.
2019-02-19 08:30:15 +02:00
animalize 4a7f44a2ed bpo-34294: re module, fix wrong capturing groups in rare cases. (GH-11546)
Need to reset capturing groups between two SRE(match) callings in loops, this fixes wrong capturing groups in rare cases.

Also add a missing index in re.rst.
2019-02-18 15:26:37 +02:00
Raymond Hettinger e182318e6a bpo-33234: Add another attribution in Whatsnew (GH-11899)
https://bugs.python.org/issue33234
2019-02-16 12:47:48 -08:00
Raymond Hettinger 63fa1cfece bpo-32492: Add missing whatsnew entries for itemgetter and namedtuple (GH-11897)
https://bugs.python.org/issue32492
2019-02-16 12:02:22 -08:00
Raymond Hettinger 3ff5962d2e bpo-33089: Add math.dist() and math.hypot() to Whatsnew (GH-11896)
https://bugs.python.org/issue33089
2019-02-16 11:00:42 -08:00
Serhiy Storchaka 62e4481238
bpo-15248: Emit a compiler warning when missed a comma before tuple or list. (GH-11757) 2019-02-16 08:12:19 +02:00
Anthony Sottile a16ab00c0b bpo-36007: Bump minimum sphinx version to 1.8 (GH-11887)
https://bugs.python.org/issue36007
2019-02-15 15:41:15 -08:00
Raymond Hettinger 9abb725cea Improve readability of random module examples (GH-11884)
Based on reviewer feedback from Allen Downey, convert ``lambda`` to ``def``.
2019-02-15 12:40:18 -08:00
Jack Wilsdon 903567e4f5 Fix the versionadded info for typing.NoReturn (GH-11880)
The earliest version that `typing.NoReturn` appears in is [3.5.4rc1](https://docs.python.org/3/whatsnew/changelog.html#python-3-5-4-release-candidate-1)
2019-02-15 11:20:28 -08:00
Emmanuel Arias 522630a746 bpo-36006: Fix versionchanged directive alignment in io module documentation (GH-11881)
https://bugs.python.org/issue36006
2019-02-15 11:02:38 -08:00
Lysandros Nikolaou 5723263a3a bpo-30410: Documentation of sys.stdin/out/err update to reflect change in 3.6 (GH-10264)
Documentation of sys.stdin/out/err update to reflect change in 3.6 on Windows to use UTF-8.

Wording by Eryk Sun and Paul Moore.



https://bugs.python.org/issue30410
2019-02-14 15:35:25 -08:00
Kevin Mai-Husan Chia d73ac0eba9 Fix typo: equivalent code of `async with cond` (GH-11681) 2019-02-13 18:39:25 -08:00
Cheryl Sabella 5680f6546d bpo-18283: Add support for bytes to shutil.which (GH-11818) 2019-02-13 12:25:10 +01:00
Eivind Teig 537b6caa56 bpo-22062: Updated docstring and documentation for pathlib (GH-8519)
Original patch by Mike Short


https://bugs.python.org/issue22062
2019-02-11 02:47:09 -08:00
Julien Palard 9db56fb8fa Doc sidebar: 3.6 has moved to security-fix mode. (GH-11810) 2019-02-10 13:27:12 -08:00
Pablo Galindo 5033e315d2
Fix broken :ref: in asyncio docs (GH-11805) 2019-02-10 00:21:37 +00:00
Terry Jan Reedy 8a03ff2ff4
bpo-35833: Revise IDLE doc for control codes sent to Shell. (GH-11799)
Add  a code example block.
2019-02-08 22:51:51 -05:00
Paul Ganssle d9503c307a Add What's New entry for date subclass behavior (#11790)
This was a backwards incompatible change and should be clearly noted.

Related bugs:

bpo-32417: https://bugs.python.org/issue32417
bpo-35364: https://bugs.python.org/issue35364
2019-02-08 17:02:00 +01:00
Pierre Glaser df8d2cde63 bpo-35911: add cell constructor (GH-11771)
Add a cell constructor, expose the cell type in the types module.
2019-02-07 19:36:48 +00:00
Pablo Galindo bc09851586 bpo-35606: Implement math.prod (GH-11359) 2019-02-06 23:04:02 -08:00
Mariatta e9bc4172d1 Fix url to core-mentorship mailing list (GH-11775) 2019-02-06 12:45:03 -08:00
Harmandeep Singh cd90f6a369 bpo-20001: update pathlib landing image (GH-11304) 2019-02-05 19:16:13 +09:00
Raymond Hettinger f75d59e1a8
bpo-35884: Add variable access benchmarking script (GH-11725) 2019-02-02 22:54:56 -08:00
Stefan Krah d08ea70464
bpo-35845: Add order={'C', 'F', 'A'} parameter to memoryview.tobytes(). (#11730) 2019-02-02 18:57:41 +01:00
Cheryl Sabella 00e9c55d27 bpo-26256: Document algorithm speed for the Decimal module. (#4808) 2019-02-02 15:37:39 +01:00
Joannah Nanjekye 80c5dfe74b bpo-35537: Add setsid parameter to os.posix_spawn() and os.posix_spawnp() (GH-11608) 2019-02-01 11:05:22 +01:00
Guido van Rossum dcfcd146f8 bpo-35766: Merge typed_ast back into CPython (GH-11645) 2019-01-31 12:40:27 +01:00
Phil Jones d97daebfa6 doc: http: Fix enum name for status code 416 (GH-11689) 2019-01-31 19:08:57 +09:00
Raymond Hettinger 0bb4bdf0d9
bpo-35864: Replace OrderedDict with regular dict in namedtuple() (#11708)
* Change from OrderedDict to a regular dict

* Add blurb
2019-01-31 00:59:50 -08:00
Inada Naoki 0897e0c597
bpo-33504: fix wrong "versionchanged" (GH-11712) 2019-01-31 17:53:48 +09:00
Michael Selik 9f3f0931cf bpo-34003: Use dict instead of OrderedDict in csv.DictReader (GH-8014) 2019-01-31 00:47:53 -08:00
Steve Dower a1f9a3332b
bpo-35854: Fix EnvBuilder and --symlinks in venv on Windows (GH-11700) 2019-01-30 13:49:14 -08:00
Raymond Hettinger 40ebe948e9
Document differences between random.choices() and random.choice(). (GH-11703) 2019-01-30 13:30:20 -08:00
João Matos cf991e653a bpo-35835: Add reference to Python 3.7 new breakpoint() function in pdb documentation. (GH-11691) 2019-01-30 09:23:39 -08:00
jdemeyer 598e15d4fe bpo-25592: Improve documentation of distutils data_files (GH-9767) 2019-01-30 16:49:39 +01:00
David H ea446409cd bpo-35701: Update doc for UUID weak referencing (GH-11621) 2019-01-28 10:31:19 +01:00
nu_no dfc8bb987d Fix typo: class declaration (GH-11678) 2019-01-27 14:07:47 -08:00
Nick Coghlan 3171df3414
Clarify U-mode deprecation in open() (GH-11646)
The previous wording could be read as saying that universal
newlines mode itself was deprecated, when it's only the 'U'
character in the mode field that should be avoided.

The update also moves the description of the 'U' mode character
out of the mode table, as the longer explanation was overly
intrusive as a table entry and overshadowed the actually useful
mode characters.
2019-01-28 02:21:11 +10:00
Windson yang 3bab40db96 bpo-34134: Advise to use imap or imap_unordered when handling long iterables. (gh-8324) 2019-01-25 13:01:41 +01:00
Emily Morehouse 8f59ee01be
bpo-35224: PEP 572 Implementation (#10497)
* Add tokenization of :=
- Add token to Include/token.h. Add token to documentation in Doc/library/token.rst.
- Run `./python Lib/token.py` to regenerate Lib/token.py.
- Update Parser/tokenizer.c: add case to handle `:=`.

* Add initial usage of := in grammar.

* Update Python.asdl to match the grammar updates. Regenerated Include/Python-ast.h and Python/Python-ast.c

* Update AST and compiler files in Python/ast.c and Python/compile.c. Basic functionality, this isn't scoped properly

* Regenerate Lib/symbol.py using `./python Lib/symbol.py`

* Tests - Fix failing tests in test_parser.py due to changes in token numbers for internal representation

* Tests - Add simple test for := token

* Tests - Add simple tests for named expressions using expr and suite

* Tests - Update number of levels for nested expressions to prevent stack overflow

* Update symbol table to handle NamedExpr

* Update Grammar to allow assignment expressions in if statements.
Regenerate Python/graminit.c accordingly using `make regen-grammar`

* Tests - Add additional tests for named expressions in RoundtripLegalSyntaxTestCase, based on examples and information directly from PEP 572

Note: failing tests are currently commented out (4 out of 24 tests currently fail)

* Tests - Add temporary syntax test failure tests in test_parser.py

Note: There is an outstanding TODO for this -- syntax tests need to be
moved to a different file (presumably test_syntax.py), but this is
covering what needs to be tested at the moment, and it's more convenient
to run a single test for the time being

* Add support for allowing assignment expressions as function argument annotations. Uncomment tests for these cases because they all pass now!

* Tests - Move existing syntax tests out of test_parser.py and into test_named_expressions.py. Refactor syntax tests to use unittest

* Add TargetScopeError exception to extend SyntaxError

Note: This simply creates the TargetScopeError exception, it is not yet
used anywhere

* Tests - Update tests per PEP 572

Continue refactoring test suite:
The named expression test suite now checks for any invalid cases that
throw exceptions (no longer limited to SyntaxErrors), assignment tests
to ensure that variables are properly assigned, and scope tests to
ensure that variable availability and values are correct

Note:
- There are still tests that are marked to skip, as they are not yet
implemented
- There are approximately 300 lines of the PEP that have not yet been
addressed, though these may be deferred

* Documentation - Small updates to XXX/todo comments

- Remove XXX from child description in ast.c
- Add comment with number of previously supported nested expressions for
3.7.X in test_parser.py

* Fix assert in seq_for_testlist()

* Cleanup - Denote "Not implemented -- No keyword args" on failing test case. Fix PEP8 error for blank lines at beginning of test classes in test_parser.py

* Tests - Wrap all file opens in `with...as` to ensure files are closed

* WIP: handle f(a := 1)

* Tests and Cleanup - No longer skips keyword arg test. Keyword arg test now uses a simpler test case and does not rely on an external file. Remove print statements from ast.c

* Tests - Refactor last remaining test case that relied on on external file to use a simpler test case without the dependency

* Tests - Add better description of remaning skipped tests. Add test checking scope when using assignment expression in a function argument

* Tests - Add test for nested comprehension, testing value and scope. Fix variable name in skipped comprehension scope test

* Handle restriction of LHS for named expressions - can only assign to LHS of type NAME. Specifically, restrict assignment to tuples

This adds an alternative set_context specifically for named expressions,
set_namedexpr_context. Thus, context is now set differently for standard
assignment versus assignment for named expressions in order to handle
restrictions.

* Tests - Update negative test case for assigning to lambda to match new error message. Add negative test case for assigning to tuple

* Tests - Reorder test cases to group invalid syntax cases and named assignment target errors

* Tests - Update test case for named expression in function argument - check that result and variable are set correctly

* Todo - Add todo for TargetScopeError based on Guido's comment (2b3acd37bd (r30472562))

* Tests - Add named expression tests for assignment operator in function arguments

Note: One of two tests are skipped, as function arguments are currently treating
an assignment expression inside of parenthesis as one child, which does
not properly catch the named expression, nor does it count arguments
properly

* Add NamedStore to expr_context. Regenerate related code with `make regen-ast`

* Add usage of NamedStore to ast_for_named_expr in ast.c. Update occurances of checking for Store to also handle NamedStore where appropriate

* Add ste_comprehension to _symtable_entry to track if the namespace is a comprehension. Initialize ste_comprehension to 0. Set set_comprehension to 1 in symtable_handle_comprehension

* s/symtable_add_def/symtable_add_def_helper. Add symtable_add_def to handle grabbing st->st_cur and passing it to symtable_add_def_helper. This now allows us to call the original code from symtable_add_def by instead calling symtable_add_def_helper with a different ste.

* Refactor symtable_record_directive to take lineno and col_offset as arguments instead of stmt_ty. This allows symtable_record_directive to be used for stmt_ty and expr_ty

* Handle elevating scope for named expressions in comprehensions.

* Handle error for usage of named expression inside a class block

* Tests - No longer skip scope tests. Add additional scope tests

* Cleanup - Update error message for named expression within a comprehension within a class. Update comments. Add assert for symtable_extend_namedexpr_scope to validate that we always find at least a ModuleScope if we don't find a Class or FunctionScope

* Cleanup - Add missing case for NamedStore in expr_context_name. Remove unused var in set_namedexpr_content

* Refactor - Consolidate set_context and set_namedexpr_context to reduce duplicated code. Special cases for named expressions are handled by checking if ctx is NamedStore

* Cleanup - Add additional use cases for ast_for_namedexpr in usage comment. Fix multiple blank lines in test_named_expressions

* Tests - Remove unnecessary test case. Renumber test case function names

* Remove TargetScopeError for now. Will add back if needed

* Cleanup - Small comment nit for consistency

* Handle positional argument check with named expression

* Add TargetScopeError exception definition. Add documentation for TargetScopeError in c-api docs. Throw TargetScopeError instead of SyntaxError when using a named expression in a comprehension within a class scope

* Increase stack size for parser by 200. This is a minimal change (approx. 5kb) and should not have an impact on any systems. Update parser test to allow 99 nested levels again

* Add TargetScopeError to exception_hierarchy.txt for test_baseexception.py_

* Tests - Major update for named expression tests, both in test_named_expressions and test_parser

- Add test for TargetScopeError
- Add tests for named expressions in comprehension scope and edge cases
- Add tests for named expressions in function arguments (declarations
and call sites)
- Reorganize tests to group them more logically

* Cleanup - Remove unnecessary comment

* Cleanup - Comment nitpicks

* Explicitly disallow assignment expressions to a name inside parentheses, e.g.: ((x) := 0)

- Add check for LHS types to detect a parenthesis then a name (see note)
- Add test for this scenario
- Update tests for changed error message for named assignment to a tuple
(also, see note)

Note: This caused issues with the previous error handling for named assignment
to a LHS that contained an expression, such as a tuple. Thus, the check
for the LHS of a named expression must be changed to be more specific if
we wish to maintain the previous error messages

* Cleanup - Wrap lines more strictly in test file

* Revert "Explicitly disallow assignment expressions to a name inside parentheses, e.g.: ((x) := 0)"

This reverts commit f1531400ca7d7a2d148830c8ac703f041740896d.

* Add NEWS.d entry

* Tests - Fix error in test_pickle.test_exceptions by adding TargetScopeError to list of exceptions

* Tests - Update error message tests to reflect improved messaging convention (s/can't/cannot)

* Remove cases that cannot be reached in compile.c. Small linting update.

* Update Grammar/Tokens to add COLONEQUAL. Regenerate all files

* Update TargetScopeError PRE_INIT and POST_INIT, as this was purposefully left out when fixing rebase conflicts

* Add NamedStore back and regenerate files

* Pass along line number and end col info for named expression

* Simplify News entry

* Fix compiler warning and explicity mark fallthrough
2019-01-24 16:49:56 -07:00
Victor Stinner f6243ac1e4
bpo-35537: subprocess can use posix_spawn with pipes (GH-11575)
* subprocess.Popen can now also use os.posix_spawn() with pipes,
  but only if pipe file descriptors are greater than 2.
* Fix Popen._posix_spawn(): set '_child_created' attribute to True.
* Add Popen._close_pipe_fds() helper function to factorize the code.
2019-01-23 19:00:39 +01:00
yuji38kwmt cda73a5af2 bpo-35781: Changed references to deprecated 'warn' method in logging documentation in favour of 'warning' (GH-11654) 2019-01-23 07:27:13 +00:00
Géry Ogam f0c743604f bpo-35722: Updated the documentation for the 'disable_existing_loggers' parameter (GH-11525) 2019-01-23 07:12:39 +00:00
Victor Stinner bf4ac2d2fd
bpo-35713: Rework Python initialization (GH-11647)
* The PyByteArray_Init() and PyByteArray_Fini() functions have been
  removed. They did nothing since Python 2.7.4 and Python 3.2.0, were
  excluded from the limited API (stable ABI), and were not
  documented.
* Move "_PyXXX_Init()" and "_PyXXX_Fini()" declarations from
  Include/cpython/pylifecycle.h to
  Include/internal/pycore_pylifecycle.h. Replace
  "PyAPI_FUNC(TYPE)" with "extern TYPE".
* _PyExc_Init() now returns an error on failure rather than calling
  Py_FatalError(). Move macros inside _PyExc_Init() and undefine them
  when done. Rewrite macros to make them look more like statement:
  add ";" when using them, add "do { ... } while (0)".
* _PyUnicode_Init() now returns a _PyInitError error rather than call
  Py_FatalError().
* Move stdin check from _PySys_BeginInit() to init_sys_streams().
* _Py_ReadyTypes() now returns a _PyInitError error rather than
  calling Py_FatalError().
2019-01-22 17:39:03 +01:00
Ivan Levkivskyi 9932a22897
bpo-33416: Add end positions to Python AST (GH-11605)
The majority of this PR is tediously passing `end_lineno` and `end_col_offset` everywhere. Here are non-trivial points:
* It is not possible to reconstruct end positions in AST "on the fly", some information is lost after an AST node is constructed, so we need two more attributes for every AST node `end_lineno` and `end_col_offset`.
* I add end position information to both CST and AST.  Although it may be technically possible to avoid adding end positions to CST, the code becomes more cumbersome and less efficient.
* Since the end position is not known for non-leaf CST nodes while the next token is added, this requires a bit of extra care (see `_PyNode_FinalizeEndPos`). Unless I made some mistake, the algorithm should be linear.
* For statements, I "trim" the end position of suites to not include the terminal newlines and dedent (this seems to be what people would expect), for example in
  ```python
  class C:
      pass

  pass
  ```
  the end line and end column for the class definition is (2, 8).
* For `end_col_offset` I use the common Python convention for indexing, for example for `pass` the `end_col_offset` is 4 (not 3), so that `[0:4]` gives one the source code that corresponds to the node.
* I added a helper function `ast.get_source_segment()`, to get source text segment corresponding to a given AST node. It is also useful for testing.

An (inevitable) downside of this PR is that AST now takes almost 25% more memory. I think however it is probably justified by the benefits.
2019-01-22 11:18:22 +00:00
Pablo Galindo e8239b8e81
Add information about DeprecationWarning for invalid escaped characters in the re module (GH-5255) 2019-01-20 18:57:56 +00:00
Ashwin Ramaswami 478f829132 bpo-21257: document http.client.parse_headers (GH-11443)
Document http.client.parse_headers
2019-01-18 08:49:16 -07:00
Serhiy Storchaka 3bcbedc9f1
bpo-34850: Emit a warning for "is" and "is not" with a literal. (GH-9642) 2019-01-18 07:47:48 +02:00
Terry Jan Reedy cf27c06229
bpo-23156: Remove obsolete tix install directions (GH-11595)
Tix was deprecated in 3.6 and the doc is wrong.  New users should use ttk.
2019-01-17 19:00:51 -05:00
Dong-hee Na 89669ffe10 bpo-35283: Add deprecation warning for Thread.isAlive (GH-11454)
Add a deprecated warning for the threading.Thread.isAlive() method.
2019-01-17 13:14:45 +01:00
Slam 97e12996f3 Fixes typo in asyncio.queue doc (GH-11581)
Typo fix for method doc, I'm pretty sure coro is meant, because there's no consumer threads for thread-unsafe queue.

Most probably this piece of doc was copied from `queue.Queue`

There's not BPO bug for this, afaik.
2019-01-17 03:52:17 -08:00
Nick Coghlan cee29b46a1 bpo-35486: Note Py3.6 import system API requirement change (GH-11540)
While the introduction of ModuleNotFoundError was fully backwards
compatible on the import API consumer side, folks providing alternative
implementations of `__import__` need to make an update to be
forward compatible with clients that start relying on the new subclass.



https://bugs.python.org/issue35486
2019-01-17 02:41:29 -08:00
Victor Stinner 8c349565e8
Revert "bpo-35537: subprocess can now use os.posix_spawnp (GH-11579)" (GH-11582)
This reverts commit 0785889468.
2019-01-16 23:38:06 +01:00
Victor Stinner 0785889468
bpo-35537: subprocess can now use os.posix_spawnp (GH-11579)
The subprocess module can now use the os.posix_spawnp() function,
if it is available, to locate the program in the PATH.
2019-01-16 15:26:20 +01:00
Joannah Nanjekye 92b8322e7e bpo-35674: Add os.posix_spawnp() (GH-11554)
Add a new os.posix_spawnp() function.
2019-01-16 14:29:26 +01:00
Victor Stinner 9daecf37a5
bpo-35537: subprocess uses os.posix_spawn in some cases (GH-11452)
The subprocess module can now use the os.posix_spawn() function
in some cases for better performance. Currently, it is only used on macOS
and Linux (using glibc 2.24 or newer) if all these conditions are met:

* executable path contains a directory
* close_fds=False
* preexec_fn, pass_fds, cwd, stdin, stdout, stderr
  and start_new_session parameters are not set

Co-authored-by: Joannah Nanjekye <nanjekyejoannah@gmail.com>
2019-01-16 00:02:35 +01:00
Henry Chen 06f8b57212 bpo-35738: Update the example for timer.Timer.repeat(). (GH-11559)
Show correct number of repeats.
2019-01-15 12:29:21 +02:00
Serhiy Storchaka 32ebd8508d
bpo-29707: Document that os.path.ismount() is not able to reliable detect bind mounts. (GH-11238) 2019-01-15 10:55:40 +02:00
Alexey Izbyshev 1cffd0eed3 bpo-34512: Document platform-specific strftime() behavior for non-ASCII format strings (GH-8948) 2019-01-12 19:21:54 +02:00
Joannah Nanjekye fd7d539be3 bpo-35716: Update time.CLOCK_MONOTONIC_RAW doc (GH-11517)
Document that the time.CLOCK_MONOTONIC_RAW constant
is now also available on macOS 10.12.

Co-authored-by: Ricardo Fraile <rfraile@rfraile.eu>
2019-01-11 14:19:57 +01:00
Bo Bayles bab4bbb4c9 bpo-32146: Add documentation about frozen executables on Unix (GH-5850) 2019-01-10 18:51:28 +01:00
Joannah Nanjekye 572168a016 bpo-35702: Add new identifier time.CLOCK_UPTIME_RAW for macOS 10.12 (GH-11503) 2019-01-10 17:56:38 +01:00
Andre Delfino 91c6158dbc Update bugs.rst (GH-9648) 2019-01-09 15:54:12 -07:00