Commit Graph

21135 Commits

Author SHA1 Message Date
Serhiy Storchaka 87be28f4a1
bpo-31672: Restore the former behavior when override flags in Template. (#5099)
Overriding flags to 0 will make the default pattern matching only
lower case letters.
2018-01-04 19:20:11 +02:00
Serhiy Storchaka fbb490fd2f
bpo-32308: Replace empty matches adjacent to a previous non-empty match in re.sub(). (#4846) 2018-01-04 11:06:13 +02:00
Emily Morehouse f190eb59e6 bpo-32452: clarify term 'brackets' in generator tutorial (#5079)
Updates documentation for generator expressions in classes tutorial: Clarify usage of ambiguous term "brackets" by replacing with "square brackets". Updated subsequent lines to respect line breaks. (#5079)
2018-01-01 20:34:53 -05:00
Barry Warsaw deae6b451f
bpo-32248 - Implement importlib.resources (#4911)
Port importlib_resources to importlib.resources
2017-12-30 15:18:06 -05:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 1634fc289a bpo-32418: Add get_loop() method on Server, AbstractServer classes (#4997)
* Add abstract get_loop() method to Server, AbstractServer classes.
* Add test cases for get_loop() method in Server, AbstractServer classes
* Add documentation for get_loop() method
2017-12-30 17:09:32 +02:00
Yury Selivanov f111b3dcb4
bpo-23749: Implement loop.start_tls() (#5039) 2017-12-30 00:35:36 -05:00
Benjamin Peterson bbdb17d19b
return the new file descriptor from os.dup2 (closes bpo-32441) (#5041) 2017-12-29 13:13:06 -08:00
Yury Selivanov ca9b36cd1a
bpo-32415: Add asyncio.Task.get_loop() and Future.get_loop() (#4992) 2017-12-23 15:04:15 -05:00
Sebastian Pucilowski a8d25a1645 Fix trivial typo in pickle.rst (#4955) 2017-12-21 11:00:49 +02:00
Paul Ganssle 09dc2f508c bpo-15873: Implement [date][time].fromisoformat (#4699)
Closes bpo-15873.
2017-12-21 00:33:49 -05:00
INADA Naoki 507434fd50
bpo-15216: io: TextIOWrapper.reconfigure() accepts encoding, errors and newline (GH-2343) 2017-12-21 09:59:53 +09:00
Andrew Svetlov 51eb1c6b9c
bpo-29970: Make ssh_handshake_timeout None by default (#4939)
* Make ssh_handshake_timeout None by default.
* Raise ValueError if ssl_handshake_timeout is used without ssl.
* Raise ValueError if ssl_handshake_timeout is not positive.
2017-12-20 20:24:43 +02:00
Antoine Pitrou a7a751dd7b
bpo-32306: Clarify c.f.Executor.map() documentation (#4947)
The built-in map() function collects function arguments lazily, but concurrent.futures.Executor.map() does so eagerly.
2017-12-20 19:06:20 +01:00
Marcel Plch 776407fe89 bpo-31901: atexit callbacks should be run at subinterpreter shutdown (#4611)
Change atexit behavior and PEP-489 multiphase init support.
2017-12-20 11:17:58 +01:00
KatherineMichel f4e21a2a72 Improve the F-strings and format specifier documentation (GH-4931)
Mention that the format-specifier mini language in f-strings
is the same one used by str.format.
2017-12-19 13:03:09 -08:00
Neil Aspinall f7686c1f55 bpo-29970: Add timeout for SSL handshake in asyncio
10 seconds by default.
2017-12-19 21:45:42 +02:00
Antoine Pitrou 4b965930e8
bpo-32377: improve __del__ docs and fix mention about resurrection (#4927)
* Fix #32377: improve __del__ docs and fix mention about resurrection

* Mention that CPython only calls __del__ once.
2017-12-19 19:48:45 +01:00
Yury Selivanov 9818142b1b
bpo-32331: Fix socket.type when SOCK_NONBLOCK is available (#4877) 2017-12-18 20:02:54 -05:00
Yury Selivanov d757aaf9dd
bpo-32356: idempotent pause_/resume_reading; new is_reading method. (#4914) 2017-12-18 17:03:23 -05:00
Segev Finer b2a6083eb0 bpo-19764: Implemented support for subprocess.Popen(close_fds=True) on Windows (#1218)
Even though Python marks any handles it opens as non-inheritable there
is still a race when using `subprocess.Popen` since creating a process
with redirected stdio requires temporarily creating inheritable handles.
By implementing support for `subprocess.Popen(close_fds=True)` we fix
this race.

In order to implement this we use PROC_THREAD_ATTRIBUTE_HANDLE_LIST
which is available since Windows Vista. Which allows to pass an explicit
list of handles to inherit when creating a process.

This commit also adds `STARTUPINFO.lpAttributeList["handle_list"]`
which can be used to control PROC_THREAD_ATTRIBUTE_HANDLE_LIST
directly.
2017-12-18 10:28:19 +01:00
Nathaniel J. Smith 902ab80b59 bpo-30050: Allow disabling full buffer warnings in signal.set_wakeup_fd (#4792) 2017-12-17 23:10:18 -05:00
Andrew Svetlov 44d1a5912e
bpo-32250: Implement asyncio.current_task() and asyncio.all_tasks() (#4799) 2017-12-16 21:58:38 +02:00
Victor Stinner 9454060e84
bpo-29240, bpo-32030: Py_Main() re-reads config if encoding changes (#4899)
bpo-29240, bpo-32030: If the encoding change (C locale coerced or
UTF-8 Mode changed), Py_Main() now reads again the configuration with
the new encoding.

Changes:

* Add _Py_UnixMain() called by main().
* Rename pymain_free_pymain() to pymain_clear_pymain(), it can now be
  called multipled times.
* Rename pymain_parse_cmdline_envvars() to pymain_read_conf().
* Py_Main() now clears orig_argc and orig_argv at exit.
* Remove argv_copy2, Py_Main() doesn't modify argv anymore. There is
  no need anymore to get two copies of the wchar_t** argv.
* _PyCoreConfig: add coerce_c_locale and coerce_c_locale_warn.
* Py_UTF8Mode is now initialized to -1.
* Locale coercion (PEP 538) now respects -I and -E options.
2017-12-16 04:54:22 +01:00
Brett Cannon 4ac5150e06
bpo-32248: Implement importlib.abc.ResourceReader (GH-4892) 2017-12-15 16:29:35 -08:00
Raymond Hettinger 6693d7af66
Minor wording tweak for itertools documentation (#4893) 2017-12-15 13:17:55 -08:00
Mariatta d924fa523d
F-strings docs: link to Format Specifiers (GH-4888)
Link to the Format Specification Mini Language section from f-strings' documentation.
2017-12-15 10:07:01 -08:00
Victor Stinner 642d67b4f2
bpo-32329: Add versionchanged to -R option doc (#4884) 2017-12-15 16:29:01 +01:00
Serhiy Storchaka 3327a2ddf1
bpo-32265: Classify class and static methods of builtin types. (#4776)
Add types.ClassMethodDescriptorType for unbound class methods.
2017-12-15 14:13:41 +02:00
Serhiy Storchaka a5552f023e
bpo-32240: Add the const qualifier to declarations of PyObject* array arguments. (#4746) 2017-12-15 13:11:11 +02:00
Ville Skyttä 297fd876aa bpo-28393: Update encoding lookup docs wrt bpo-27938 (#4871) 2017-12-15 11:19:23 +01:00
Andrew Svetlov f74ef458ab
bpo-32311: Implement asyncio.create_task() shortcut (#4848)
* Implement functionality
* Add documentation
2017-12-15 07:04:38 +02:00
Yury Selivanov 19a44f63c7
bpo-32327: Convert asyncio functions documented as coroutines to coroutines. (#4872) 2017-12-14 20:53:26 -05:00
Victor Stinner 358e5e17a5
bpo-32329: Fix -R option for hash randomization (#4873)
bpo-32329, bpo-32030:

* The -R option now turns on hash randomization when the
  PYTHONHASHSEED environment variable is set to 0 Previously, the
  option was ignored.
* sys.flags.hash_randomization is now properly set to 0 when hash
  randomization is turned off by PYTHONHASHSEED=0.
* _PyCoreConfig_ReadEnv() now reads the PYTHONHASHSEED environment
  variable. _Py_HashRandomization_Init() now only apply the
  configuration, it doesn't read PYTHONHASHSEED anymore.
2017-12-15 00:51:22 +01:00
Giuseppe Scrivano 96a5e50a5d bpo-32143: add f_fsid to os.statvfs() (#4571)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2017-12-14 17:46:46 -05:00
Yury Selivanov 02a0a19206
bpo-32314: Implement asyncio.run() (#4852) 2017-12-14 09:42:21 -05:00
Mike 53f7a7c281 bpo-32297: Few misspellings found in Python source code comments. (#4803)
* Fix multiple typos in code comments

* Add spacing in comments (test_logging.py, test_math.py)

* Fix spaces at the beginning of comments in test_logging.py
2017-12-14 13:04:53 +02:00
Ivan Levkivskyi 5364b5cd75
bpo-32225: Implementation of PEP 562 (#4731)
Implement PEP 562: module __getattr__ and __dir__.
The implementation simply updates module_getattro and
module_dir.
2017-12-14 11:59:44 +01:00
INADA Naoki 7ea143ae79
bpo-29469: Move constant folding to AST optimizer (GH-2858) 2017-12-14 16:47:20 +09:00
Jelle Zijlstra 176baa326b bpo-30241: implement contextlib.AbstractAsyncContextManager (#1412) 2017-12-13 20:19:17 -05:00
jimmy 4f29f3c84b trivial: link updates in documentation (#2765) 2017-12-13 14:37:51 +02:00
Victor Stinner 91106cd9ff
bpo-29240: PEP 540: Add a new UTF-8 Mode (#855)
* Add -X utf8 command line option, PYTHONUTF8 environment variable
  and a new sys.flags.utf8_mode flag.
* If the LC_CTYPE locale is "C" at startup: enable automatically the
  UTF-8 mode.
* Add _winapi.GetACP(). encodings._alias_mbcs() now calls
  _winapi.GetACP() to get the ANSI code page
* locale.getpreferredencoding() now returns 'UTF-8' in the UTF-8
  mode. As a side effect, open() now uses the UTF-8 encoding by
  default in this mode.
* Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding
  in the UTF-8 Mode.
* Update subprocess._args_from_interpreter_flags() to handle -X utf8
* Skip some tests relying on the current locale if the UTF-8 mode is
  enabled.
* Add test_utf8mode.py.
* _Py_DecodeUTF8_surrogateescape() gets a new optional parameter to
  return also the length (number of wide characters).
* pymain_get_global_config() and pymain_set_global_config() now
  always copy flag values, rather than only copying if the new value
  is greater than the old value.
2017-12-13 12:29:09 +01:00
Sebastian Rittau c3e070f849 bpo-32284: Fix documentation of BinaryIO and TextIO (#4832) 2017-12-13 10:39:55 +02:00
Victor Stinner 747f48e2e9
bpo-32230: Set sys.warnoptions with -X dev (#4820)
Rather than supporting dev mode directly in the warnings module, this
instead adjusts the initialisation code to add an extra 'default'
entry to sys.warnoptions when dev mode is enabled.

This ensures that dev mode behaves *exactly* as if `-Wdefault` had
been passed on the command line, including in the way it interacts
with `sys.warnoptions`, and with other command line flags like `-bb`.

Fix also bpo-20361: have -b & -bb options take precedence over any
other warnings options.

Patch written by Nick Coghlan, with minor modifications of Victor Stinner.
2017-12-12 22:59:48 +01:00
Serhiy Storchaka 4ae06c5337
bpo-32241: Add the const qualifire to declarations of umodifiable strings. (#4748) 2017-12-12 13:55:04 +02:00
Nitish Chandra 5ce0a2a100 bpo-31942: Document optional support of start and stop attributes in Sequence.index method (#4277) 2017-12-12 11:22:30 +01:00
Łukasz Langa e56975351b
bpo-32227: functools.singledispatch supports registering via type annotations (#4733) 2017-12-11 13:56:31 -08:00
Andrew Svetlov 8874342cf3
bpo-32258: Replace 'yield from' to 'await' in asyncio docs (#4779)
* Replace 'yield from' to 'await' in asyncio docs

* Fix docstrings
2017-12-11 17:35:49 +02:00
Yury Selivanov abae67ebc2
Add asyncio.get_running_loop() function. (#4782) 2017-12-11 10:07:44 -05:00
Yury Selivanov 9edad3c701
bpo-32272: Remove asyncio.async() function. (#4784) 2017-12-11 10:03:48 -05:00
Sanyam Khurana 1b74f9b77a bpo-22671: Clarify and test default read method implementations (#4568)
Original patch written by Martin Panter, enhanced by Sanyam Khurana.
2017-12-11 14:42:09 +01:00
Pablo Galindo 77106b2c21 bpo-32114: Updated the documentation for get_event_loop to reflect the policy change (#4510) 2017-12-10 12:34:59 -05:00
Benjamin Peterson 42aa93b8ff
closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)
Python now supports checking bytecode cache up-to-dateness with a hash of the
source contents rather than volatile source metadata. See the PEP for details.

While a fairly straightforward idea, quite a lot of code had to be modified due
to the pervasiveness of pyc implementation details in the codebase. Changes in
this commit include:

- The core changes to importlib to understand how to read, validate, and
  regenerate hash-based pycs.

- Support for generating hash-based pycs in py_compile and compileall.

- Modifications to our siphash implementation to support passing a custom
  key. We then expose it to importlib through _imp.

- Updates to all places in the interpreter, standard library, and tests that
  manually generate or parse pyc files to grok the new format.

- Support in the interpreter command line code for long options like
  --check-hash-based-pycs.

- Tests and documentation for all of the above.
2017-12-09 10:26:52 -08:00
Andrew Svetlov 28d8d14013
bpo-32253: Deprecate with statement and bare await for asyncio locks (GH-4764)
* Add test for 'with (yield from lock)'
* Deprecate with statement for asyncio locks
* Document the deprecation
2017-12-09 20:00:05 +02:00
Vinay Sajip a9f8df646a
bpo-32212: Updated logging documentation to make parameter names more consistent with source. (GH-4765) 2017-12-09 11:09:04 +00:00
Garrett Berg a0374dd34a bpo-32208: update threading.Semaphore docs and add unit test (#4709)
* fix issue32208: update threading.Semaphore docs and add unit test to validate correct behavior

* add test for blocking

* Update threading.rst

* semaphore: remove documentation validation tests and move 'return value' test to BaseSemaphore
2017-12-07 20:04:26 +02:00
Sanyam Khurana 1b4587a246 bpo-25910: Fixes redirection from http to https (#4674) 2017-12-06 17:39:33 +01:00
Julien Palard ae342cf7de Add a missing space in tkinter documentation. (GH-4692) 2017-12-04 21:05:33 -08:00
Neil Schemenauer 8837dd092f
bpo-19610: Warn if distutils is provided something other than a list to some fields (#4685)
* Rather than raise TypeError, warn and call list() on the value.

* Fix tests, revise NEWS and whatsnew text.

* Revise documentation, a string is okay as well.

* Ensure 'requires' and 'obsoletes' are real lists.

* Test that requires and obsoletes are turned to lists.
2017-12-04 18:58:12 -08:00
Victor Stinner 31a8393cf6
Revert "bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)" (#4694)
* Revert "bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)"

This reverts commit 13badcbc60.

Re-apply commits:

* "bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)"
  commit af5a895073.
* "bpo-32030: Fix config_get_program_name() on macOS (#4669)"
  commit e23c06e2b0.
* "bpo-32030: Add Python/pathconfig.c (#4668)"
  commit 0ea395ae96.
* "bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)"
  commit ebac19dad6.
* "bpo-32030: Fix Py_GetPath(): init program_name (#4665)"
  commit 9ac3d88827.

* Fix compilation error on macOS
2017-12-04 13:39:15 +01:00
Serhiy Storchaka 70d56fb525
bpo-25054, bpo-1647489: Added support of splitting on zerowidth patterns. (#4471)
Also fixed searching patterns that could match an empty string.
2017-12-04 14:29:05 +02:00
Julien Palard 7324b5ce8e bpo-31589 : Build PDF using xelatex for better UTF8 support. (#3940)
Also addresses doc build failures documented in bpo-32200.
2017-12-02 17:24:39 -05:00
Serhiy Storchaka 13badcbc60
bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (#4681)
* Revert "bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)"

This reverts commit af5a895073.

* Revert "bpo-32030: Fix config_get_program_name() on macOS (#4669)"

This reverts commit e23c06e2b0.

* Revert "bpo-32030: Add Python/pathconfig.c (#4668)"

This reverts commit 0ea395ae96.

* Revert "bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)"

This reverts commit ebac19dad6.

* Revert "bpo-32030: Fix Py_GetPath(): init program_name (#4665)"

This reverts commit 9ac3d88827.
2017-12-02 21:36:00 +02:00
Victor Stinner af5a895073
bpo-32030: _PyPathConfig_Init() sets home and program_name (#4673)
_PyPathConfig_Init() now also initialize home and program_name:

* Rename existing _PyPathConfig_Init() to _PyPathConfig_Calculate().
  Add a new _PyPathConfig_Init() function in pathconfig.c which
  handles the _Py_path_config variable and call
  _PyPathConfig_Calculate().
* Add home and program_name fields to _PyPathConfig.home
* _PyPathConfig_Init() now initialize home and program_name
  from main_config
* Py_SetProgramName(), Py_SetPythonHome() and Py_GetPythonHome() now
  calls Py_FatalError() on failure, instead of silently ignoring
  failures.
* config_init_home() now gets directly _Py_path_config.home to only
  get the value set by Py_SetPythonHome(), or NULL if
  Py_SetPythonHome() was not called.
* config_get_program_name() now gets directly
  _Py_path_config.program_name to only get the value set by
  Py_SetProgramName(), or NULL if Py_SetProgramName() was not called.
* pymain_init_python() doesn't call Py_SetProgramName() anymore,
  _PyPathConfig_Init() now always sets the program name
* Call _PyMainInterpreterConfig_Read() in
  pymain_parse_cmdline_envvars_impl() to control the memory allocator
* C API documentation: it's no more safe to call Py_GetProgramName()
  before Py_Initialize().
2017-12-02 10:11:32 +01:00
Serhiy Storchaka 73a7e9b10b bpo-10544: Deprecate "yield" in comprehensions and generator expressions. (GH-4579)
The current behaviour of yield expressions inside comprehensions  and
generator expressions is essentially an accident of implementation - it
arises implicitly from the way the compiler handles yield expressions inside
nested functions and generators.

Since the current behaviour wasn't deliberately designed, and is inherently
confusing, we're deprecating it, with no current plans to reintroduce it.
Instead, our advice will be to use a named nested generator definition
for cases where this behaviour is desired.
2017-12-01 14:54:17 +10:00
Victor Stinner b4d1e1f7c1
bpo-20891: Fix PyGILState_Ensure() (#4650)
When PyGILState_Ensure() is called in a non-Python thread before
PyEval_InitThreads(), only call PyEval_InitThreads() after calling
PyThreadState_New() to fix a crash.

Add an unit test in test_embed.
2017-11-30 22:05:00 +01:00
Victor Stinner 5e3806f8cf
bpo-32101: Add PYTHONDEVMODE environment variable (#4624)
* bpo-32101: Add sys.flags.dev_mode flag
  Rename also the "Developer mode" to the "Development mode".
* bpo-32101: Add PYTHONDEVMODE environment variable
  Mention it in the development chapiter.
2017-11-30 11:40:24 +01:00
Jesse-Bakker 706e10b186 bpo-32121: Add most_recent_first parameter to tracemalloc.Traceback.format (#4534)
* Add most_recent_first parameter to tracemalloc.Traceback.format to allow
   reversing the order of the frames in the output
* Reversed default sorting of tracemalloc.Traceback frames
* Allowed negative limit, truncating from the other side.
2017-11-30 00:05:07 +01:00
Victor Stinner 5d39e04290
bpo-32030: Rework memory allocators (#4625)
* Fix _PyMem_SetupAllocators("debug"): always restore allocators to
  the defaults, rather than only caling _PyMem_SetupDebugHooks().
* Add _PyMem_SetDefaultAllocator() helper to set the "default"
  allocator.
* Add _PyMem_GetAllocatorsName(): get the name of the allocators
* main() now uses debug hooks on memory allocators if Py_DEBUG is
  defined, rather than calling directly malloc()
* Document default memory allocators in C API documentation
* _Py_InitializeCore() now fails with a fatal user error if
  PYTHONMALLOC value is an unknown memory allocator, instead of
  failing with a fatal internal error.
* Add new tests on the PYTHONMALLOC environment variable
* Add support.with_pymalloc()
* Add the _testcapi.WITH_PYMALLOC constant and expose it as
   support.with_pymalloc().
* sysconfig.get_config_var('WITH_PYMALLOC') doesn't work on Windows, so
   replace it with support.with_pymalloc().
* pythoninfo: add _testcapi collector for pymem
2017-11-29 17:20:38 +01:00
Barry Warsaw 23df2d1304
bpo-32107 - Improve MAC address calculation and fix test_uuid.py (#4600)
``uuid.getnode()`` now preferentially returns universally administered MAC addresses if available, over locally administered MAC addresses.  This makes a better guarantee for global uniqueness of UUIDs returned from ``uuid.uuid1()``.  If only locally administered MAC addresses are available, the first such one found is returned.

Also improve internal code style by being explicit about ``return None`` rather than falling off the end of the function.

Improve the test robustness.
2017-11-28 17:26:04 -05:00
Serhiy Storchaka c615be5166
Use raw strings in the re module examples. (#4616) 2017-11-28 22:51:38 +02:00
Victor Stinner ac577d7d0b
bpo-32154: Remove asyncio.windows_utils.socketpair (#4609) 2017-11-28 21:33:20 +01:00
Jonas Haag 4d193bcc25 bpo-32071: Fix regression and add What's New entry (#4589)
* bpo-32071: Fix an undocumented behaviour regression

* bpo-32071: Add 3.7 release note entry for unittest -k
2017-11-28 20:40:44 +01:00
Dong-hee Na a489599793 bpo-32046: Update 2to3 when converts operator.isCallable(obj). (#4417) 2017-11-28 11:26:56 -05:00
Serhiy Storchaka 598ceae876
bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
Victor Stinner 4271dfd781
bpo-32154: Remove asyncio.selectors (#4605)
* Remove asyncio.selectors and asyncio._overlapped symbols from the
  namespace of the asyncio module
* Replace "from asyncio import selectors" with "import selectors"
* Replace "from asyncio import _overlapped" with "import _overlapped"

asyncio.selectors was added to support Python 3.3, which doesn't have
selectors in its standard library, and Python 3.4 in the same code
base. Same rationale for asyncio._overlapped. Python 3.3 reached its
end of life, and asyncio is no more maintained as a third party
module on PyPI.
2017-11-28 15:19:56 +01:00
Ned Deily 122fc136b3
Revert "bpo-30487: automatically create a venv and install Sphinx when running make (GH-4346)" (#4592)
Fix breakage documented in bpo-32149.
This reverts commit d8d6b91221.
2017-11-27 17:07:32 -05:00
Jason Yang c172fc5031 bpo-32051: Fix name shadowing in multiprocessing docs (GH-4469) 2017-11-27 04:18:33 +03:00
Mandeep Singh ede2ac913e bpo-23033: Improve SSL Certificate handling (GH-937)
Wildcard is now supported in hostname when it is one and only character in
the leftmost segment.
2017-11-26 14:31:27 -08:00
Ivan Levkivskyi 0cd2e81bea bpo-29879: Update typing documentation. (GH-4573)
- Add "version added: 3.5.2" note where it was missing.
- Remove the mention that Reversible is new in 3.5.2
2017-11-26 14:23:02 -08:00
Caleb Hattingh d8d6b91221 bpo-30487: automatically create a venv and install Sphinx when running make (GH-4346) 2017-11-26 15:18:30 -06:00
Jonas Haag 5b48dc638b bpo-32071: Add unittest -k option (#4496)
* bpo-32071: Add unittest -k option
2017-11-25 16:23:52 +01:00
Berker Peksag 8d9bb11d8f
bpo-28334: netrc() now uses expanduser() to find .netrc file (GH-4537)
Previously, netrc.netrc() was raised an exception if $HOME is not set.

Authored-By: Dimitri Merejkowsky <dimitri.merejkowsky@tanker.io>
2017-11-25 13:37:22 +03:00
Mariatta 9d5ec808de
Improve Scheduler Objects documentation. (GH-4556)
Mention that the lower the priority number, the higher priority it represents.
2017-11-24 21:43:01 -08:00
Mandeep Bhutani 610e5afdcb bpo-30004: Fix the code example of using group in Regex Howto Docs (GH-4443)
The provided code example was supposed to find repeated words, however it returned false results.
2017-11-24 20:56:00 -08:00
Ashley Camba f8802d80b3 Asyncion-Dev docs: Fix the reference to sys.excepthook (GH-4414) 2017-11-24 15:39:39 -08:00
Victor Stinner 84c4b1938f
bpo-32124: Document C functions safe before init (#4540)
Explicitly document C functions and C variables that can be set
before Py_Initialize().
2017-11-24 22:30:27 +01:00
Will White 78a5722ae9 Improve the String tutorial docs (GH-4541)
The paragraph that contains example of string literal concatenation was placed
after the section about concatenation using the '+' sign.
Moved the paragraph to the appropriate section.
2017-11-24 09:28:12 -08:00
Emanuele Gaifas cdfe910e74 Extending Python Doc minor updates (GH-4518)
Move footnote markers to be closer to the related terminology:
before the end of the sentence, instead of after.
2017-11-24 00:49:57 -08:00
Berker Peksag 3df02dbc8e bpo-31325: Fix usage of namedtuple in RobotFileParser.parse() (#4529) 2017-11-23 15:40:26 -08:00
Raymond Hettinger 0858495a50
bpo-32099 Add deque variant of roundrobin() recipe (#4497)
* Minor wording tweaks
2017-11-23 13:32:23 -08:00
Berker Peksag dcaed6b2d9
bpo-19610: setup() now raises TypeError for invalid types (GH-4519)
The Distribution class now explicitly raises an
exception when 'classifiers', 'keywords' and
'platforms' fields are not specified as a list.
2017-11-23 21:34:20 +03:00
Jesse-Bakker 0784a2e5b1 bpo-10049: Add a "no-op" (null) context manager to contextlib (GH-4464)
Adds a simpler and faster alternative to ExitStack for handling
single optional context managers without having to change the
lexical structure of your code.
2017-11-23 10:23:28 +10:00
AraHaan 431665bf19 bpo-32105: add asyncio.BaseEventLoop.connect_accepted_socket versionadded to documentation. (#4491) 2017-11-21 11:06:26 -05:00
Barry Warsaw e256b40888
bpo-31672 - Add one last minor clarification for idpattern (#4483)
Add one last minor clarification for idpattern
2017-11-21 10:28:13 -05:00
Raymond Hettinger 337cbbace0
Add comment and improve variable name in roundrobin() (#4486) 2017-11-21 00:23:34 -08:00
Victor Stinner bc9b6e29cb
bpo-32043: Rephrase -X dev documentation (#4478)
* should not be more verbose if the code is correct
* enabled checks can be "expensive"
2017-11-20 18:59:50 -08:00
Victor Stinner 09f3a8a124
bpo-32089: Fix warnings filters in dev mode (#4482)
The developer mode (-X dev) now creates all default warnings filters
to order filters in the correct order to always show ResourceWarning
and make BytesWarning depend on the -b option.

Write a functional test to make sure that ResourceWarning is logged
twice at the same location in the developer mode.

Add a new 'dev_mode' field to _PyCoreConfig.
2017-11-20 17:32:40 -08:00
Yury Selivanov 423fd362f8
bpo-32066: Support pathlib.Path in create_unix_connection; sock arg should be optional (#4447) 2017-11-20 17:26:28 -05:00
Victor Stinner c5a2071586
bpo-32050: Fix -x option documentation (#4475)
The line number in correct when using the -x option: Py_Main() uses
ungetc() to not skip the first newline character.
2017-11-20 08:08:03 -08:00
Victor Stinner 44862df2ee
bpo-32047: -X dev enables asyncio debug mode (#4418)
The new -X dev command line option now also enables asyncio debug
mode.
2017-11-20 07:14:07 -08:00
Berker Peksag b56becb373
Remove outdated .pyo reference from msilib docs (GH-4461)
Since f299abdafa
the remove_pyc() method no longer tries to
remove .pyo files.
2017-11-19 13:04:25 +03:00
Masayuki Yamamoto 7750bded92 Document parameters of BaseServer.finish_request() (GH-4445) 2017-11-19 10:33:37 +03:00
Moses Koledoye 0c71653cb8 [Doc] Update opcode for var-positional arguments (#4446)
`BUILD_MAP_UNPACK_WITH_CALL` was duplicated as the opcode for both var-positional and var-keyword arguments. The opcode for the former was updated as `BUILD_TUPLE_UNPACK_WITH_CALL`.
2017-11-19 00:49:15 +02:00
Erik Bray d505a29a15 Fix typo in atexit documentation. (GH-4419)
`kargs` -> `kwargs`
2017-11-16 08:48:52 -08:00
Serhiy Storchaka cede8c9edb
bpo-31702: Allow to specify rounds for SHA-2 hashing in crypt.mksalt(). (#4110)
The log_rounds parameter for Blowfish has been replaced with the rounds parameter.
2017-11-16 13:22:51 +02:00
Victor Stinner ccb0442a33
bpo-32043: New "developer mode": "-X dev" option (#4413)
Add a new "developer mode": new "-X dev" command line option to
enable debug checks at runtime.

Changes:

* Add unit tests for -X dev
* test_cmd_line: replace test.support with support.
* Fix _PyRuntimeState_Fini(): Use the same memory allocator
   than _PyRuntimeState_Init().
* Fix _PyMem_GetDefaultRawAllocator()
2017-11-16 03:20:31 -08:00
Serhiy Storchaka 05cb728d68
bpo-30349: Raise FutureWarning for nested sets and set operations (#1553)
in regular expressions.
2017-11-16 12:38:26 +02:00
Serhiy Storchaka 0a2abdfca2
bpo-30143: 2to3 now generates a code that uses abstract collection classes (#1262)
from collections.abc rather than collections.
2017-11-16 09:16:24 +02:00
Antoine Pitrou 4bd41c9b52
bpo-32025: Add time.thread_time() (#4410)
* bpo-32025: Add time.thread_time()

* Add missing #endif

* Add NEWS blurb

* Add docs and whatsnew

* Address review comments

* Review comments
2017-11-15 22:52:21 +01:00
Serhiy Storchaka ddbce13786
bpo-32023: Disallow genexprs without parenthesis in class definitions. (#4400) 2017-11-15 17:39:37 +02:00
Serhiy Storchaka 9165f77d5f
bpo-32012: Disallow trailing comma after genexpr without parenthesis. (#4382) 2017-11-15 08:49:40 +02:00
Jesse-Bakker 3bda02222a bpo-31948: Fix broken links in msilib docs (GH-4397) 2017-11-14 15:06:15 -08:00
Serhiy Storchaka b0b44b4b33
bpo-15606: Improve the re.VERBOSE documentation. (#4366) 2017-11-14 17:21:26 +02:00
xdegaye e0582a37c8
bpo-30696: Fix the REPL looping endlessly when no memory (GH-4160) 2017-11-12 16:50:48 +01:00
Edward Betts e197a8538b The termios man page is in section 3 (GH-2450) 2017-11-11 19:40:26 +03:00
Berker Peksag 7c9da3e5ba
Remove redundant 'exc = True' line (GH-4357)
It can be removed after c28890fb42
2017-11-11 17:55:05 +03:00
Pablo Galindo e184cfd7bf bpo-31824: Document default value of 'errors' parameters (GH-4328) 2017-11-11 02:05:12 +03:00
Brian Curtin 9f914a01af
bpo-31985: Deprecate openfp in aifc, sunau, and wave (#4344)
The openfp functions of aifp, sunau, and wave had pointed to the open
function of each module since 1993 as a matter of backwards
compatibility. In the case of aifc.openfp, it was both undocumented
and untested. This change begins the formal deprecation of those
openfp functions, with their removal coming in 3.9.

This additionally adds a TODO in test_pyclbr around using aifc.openfp,
though it shouldn't be changed until removal in 3.9.
2017-11-10 11:38:25 -05:00
Cody Scott 72fa3014d5 Fix phrasing in Doc/whatsnew/3.7.rst (GH-4318) 2017-11-09 21:58:59 +03:00
Victor Stinner 8c663fd60e
Replace KB unit with KiB (#4293)
kB (*kilo* byte) unit means 1000 bytes, whereas KiB ("kibibyte")
means 1024 bytes. KB was misused: replace kB or KB with KiB when
appropriate.

Same change for MB and GB which become MiB and GiB.

Change the output of Tools/iobench/iobench.py.

Round also the size of the documentation from 5.5 MB to 5 MiB.
2017-11-08 14:44:44 -08:00
Tom Floyer bf9d317626 bpo-31810: added missing keywords to docs. (#4140)
async and await keywords has been merged into upstream, but they are
all missing in the lexical analysis docs. This change adds them to the
appropriate keywords section in documentation.
2017-11-08 12:31:26 -05:00
Petr Viktorin 2138163621 bpo-29179: Document the Py_UNUSED macro (#4341)
Py_UNUSED has a public name, and is used in the wild outside CPython,
but was not documented. Rectify that.

The macro was added in bpo-19976 and referenced in bpo-26179.
2017-11-08 07:59:20 -08:00
James b5d9e08114 bpo-31884 subprocess: add Windows constants for process priority (#4150) 2017-11-08 06:18:59 -08:00
Victor Stinner 54cc0c0789
bpo-31338: C API intro: add missing versionadded (#4339) 2017-11-08 06:06:24 -08:00
Berker Peksag 28ab3ce924
Fix broken link in Doc/whatsnew/3.7.rst (GH-4335) 2017-11-08 16:36:58 +03:00
Petr Viktorin 8bf288e2c5 Docs: Mention that Py_UNREACHABLE was added in 3.7 (#4337)
The macro was added for bpo-31338 in commit b2e5794870
2017-11-08 15:11:16 +02:00
Sanyam Khurana 7973e279a2 bpo-21862: Add -m option to cProfile for profiling modules (#4297)
* bpo-21862: Add -m option to cProfile for profiling modules
2017-11-08 11:50:56 +01:00
Justus Schwabedal 5a8a84b34f Added :const:`mmap.ACCESS_DEFAULT` constant. (#4093) 2017-11-07 12:51:43 -08:00
Julien Palard 5a66c8a64d bpo-31793: Doc: Specialize smart-quotes for Japanese (GH-4006) 2017-11-08 01:46:50 +09:00
Jelle Zijlstra 1e5d54cfa0 bpo-31965: fix doc for multiprocessing.connection.Client and Listener (#4304)
* fix doc for multiprocessing.connection.Client

The authenticate argument does not exist on either Client or Listener:
- https://github.com/python/cpython/blob/master/Lib/multiprocessing/connection.py#L483 (master)
- https://github.com/python/cpython/blob/3.6/Lib/multiprocessing/connection.py#L478 (3.6)
- https://github.com/python/cpython/blob/3.5/Lib/multiprocessing/connection.py#L478 (3.5)
- https://github.com/python/cpython/blob/3.4/Lib/multiprocessing/connection.py#L487 (3.4)
The documentation also claimed that these functions will call `current_process().auth_key`, for which I could find no evidence in the code. I rewrote the documentation to reflect the actual behavior.

Also made some small changes to vary sentence structure.
2017-11-07 17:13:02 +01:00
Antoine Pitrou 22b1128559
bpo-31960: Fix asyncio.Future documentation for thread (un)safety. (#4319) 2017-11-07 17:03:28 +01:00
Berker Peksag a935654f06
bpo-20486: Implement Database.Close() method in msilib (GH-4141) 2017-11-07 15:58:53 +03:00
Antoine Pitrou 4135c89395
bpo-31950: Improve event loop policy doc (#4306) 2017-11-07 10:26:32 +01:00
Marat Sharafutdinov 69cfed1cd7 Add asyncio.Handle.cancelled() method (#2388) 2017-11-07 12:06:05 +03:00
Barry Warsaw 962e2a7317
Fix a minor typo and hyphenate "multi-threading" (#4237) 2017-11-06 18:18:40 -08:00
Anders Lorentsen a22a127458 bpo-31843: sqlite3.connect() now accepts PathLike objects as database name (#4299) 2017-11-06 16:47:43 -08:00
Nir Soffer ad455cd924 bpo-31945: Configurable blocksize in HTTP(S)Connection (#4279)
blocksize was hardcoded to 8192, preventing efficient upload when using
file-like body. Add blocksize argument to __init__, so users can
configure the blocksize to fit their needs.

I tested this uploading data from /dev/zero to a web server dropping the
received data, to test the overhead of the HTTPConnection.send() with a
file-like object.

Here is an example 10g upload with the default buffer size (8192):

$ time ~/src/cpython/release/python upload-httplib.py 10 https://localhost:8000/
Uploaded 10.00g in 17.53 seconds (584.00m/s)

real	0m17.574s
user	0m8.887s
sys	0m5.971s

Same with 512k blocksize:

$ time ~/src/cpython/release/python upload-httplib.py 10 https://localhost:8000/
Uploaded 10.00g in 6.60 seconds (1551.15m/s)

real	0m6.641s
user	0m3.426s
sys	0m2.162s

In real world usage the difference will be smaller, depending on the
local and remote storage and the network.

See https://github.com/nirs/http-bench for more info.
2017-11-06 13:16:37 -08:00
luzpaz a5293b4ff2 Fix miscellaneous typos (#4275) 2017-11-05 15:37:50 +02:00
Nick Coghlan 1b46131ae4
bpo-22257: Mention startup refactoring in What's New (GH-4286)
While technically a purely internal change, bpo-31845 was
a fairly significant externally visible bug caused by
these changes (environment variable based configuration
was being ignored due to a change in the relative order
of reading the environment and reading command line settings,
and the test suite was only testing the command line options)

Hence this note to essentially say "If you see odd startup
problems in 3.7 that you've never seen in previous releases,
it's probably our fault, so let us know, and we'll fix it".
2017-11-05 14:58:45 +10:00
davy wybiral aafece7a9e bpo-31923: Fix spelling in sqlite3 docs (GH-4227) 2017-11-05 02:00:51 +03:00
Berker Peksag 12d60560ac
Add version{changed,added} markers and make minor style changes (GH-4273) 2017-11-04 15:17:56 +03:00
Serhiy Storchaka d4d79bc1ff
bpo-28564: Use os.scandir() in shutil.rmtree(). (#4085)
This speeds up it to 20-40%.
2017-11-04 14:16:35 +02:00
Phobosmir 82cd3cede8 bpo-31678: Fix typo in PyDateTime_DELTA_GET_MICROSECONDS (GH-3869) 2017-11-04 13:39:45 +03:00
Antoine Pitrou 63ff4131af
bpo-21423: Add an initializer argument to {Process,Thread}PoolExecutor (#4241)
* bpo-21423: Add an initializer argument to {Process,Thread}PoolExecutor

* Fix docstring
2017-11-04 11:05:49 +01:00
Chillar Anand b838cc3ff4 bpo-18699: Corrected documentation for window.chgat in curses module (#1430) 2017-11-04 10:13:16 +02:00
Barry Warsaw 93952f8815
Fix a grammatical problem and reword for clarity. (#4257)
bpo-31936
2017-11-03 13:45:46 -07:00
Barry Warsaw 700d2e4755
bpo-31415: Support PYTHONPROFILEIMPORTTIME envvar equivalent to -X importtime (#4240)
Support PYTHONPROFILEIMPORTTIME envvar equivalent to -X importtime
2017-11-02 16:13:36 -07:00
Simon Willison ac03c03b30 Returning 1 from the set_progress_handler handler cancels query (GH-4120) 2017-11-02 17:34:11 +03:00
Victor Stinner c29b585fd4
bpo-31784: Implement PEP 564: add time.time_ns() (#3989)
Add new time functions:

* time.clock_gettime_ns()
* time.clock_settime_ns()
* time.monotonic_ns()
* time.perf_counter_ns()
* time.process_time_ns()
* time.time_ns()

Add new _PyTime functions:

* _PyTime_FromTimespec()
* _PyTime_FromNanosecondsObject()
* _PyTime_FromTimeval()

Other changes:

* Add also os.times() tests to test_os.
* pytime_fromtimeval() and pytime_fromtimeval() now return
  _PyTime_MAX or _PyTime_MIN on overflow, rather than undefined
  behaviour
* _PyTime_FromNanoseconds() parameter type changes from long long to
  _PyTime_t
2017-11-02 07:28:27 -07:00
Vincent Michel e314853d57 bpo-31307: Make ConfigParser.read() accept bytes objects (GH-3420) 2017-11-02 15:47:04 +03:00