]> granicus.if.org Git - python/log
python
7 years agoasyncio: Remove asyncio/compat.py (#4606)
Victor Stinner [Tue, 28 Nov 2017 13:43:52 +0000 (14:43 +0100)]
asyncio: Remove asyncio/compat.py (#4606)

The asyncio/compat.py file was written to support Python < 3.5 and
Python < 3.5.2. But Python 3.5 doesn't accept bugfixes anymore, only
security fixes. There is no more need to backport bugfixes to Python
3.5, and so no need to have a single code base for Python 3.5, 3.6
and 3.7.

Say hello (again) to "async" and "await", who became real keywords in
Python 3.7 ;-)

7 years agoasyncio: use directly socket.socketpair() (#4597)
Victor Stinner [Tue, 28 Nov 2017 10:15:26 +0000 (11:15 +0100)]
asyncio: use directly socket.socketpair() (#4597)

Since Python 3.5, socket.socketpair() is also available on Windows,
and so can be used directly, rather than using
asyncio.windows_utils.socketpair().

7 years agoasyncio: Fix BaseSelectorEventLoopTests (#4595)
Victor Stinner [Mon, 27 Nov 2017 23:35:55 +0000 (00:35 +0100)]
asyncio: Fix BaseSelectorEventLoopTests (#4595)

Currently, two tests fail with PYTHONASYNCIODEBUG=1 (or using -X
dev).

7 years agoasyncio: Remove unused Future._tb_logger attribute (#4596)
Victor Stinner [Mon, 27 Nov 2017 23:35:33 +0000 (00:35 +0100)]
asyncio: Remove unused Future._tb_logger attribute (#4596)

It was only used on Python 3.3, now only Future._log_traceback is
used.

7 years agobpo-31245: asyncio: Fix typo, isistance => isinstance (#4594)
Victor Stinner [Mon, 27 Nov 2017 23:34:08 +0000 (00:34 +0100)]
bpo-31245: asyncio: Fix typo, isistance => isinstance (#4594)

7 years agoRevert "bpo-32107 - Better merge of #4494 (#4576)" (#4593)
Victor Stinner [Mon, 27 Nov 2017 23:30:21 +0000 (00:30 +0100)]
Revert "bpo-32107 - Better merge of #4494 (#4576)" (#4593)

This reverts commit 9522a218f7dff95c490ff359cc60e8c2af35f5c8.

7 years agobpo-32136: Separate embedding tests from C API tests (GH-4567)
Nick Coghlan [Mon, 27 Nov 2017 22:11:51 +0000 (08:11 +1000)]
bpo-32136: Separate embedding tests from C API tests (GH-4567)

Some parts of the C API are only relevant to larger
applications embedding CPython as a runtime engine.

The helpers to test those APIs are already separated
out into Programs/_testembed.c, this update moves
the associated test cases out into their own dedicated
test file.

7 years agoRevert "bpo-30487: automatically create a venv and install Sphinx when running make...
Ned Deily [Mon, 27 Nov 2017 22:07:32 +0000 (17:07 -0500)]
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 d8d6b9122134f040cd5a4f15f40f6c9e3386db4d.

7 years agobpo-32107 - Better merge of #4494 (#4576)
Barry Warsaw [Mon, 27 Nov 2017 19:40:10 +0000 (14:40 -0500)]
bpo-32107 - Better merge of #4494 (#4576)

Improve UUID1 MAC address calculation and related tests.

There are two bits in the MAC address that are relevant to UUID1.  The first is the locally administered vs. universally administered bit (second least significant of the first octet).   Physical network interfaces such as ethernet ports and wireless adapters will always be universally administered, but some interfaces --such as the interface that MacBook Pros communicate with their Touch Bars-- are locally administered.  The former are guaranteed to be globally unique, while the latter are demonstrably *not* globally unique and are in fact the same on every MBP with a Touch Bar.  With this bit is set, the MAC is locally administered; with it unset it is universally administered.

The other bit is the multicast bit (least significant bit of the first octet).  When no other MAC address can be found, RFC 4122 mandates that a random 48-bit number be generated.  This randomly generated number *must* have the multicast bit set.

The improvements in uuid.py include:

* Preferentially return a universally administered MAC address, falling back to a locally administered address if none of the former can be found.
* Improve several coding style issues, such as adding explicit returns of None, using a more readable bitmask pattern, and assuming that the ultimate fallback, random MAC generation will not fail (and propagating any exception there instead of swallowing them).

Improvements in test_uuid.py include:

* Always testing the calculated MAC for universal administration, unless explicitly disabled (i.e. for the random case), or implicitly disabled due to running in the Travis environment.  Travis test machines have *no* universally administered MAC address at the time of this writing.

7 years agobpo-27535: Fix memory leak with warnings ignore (#4489)
Victor Stinner [Mon, 27 Nov 2017 15:57:07 +0000 (16:57 +0100)]
bpo-27535: Fix memory leak with warnings ignore (#4489)

The warnings module doesn't leak memory anymore in the hidden
warnings registry for the "ignore" action of warnings filters.

The warn_explicit() function doesn't add the warning key to the
registry anymore for the "ignore" action.

7 years agobpo-32089: Use default action for ResourceWarning (#4584)
Victor Stinner [Mon, 27 Nov 2017 11:11:55 +0000 (12:11 +0100)]
bpo-32089: Use default action for ResourceWarning (#4584)

In development and debug mode, use the "default" action, rather than
the "always" action, for ResourceWarning in the default warnings
filters.

7 years agobpo-32051: Fix name shadowing in multiprocessing docs (GH-4469)
Jason Yang [Mon, 27 Nov 2017 01:18:33 +0000 (20:18 -0500)]
bpo-32051: Fix name shadowing in multiprocessing docs (GH-4469)

7 years agobpo-23033: Improve SSL Certificate handling (GH-937)
Mandeep Singh [Sun, 26 Nov 2017 22:31:27 +0000 (04:01 +0530)]
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.

7 years agobpo-29879: Update typing documentation. (GH-4573)
Ivan Levkivskyi [Sun, 26 Nov 2017 22:23:02 +0000 (23:23 +0100)]
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

7 years agobpo-30487: automatically create a venv and install Sphinx when running make (GH-4346)
Caleb Hattingh [Sun, 26 Nov 2017 21:18:30 +0000 (07:18 +1000)]
bpo-30487: automatically create a venv and install Sphinx when running make (GH-4346)

7 years agobpo-32126: Skip asyncio test when sem_open() is not functional (GH-4559)
xdegaye [Sun, 26 Nov 2017 09:31:44 +0000 (10:31 +0100)]
bpo-32126: Skip asyncio test when sem_open() is not functional (GH-4559)

7 years agobpo-32096: Ensure new embedding test can find the encodings module (GH-4566)
Nick Coghlan [Sun, 26 Nov 2017 04:19:13 +0000 (14:19 +1000)]
bpo-32096: Ensure new embedding test can find the encodings module (GH-4566)

7 years agobpo-11063: Handle uuid.h being in default include path (GH-4565)
Nick Coghlan [Sun, 26 Nov 2017 03:04:46 +0000 (13:04 +1000)]
bpo-11063: Handle uuid.h being in default include path (GH-4565)

find_file() returns an empty list if it finds the requested
header on the standard include path, so header existence
checks need to be explicitly against "is not None".

7 years agomark fatal_error as noreturn (#4563)
Benjamin Peterson [Sat, 25 Nov 2017 21:02:55 +0000 (13:02 -0800)]
mark fatal_error as noreturn (#4563)

clang can't figure out that fatal_error is noreturn itself and emits warnings:

../cpython/Python/pylifecycle.c:2116:1: warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
^
../cpython/Python/pylifecycle.c:2125:1: warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
^

7 years agobpo-26856: Skip test_pwd on Android until issue 32033 is fixed (GH-4561)
xdegaye [Sat, 25 Nov 2017 16:32:27 +0000 (17:32 +0100)]
bpo-26856: Skip test_pwd on Android until issue 32033 is fixed (GH-4561)

7 years agobpo-32059: setup.py now also searches the sysroot paths (GH-4452)
xdegaye [Sat, 25 Nov 2017 16:25:30 +0000 (17:25 +0100)]
bpo-32059: setup.py now also searches the sysroot paths (GH-4452)

detect_modules() in setup.py now also searches the sysroot paths when
cross-compiling.

7 years agobpo-24641: Improved error message for JSON unserializible keys. (#4364)
Serhiy Storchaka [Sat, 25 Nov 2017 15:38:20 +0000 (17:38 +0200)]
bpo-24641: Improved error message for JSON unserializible keys. (#4364)

Also updated an example for default() in the module docstring.
Removed quotes around type name in other error messages.

7 years agobpo-32071: Add unittest -k option (#4496)
Jonas Haag [Sat, 25 Nov 2017 15:23:52 +0000 (16:23 +0100)]
bpo-32071: Add unittest -k option (#4496)

* bpo-32071: Add unittest -k option

7 years agobpo-28334: netrc() now uses expanduser() to find .netrc file (GH-4537)
Berker Peksag [Sat, 25 Nov 2017 10:37:22 +0000 (13:37 +0300)]
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>
7 years agoImprove Scheduler Objects documentation. (GH-4556)
Mariatta [Sat, 25 Nov 2017 05:43:01 +0000 (21:43 -0800)]
Improve Scheduler Objects documentation. (GH-4556)

Mention that the lower the priority number, the higher priority it represents.

7 years agobpo-30004: Fix the code example of using group in Regex Howto Docs (GH-4443)
Mandeep Bhutani [Sat, 25 Nov 2017 04:56:00 +0000 (22:56 -0600)]
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.

7 years agobpo-32030: Add _PyPathConfig_Init() (#4551)
Victor Stinner [Sat, 25 Nov 2017 02:17:57 +0000 (03:17 +0100)]
bpo-32030: Add _PyPathConfig_Init() (#4551)

* Add _PyPathConfig_Init() and _PyPathConfig_Fini()
* Remove _Py_GetPathWithConfig()
* _PyPathConfig_Init() returns _PyInitError to allow to handle errors
  properly
* Add pathconfig_clear()
* Windows calculate_path_impl(): replace Py_FatalError() with
  _PyInitError
* Py_FinalizeEx() now calls _PyPathConfig_Fini() to release memory
* Fix _Py_InitializeMainInterpreter() regression: don't initialize
  path config if _disable_importlib is false
* PyPathConfig now uses dynamically allocated memory

7 years agobpo-32128: Skip test_nntplib.test_article_head_body() (#4552)
Victor Stinner [Sat, 25 Nov 2017 01:42:18 +0000 (02:42 +0100)]
bpo-32128: Skip test_nntplib.test_article_head_body() (#4552)

The NNTP server currently has troubles with SSL, whereas we don't
have the control on this server. This test blocks all CIs, so disable
it until a fix can be found.

7 years agoAsyncion-Dev docs: Fix the reference to sys.excepthook (GH-4414)
Ashley Camba [Fri, 24 Nov 2017 23:39:39 +0000 (00:39 +0100)]
Asyncion-Dev docs: Fix the reference to sys.excepthook (GH-4414)

7 years agobpo-32030: Add _PyMainInterpreterConfig.program_name (#4548)
Victor Stinner [Fri, 24 Nov 2017 23:01:23 +0000 (00:01 +0100)]
bpo-32030: Add _PyMainInterpreterConfig.program_name (#4548)

* Py_Main() now calls Py_SetProgramName() earlier to be able to get
  the program name in _PyMainInterpreterConfig_ReadEnv().
* Rename prog to program_name
* Rename progpath to program_name

7 years agobpo-32030: Add _PyMainInterpreterConfig_ReadEnv() (#4542)
Victor Stinner [Fri, 24 Nov 2017 21:55:40 +0000 (22:55 +0100)]
bpo-32030: Add _PyMainInterpreterConfig_ReadEnv() (#4542)

Py_GetPath() and Py_Main() now call
_PyMainInterpreterConfig_ReadEnv() to share the same code to get
environment variables.

Changes:

* Add _PyMainInterpreterConfig_ReadEnv()
* Add _PyMainInterpreterConfig_Clear()
* Add _PyMem_RawWcsdup()
* _PyMainInterpreterConfig: rename pythonhome to home
* Rename _Py_ReadMainInterpreterConfig() to
  _PyMainInterpreterConfig_Read()
* Use _Py_INIT_USER_ERR(), instead of _Py_INIT_ERR(), for decoding
  errors: the user is able to fix the issue, it's not a bug in
  Python. Same change was made in _Py_INIT_NO_MEMORY().
* Remove _Py_GetPythonHomeWithConfig()

7 years agobpo-32124: Document C functions safe before init (#4540)
Victor Stinner [Fri, 24 Nov 2017 21:30:27 +0000 (22:30 +0100)]
bpo-32124: Document C functions safe before init (#4540)

Explicitly document C functions and C variables that can be set
before Py_Initialize().

7 years agobpo-32125: Remove Py_UseClassExceptionsFlag flag (#4544)
Victor Stinner [Fri, 24 Nov 2017 21:06:38 +0000 (22:06 +0100)]
bpo-32125: Remove Py_UseClassExceptionsFlag flag (#4544)

This flag was deprecated and wasn't used anymore since Python 2.0.

7 years agobpo-28684: Remove useless import added by the previous commit (GH-4547)
xdegaye [Fri, 24 Nov 2017 17:56:22 +0000 (18:56 +0100)]
bpo-28684: Remove useless import added by the previous commit (GH-4547)

7 years agoImprove the String tutorial docs (GH-4541)
Will White [Fri, 24 Nov 2017 17:28:12 +0000 (17:28 +0000)]
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.

7 years agobpo-28684: asyncio tests handle PermissionError raised on binding unix sockets (GH...
xdegaye [Fri, 24 Nov 2017 16:35:55 +0000 (17:35 +0100)]
bpo-28684: asyncio tests handle PermissionError raised on binding unix sockets (GH-4503)

The test.support.skip_unless_bind_unix_socket() decorator is used to skip
asyncio tests that fail because the platform lacks a functional bind()
function for unix domain sockets (as it is the case for non root users on the
recent Android versions that run now SELinux in enforcing mode).

7 years agobpo-12239: Make GetProperty() return None for VT_EMPTY (GH-4539)
Berker Peksag [Fri, 24 Nov 2017 15:11:18 +0000 (18:11 +0300)]
bpo-12239: Make GetProperty() return None for VT_EMPTY (GH-4539)

The previous behavior was to raise an exception

    NotImplementedError: result of type 0

when the value of the property is VT_EMPTY.

7 years agobpo-32096: Remove obj and mem from _PyRuntime (#4532)
Victor Stinner [Fri, 24 Nov 2017 11:09:24 +0000 (12:09 +0100)]
bpo-32096: Remove obj and mem from _PyRuntime (#4532)

bpo-32096, bpo-30860:  Partially revert the commit
2ebc5ce42a8a9e047e790aefbf9a94811569b2b6:

* Move structures back from Include/internal/mem.h to
  Objects/obmalloc.c
* Remove _PyObject_Initialize() and _PyMem_Initialize()
* Remove Include/internal/pymalloc.h
* Add test_capi.test_pre_initialization_api():
   Make sure that it's possible to call Py_DecodeLocale(), and then call
   Py_SetProgramName() with the decoded string, before Py_Initialize().

PyMem_RawMalloc() and Py_DecodeLocale() can be called again before
_PyRuntimeState_Init().

Co-Authored-By: Eric Snow <ericsnowcurrently@gmail.com>
7 years agobpo-12382: Make OpenDatabase() raise better exception messages (GH-4528)
Berker Peksag [Fri, 24 Nov 2017 09:53:58 +0000 (12:53 +0300)]
bpo-12382: Make OpenDatabase() raise better exception messages (GH-4528)

Previously, 'msilib.OpenDatabase()' function raised a
cryptical exception message when it couldn't open or
create an MSI file. For example:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    _msi.MSIError: unknown error 6e

7 years agoExtending Python Doc minor updates (GH-4518)
Emanuele Gaifas [Fri, 24 Nov 2017 08:49:57 +0000 (09:49 +0100)]
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.

7 years agobpo-31325: Fix usage of namedtuple in RobotFileParser.parse() (#4529)
Berker Peksag [Thu, 23 Nov 2017 23:40:26 +0000 (02:40 +0300)]
bpo-31325: Fix usage of namedtuple in RobotFileParser.parse() (#4529)

7 years agobpo-32099 Add deque variant of roundrobin() recipe (#4497)
Raymond Hettinger [Thu, 23 Nov 2017 21:32:23 +0000 (13:32 -0800)]
bpo-32099 Add deque variant of roundrobin() recipe (#4497)

* Minor wording tweaks

7 years agobpo-19610: setup() now raises TypeError for invalid types (GH-4519)
Berker Peksag [Thu, 23 Nov 2017 18:34:20 +0000 (21:34 +0300)]
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.

7 years agobpo-31979: Remove unused align_maxchar() function (#4527)
Victor Stinner [Thu, 23 Nov 2017 18:02:23 +0000 (19:02 +0100)]
bpo-31979: Remove unused align_maxchar() function (#4527)

7 years agobpo-32030: Fix calculate_path() on macOS (#4526)
Victor Stinner [Thu, 23 Nov 2017 18:02:04 +0000 (19:02 +0100)]
bpo-32030: Fix calculate_path() on macOS (#4526)

7 years agobpo-27535: Cleanup create_filter() (#4516)
Victor Stinner [Thu, 23 Nov 2017 16:13:44 +0000 (17:13 +0100)]
bpo-27535: Cleanup create_filter() (#4516)

create_filter() now expects the action as a _Py_Identifier which
avoids string comparison, and more important, to avoid handling the
"unknown action" annoying case.

7 years agobpo-32030: Rewrite calculate_path() (#4521)
Victor Stinner [Thu, 23 Nov 2017 16:03:20 +0000 (17:03 +0100)]
bpo-32030: Rewrite calculate_path() (#4521)

* calculate_path() rewritten in Modules/getpath.c and PC/getpathp.c
* Move global variables into a new PyPathConfig structure.
* calculate_path():

  * Split the huge calculate_path() function into subfunctions.
  * Add PyCalculatePath structure to pass data between subfunctions.
  * Document PyCalculatePath fields.
  * Move cleanup code into a new calculate_free() subfunction
  * calculate_init() now handles Py_DecodeLocale() failures properly
  * calculate_path() is now atomic: only replace PyPathConfig
    (path_config) at once on success.

* _Py_GetPythonHomeWithConfig() now returns an error on failure
* Add _Py_INIT_NO_MEMORY() helper: report a memory allocation failure
* Coding style fixes (PEP 7)

7 years agobpo-1102: View.Fetch() now returns None when it's exhausted (GH-4459)
Berker Peksag [Thu, 23 Nov 2017 12:47:30 +0000 (15:47 +0300)]
bpo-1102: View.Fetch() now returns None when it's exhausted (GH-4459)

7 years agobpo-28762: Revert last commit (now using Android Unified Headers) (GH-4488)
xdegaye [Thu, 23 Nov 2017 11:01:36 +0000 (12:01 +0100)]
bpo-28762: Revert last commit (now using Android Unified Headers) (GH-4488)

7 years agobpo-29040: Support building Android with Unified Headers (GH-4492)
xdegaye [Thu, 23 Nov 2017 10:44:38 +0000 (11:44 +0100)]
bpo-29040: Support building Android with Unified Headers (GH-4492)

7 years agobpo-28538: Revert all the changes (now using Android Unified Headers) (GH-4479)
xdegaye [Thu, 23 Nov 2017 10:13:22 +0000 (11:13 +0100)]
bpo-28538: Revert all the changes (now using Android Unified Headers) (GH-4479)

7 years agobpo-32030: Add _PyMainInterpreterConfig.pythonhome (#4513)
Victor Stinner [Thu, 23 Nov 2017 09:43:14 +0000 (10:43 +0100)]
bpo-32030: Add _PyMainInterpreterConfig.pythonhome (#4513)

* Py_Main() now reads the PYTHONHOME environment variable
* Add _Py_GetPythonHomeWithConfig() private function
* Add _PyWarnings_InitWithConfig()
* init_filters() doesn't get the current core configuration from the
  current interpreter or Python thread anymore. Pass explicitly the
  configuration to _PyWarnings_InitWithConfig().
* _Py_InitializeCore() now fails on _PyWarnings_InitWithConfig()
  failure.
* Pass configuration as constant

7 years agobpo-32030: Move PYTHONPATH to _PyMainInterpreterConfig (#4511)
Victor Stinner [Thu, 23 Nov 2017 00:49:45 +0000 (01:49 +0100)]
bpo-32030: Move PYTHONPATH to _PyMainInterpreterConfig (#4511)

Move _PyCoreConfig.module_search_path_env to _PyMainInterpreterConfig
structure.

7 years agobpo-10049: Add a "no-op" (null) context manager to contextlib (GH-4464)
Jesse-Bakker [Thu, 23 Nov 2017 00:23:28 +0000 (01:23 +0100)]
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.

7 years agobpo-32100: IDLE: Fix pathbrowser errors; improve tests. (#4484)
Cheryl Sabella [Thu, 23 Nov 2017 00:05:25 +0000 (19:05 -0500)]
bpo-32100: IDLE: Fix pathbrowser errors; improve tests. (#4484)

Patch mostly by Cheryl Sabella

7 years agobpo-32030: Add _PyCoreConfig.module_search_path_env (#4504)
Victor Stinner [Wed, 22 Nov 2017 23:12:09 +0000 (00:12 +0100)]
bpo-32030: Add _PyCoreConfig.module_search_path_env (#4504)

Changes:

* Py_Main() initializes _PyCoreConfig.module_search_path_env from
  the PYTHONPATH environment variable.
* PyInterpreterState_New() now initializes core_config and config
  fields
* Compute sys.path a little bit ealier in
  _Py_InitializeMainInterpreter() and new_interpreter()
* Add _Py_GetPathWithConfig() private function.

7 years agobpo-27535: Optimize warnings.warn() (#4508)
Victor Stinner [Wed, 22 Nov 2017 22:51:42 +0000 (23:51 +0100)]
bpo-27535: Optimize warnings.warn() (#4508)

* Optimize warnings.filterwarnings(). Replace re.compile('') with
  None to avoid the cost of calling a regex.match() method, whereas
  it always matchs.
* Optimize get_warnings_attr(): replace PyObject_GetAttrString() with
  _PyObject_GetAttrId().

Cleanup also create_filter():

* Use _Py_IDENTIFIER() to allow to cleanup strings at Python
  finalization
* Replace Py_FatalError() with a regular exceptions

7 years agobpo-31324: Fix test.support.set_match_tests(None) (#4505)
Victor Stinner [Wed, 22 Nov 2017 19:58:59 +0000 (20:58 +0100)]
bpo-31324: Fix test.support.set_match_tests(None) (#4505)

7 years agobpo-31324: Optimize support._match_test() (#4421)
Victor Stinner [Tue, 21 Nov 2017 23:34:02 +0000 (15:34 -0800)]
bpo-31324: Optimize support._match_test() (#4421)

* Rename support._match_test() to support.match_test(): make it
  public
* Remove support.match_tests global variable. It is replaced with a
  new support.set_match_tests() function, so match_test() doesn't
  have to check each time if patterns were modified.
* Rewrite match_test(): use different code paths depending on the
  kind of patterns for best performances.

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
7 years agobpo-32105: add asyncio.BaseEventLoop.connect_accepted_socket versionadded to document...
AraHaan [Tue, 21 Nov 2017 16:06:26 +0000 (11:06 -0500)]
bpo-32105: add asyncio.BaseEventLoop.connect_accepted_socket versionadded to documentation. (#4491)

7 years agobpo-31672 - Add one last minor clarification for idpattern (#4483)
Barry Warsaw [Tue, 21 Nov 2017 15:28:13 +0000 (10:28 -0500)]
bpo-31672 - Add one last minor clarification for idpattern (#4483)

Add one last minor clarification for idpattern

7 years agoAdd comment and improve variable name in roundrobin() (#4486)
Raymond Hettinger [Tue, 21 Nov 2017 08:23:34 +0000 (00:23 -0800)]
Add comment and improve variable name in roundrobin() (#4486)

7 years agobpo-32043: Rephrase -X dev documentation (#4478)
Victor Stinner [Tue, 21 Nov 2017 02:59:50 +0000 (18:59 -0800)]
bpo-32043: Rephrase -X dev documentation (#4478)

* should not be more verbose if the code is correct
* enabled checks can be "expensive"

7 years agobpo-32030: Add more options to _PyCoreConfig (#4485)
Victor Stinner [Tue, 21 Nov 2017 02:12:22 +0000 (18:12 -0800)]
bpo-32030: Add more options to _PyCoreConfig (#4485)

Py_Main() now handles two more -X options:

* -X showrefcount: new _PyCoreConfig.show_ref_count field
* -X showalloccount: new _PyCoreConfig.show_alloc_count field

7 years agobpo-32089: Fix warnings filters in dev mode (#4482)
Victor Stinner [Tue, 21 Nov 2017 01:32:40 +0000 (17:32 -0800)]
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.

7 years agobpo-32094: Update subprocess for -X dev (#4480)
Victor Stinner [Mon, 20 Nov 2017 23:24:56 +0000 (15:24 -0800)]
bpo-32094: Update subprocess for -X dev (#4480)

Modify subprocess._args_from_interpreter_flags() to handle -X dev
option.

Add also unit tests for test.support.args_from_interpreter_flags()
and test.support.optim_args_from_interpreter_flags().

7 years agobpo-32066: Support pathlib.Path in create_unix_connection; sock arg should be optiona...
Yury Selivanov [Mon, 20 Nov 2017 22:26:28 +0000 (17:26 -0500)]
bpo-32066: Support pathlib.Path in create_unix_connection; sock arg should be optional (#4447)

7 years agobpo-32088: Display Deprecation in debug mode (#4474)
Victor Stinner [Mon, 20 Nov 2017 17:47:03 +0000 (09:47 -0800)]
bpo-32088: Display Deprecation in debug mode (#4474)

When Python is build is debug mode (Py_DEBUG), DeprecationWarning,
PendingDeprecationWarning and ImportWarning warnings are now
displayed by default.

test_venv: run "-m pip" and "-m ensurepip._uninstall" with -W
ignore::DeprecationWarning since pip code is not part of Python.

7 years agobpo-32050: Fix -x option documentation (#4475)
Victor Stinner [Mon, 20 Nov 2017 16:08:03 +0000 (08:08 -0800)]
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.

7 years agobpo-32047: -X dev enables asyncio debug mode (#4418)
Victor Stinner [Mon, 20 Nov 2017 15:14:07 +0000 (07:14 -0800)]
bpo-32047: -X dev enables asyncio debug mode (#4418)

The new -X dev command line option now also enables asyncio debug
mode.

7 years agoRemove duplicated import from datetime tests (#4444)
Riccardo Magliocchetti [Mon, 20 Nov 2017 08:48:56 +0000 (09:48 +0100)]
Remove duplicated import from datetime tests (#4444)

7 years agobpo-30904: Removed duplicated Host: header. (#4465)
Vinay Sajip [Sun, 19 Nov 2017 18:36:17 +0000 (18:36 +0000)]
bpo-30904: Removed duplicated Host: header. (#4465)

7 years agoRemove outdated .pyo reference from msilib docs (GH-4461)
Berker Peksag [Sun, 19 Nov 2017 10:04:25 +0000 (13:04 +0300)]
Remove outdated .pyo reference from msilib docs (GH-4461)

Since f299abdafa0f2b6eb7abae274861b19b361c96bc
the remove_pyc() method no longer tries to
remove .pyo files.

7 years agoDocument parameters of BaseServer.finish_request() (GH-4445)
Masayuki Yamamoto [Sun, 19 Nov 2017 07:33:37 +0000 (16:33 +0900)]
Document parameters of BaseServer.finish_request() (GH-4445)

7 years ago[Doc] Update opcode for var-positional arguments (#4446)
Moses Koledoye [Sat, 18 Nov 2017 22:49:15 +0000 (23:49 +0100)]
[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`.

7 years agobpo-32031: Fix pydoc `test_mixed_case_module_names_are_lower_cased` (GH-4441)
xdegaye [Sat, 18 Nov 2017 17:20:21 +0000 (18:20 +0100)]
bpo-32031: Fix pydoc `test_mixed_case_module_names_are_lower_cased` (GH-4441)

When there is a symlink in the directory path of the standard library.

7 years agobpo-29185: Fix `test_distutils` failures on Android (GH-4438)
xdegaye [Sat, 18 Nov 2017 17:17:16 +0000 (18:17 +0100)]
bpo-29185: Fix `test_distutils` failures on Android (GH-4438)

* Run gzip with separate command line options (Android understands  '-f9' as the name of a file).
* Creation of a hard link is controled by SELinux on Android.

7 years agobpo-29184: Skip test_socketserver tests on PermissionError raised by Android (GH...
xdegaye [Sat, 18 Nov 2017 17:10:53 +0000 (18:10 +0100)]
bpo-29184: Skip test_socketserver tests on PermissionError raised by Android (GH-4387)

7 years agobpo-32069: Drop legacy SSL transport (#4451)
Andrew Svetlov [Sat, 18 Nov 2017 16:54:05 +0000 (18:54 +0200)]
bpo-32069: Drop legacy SSL transport (#4451)

* Drop legacy SSL transport

* Drop unused import

* Fix Windows tests

* Drop never executed on Python 3.4+ code

7 years agobpo-31867: Remove duplicates in default mimetypes. (#4388)
Henk-Jaap Wagenaar [Fri, 17 Nov 2017 10:10:19 +0000 (10:10 +0000)]
bpo-31867: Remove duplicates in default mimetypes. (#4388)

7 years agotokenizer: Remove unused tabs options (#4422)
Victor Stinner [Fri, 17 Nov 2017 09:25:47 +0000 (01:25 -0800)]
tokenizer: Remove unused tabs options (#4422)

Remove the following fields from tok_state structure which are now
used unused:

* altwarning: "Issue warning if alternate tabs don't match"
* alterror: "Issue error if alternate tabs don't match"
* alttabsize: "Alternate tab spacing"

Replace alttabsize variable with ALTTABSIZE define.

7 years agobpo-31691: Specify where to find build instructions for the Windows installer (#4426)
native-api [Thu, 16 Nov 2017 23:56:27 +0000 (02:56 +0300)]
bpo-31691: Specify where to find build instructions for the Windows installer (#4426)

7 years agoFix typo in atexit documentation. (GH-4419)
Erik Bray [Thu, 16 Nov 2017 16:48:52 +0000 (17:48 +0100)]
Fix typo in atexit documentation. (GH-4419)

`kargs` -> `kwargs`

7 years agobpo-31702: Allow to specify rounds for SHA-2 hashing in crypt.mksalt(). (#4110)
Serhiy Storchaka [Thu, 16 Nov 2017 11:22:51 +0000 (13:22 +0200)]
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.

7 years agobpo-32043: New "developer mode": "-X dev" option (#4413)
Victor Stinner [Thu, 16 Nov 2017 11:20:31 +0000 (03:20 -0800)]
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()

7 years agobpo-30349: Raise FutureWarning for nested sets and set operations (#1553)
Serhiy Storchaka [Thu, 16 Nov 2017 10:38:26 +0000 (12:38 +0200)]
bpo-30349: Raise FutureWarning for nested sets and set operations (#1553)

in regular expressions.

7 years agobpo-32037: Use the INT opcode for 32-bit integers in protocol 0 pickles. (#4407)
Serhiy Storchaka [Thu, 16 Nov 2017 07:44:43 +0000 (09:44 +0200)]
bpo-32037: Use the INT opcode for 32-bit integers in protocol 0 pickles. (#4407)

7 years agobpo-30143: 2to3 now generates a code that uses abstract collection classes (#1262)
Serhiy Storchaka [Thu, 16 Nov 2017 07:16:24 +0000 (09:16 +0200)]
bpo-30143: 2to3 now generates a code that uses abstract collection classes (#1262)

from collections.abc rather than collections.

7 years agobpo-32030: Enhance Py_Main() (#4412)
Victor Stinner [Thu, 16 Nov 2017 02:11:45 +0000 (18:11 -0800)]
bpo-32030: Enhance Py_Main() (#4412)

Parse more env vars in Py_Main():

* Add more options to _PyCoreConfig:

  * faulthandler
  * tracemalloc
  * importtime

* Move code to parse environment variables from _Py_InitializeCore()
  to Py_Main(). This change fixes a regression from Python 3.6:
  PYTHONUNBUFFERED is now read before calling pymain_init_stdio().
* _PyFaulthandler_Init() and _PyTraceMalloc_Init() now take an
  argument to decide if the module has to be enabled at startup.
* tracemalloc_start() is now responsible to check the maximum number
  of frames.

Other changes:

* Cleanup Py_Main():

  * Rename some pymain_xxx() subfunctions
  * Add pymain_run_python() subfunction

* Cleanup Py_NewInterpreter()
* _PyInterpreterState_Enable() now reports failure
* init_hash_secret() now considers pyurandom() failure as an "user
  error": don't fail with abort().
* pymain_optlist_append() and pymain_strdup() now sets err on memory
  allocation failure.

7 years agobpo-32030: Split Py_Main() into subfunctions (#4399)
Victor Stinner [Wed, 15 Nov 2017 23:48:08 +0000 (15:48 -0800)]
bpo-32030: Split Py_Main() into subfunctions (#4399)

* Don't use "Python runtime" anymore to parse command line options or
  to get environment variables: pymain_init() is now a strict
  separation.
* Use an error message rather than "crashing" directly with
  Py_FatalError(). Limit the number of calls to Py_FatalError(). It
  prepares the code to handle errors more nicely later.
* Warnings options (-W, PYTHONWARNINGS) and "XOptions" (-X) are now
  only added to the sys module once Python core is properly
  initialized.
* _PyMain is now the well identified owner of some important strings
  like: warnings options, XOptions, and the "program name". The
  program name string is now properly freed at exit.
  pymain_free() is now responsible to free the "command" string.
* Rename most methods in Modules/main.c to use a "pymain_" prefix to
  avoid conflits and ease debug.
* Replace _Py_CommandLineDetails_INIT with memset(0)
* Reorder a lot of code to fix the initialization ordering. For
  example, initializing standard streams now comes before parsing
  PYTHONWARNINGS.
* Py_Main() now handles errors when adding warnings options and
  XOptions.
* Add _PyMem_GetDefaultRawAllocator() private function.
* Cleanup _PyMem_Initialize(): remove useless global constants: move
  them into _PyMem_Initialize().
* Call _PyRuntime_Initialize() as soon as possible:
  _PyRuntime_Initialize() now returns an error message on failure.
* Add _PyInitError structure and following macros:

  * _Py_INIT_OK()
  * _Py_INIT_ERR(msg)
  * _Py_INIT_USER_ERR(msg): "user" error, don't abort() in that case
  * _Py_INIT_FAILED(err)

7 years agobpo-32034: Make IncompleteReadError & LimitOverrunError pickleable #4409
Yury Selivanov [Wed, 15 Nov 2017 22:14:28 +0000 (17:14 -0500)]
bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable #4409

7 years agobpo-32025: Add time.thread_time() (#4410)
Antoine Pitrou [Wed, 15 Nov 2017 21:52:21 +0000 (22:52 +0100)]
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

7 years agobpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)
Dong-hee Na [Wed, 15 Nov 2017 18:30:59 +0000 (03:30 +0900)]
bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)

7 years agobpo-30399: Get rid of trailing comma in the repr of BaseException. (#1650)
Serhiy Storchaka [Wed, 15 Nov 2017 15:53:28 +0000 (17:53 +0200)]
bpo-30399: Get rid of trailing comma in the repr of BaseException. (#1650)

7 years agobpo-30950: Convert round() to Argument Clinic. (#2740)
Serhiy Storchaka [Wed, 15 Nov 2017 15:51:14 +0000 (17:51 +0200)]
bpo-30950: Convert round() to Argument Clinic. (#2740)

7 years agobpo-32011: Revert "Issue #15480: Remove the deprecated and unused TYPE_INT64 code...
Serhiy Storchaka [Wed, 15 Nov 2017 15:41:05 +0000 (17:41 +0200)]
bpo-32011: Revert "Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal." (#4381)

Simplify the reverted code.

This reverts commit e9bbe8b87ba2874efba0474af5cc7d5941dbf742.

7 years agobpo-32023: Disallow genexprs without parenthesis in class definitions. (#4400)
Serhiy Storchaka [Wed, 15 Nov 2017 15:39:37 +0000 (17:39 +0200)]
bpo-32023: Disallow genexprs without parenthesis in class definitions. (#4400)

7 years agobpo-31949: Fixed several issues in printing tracebacks (PyTraceBack_Print()). (#4289)
Serhiy Storchaka [Wed, 15 Nov 2017 15:38:52 +0000 (17:38 +0200)]
bpo-31949: Fixed several issues in printing tracebacks (PyTraceBack_Print()). (#4289)

* Setting sys.tracebacklimit to 0 or less now suppresses printing tracebacks.
* Setting sys.tracebacklimit to None now causes using the default limit.
* Setting sys.tracebacklimit to an integer larger than LONG_MAX now means using
  the limit LONG_MAX rather than the default limit.
* Fixed integer overflows in the case of more than 2**31 traceback items on
  Windows.
* Fixed output errors handling.

7 years agobpo-32032: Test both implementations of module-level pickle API. (#4401)
Serhiy Storchaka [Wed, 15 Nov 2017 12:01:08 +0000 (14:01 +0200)]
bpo-32032: Test both implementations of module-level pickle API. (#4401)

7 years agoChanged lambda to str.strip in _strip_spaces in logging.config (#4332)
sanjayp [Wed, 15 Nov 2017 09:28:11 +0000 (14:58 +0530)]
Changed lambda to str.strip in _strip_spaces in logging.config (#4332)