Commit Graph

100466 Commits

Author SHA1 Message Date
Victor Stinner 92f9339a58
asyncio: Fix BaseSelectorEventLoopTests (#4595)
Currently, two tests fail with PYTHONASYNCIODEBUG=1 (or using -X
dev).
2017-11-28 00:35:55 +01:00
Victor Stinner c16bacec3c
asyncio: Remove unused Future._tb_logger attribute (#4596)
It was only used on Python 3.3, now only Future._log_traceback is
used.
2017-11-28 00:35:33 +01:00
Victor Stinner 28e61650b2
bpo-31245: asyncio: Fix typo, isistance => isinstance (#4594) 2017-11-28 00:34:08 +01:00
Victor Stinner c9409f7c45
Revert "bpo-32107 - Better merge of #4494 (#4576)" (#4593)
This reverts commit 9522a218f7.
2017-11-28 00:30:21 +01:00
Nick Coghlan 39f0bb5ad0
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.
2017-11-28 08:11:51 +10: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
Barry Warsaw 9522a218f7
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.
2017-11-27 14:40:10 -05:00
Victor Stinner c9758784eb
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.
2017-11-27 16:57:07 +01:00
Victor Stinner 21c7730761
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.
2017-11-27 12:11:55 +01: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
xdegaye a6fba9b827
bpo-32126: Skip asyncio test when sem_open() is not functional (GH-4559) 2017-11-26 10:31:44 +01:00
Nick Coghlan 4274609e18
bpo-32096: Ensure new embedding test can find the encodings module (GH-4566) 2017-11-26 14:19:13 +10:00
Nick Coghlan 53efbf3977
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".
2017-11-26 13:04:46 +10:00
Benjamin Peterson cef88b9c15
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]
}
^
2017-11-25 13:02:55 -08:00
xdegaye 76fdac4c9f
bpo-26856: Skip test_pwd on Android until issue 32033 is fixed (GH-4561) 2017-11-25 17:32:27 +01:00
xdegaye 77f5139954
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.
2017-11-25 17:25:30 +01:00
Serhiy Storchaka cfa797c068
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.
2017-11-25 17:38:20 +02: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
Victor Stinner 9316ee4da2
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
2017-11-25 03:17:57 +01:00
Victor Stinner 706cb3162e
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.
2017-11-25 02:42:18 +01: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 f04ebe2a4d
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
2017-11-25 00:01:23 +01:00
Victor Stinner 46972b7bc3
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()
2017-11-24 22:55:40 +01: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
Victor Stinner da9c8c36ae
bpo-32125: Remove Py_UseClassExceptionsFlag flag (#4544)
This flag was deprecated and wasn't used anymore since Python 2.0.
2017-11-24 22:06:38 +01:00
xdegaye 5742f674f7
bpo-28684: Remove useless import added by the previous commit (GH-4547) 2017-11-24 18:56:22 +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
xdegaye 0f86cd38f4
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).
2017-11-24 17:35:55 +01:00
Berker Peksag 19fb134185
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.
2017-11-24 18:11:18 +03:00
Victor Stinner 9e87e7776f
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>
2017-11-24 12:09:24 +01:00
Berker Peksag 4864a619dc
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
2017-11-24 12:53:58 +03: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
Victor Stinner 6a54c676e6
bpo-31979: Remove unused align_maxchar() function (#4527) 2017-11-23 19:02:23 +01:00
Victor Stinner b9197959c1
bpo-32030: Fix calculate_path() on macOS (#4526) 2017-11-23 19:02:04 +01:00
Victor Stinner b98f1715a3
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.
2017-11-23 17:13:44 +01:00
Victor Stinner 0327bde9da
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)
2017-11-23 17:03:20 +01:00
Berker Peksag bdb8315c21
bpo-1102: View.Fetch() now returns None when it's exhausted (GH-4459) 2017-11-23 15:47:30 +03:00
xdegaye 5ce1069a6f
bpo-28762: Revert last commit (now using Android Unified Headers) (GH-4488) 2017-11-23 12:01:36 +01:00
xdegaye c06c22e9a9
bpo-29040: Support building Android with Unified Headers (GH-4492) 2017-11-23 11:44:38 +01:00
xdegaye 5ad7ef8e42
bpo-28538: Revert all the changes (now using Android Unified Headers) (GH-4479) 2017-11-23 11:13:22 +01:00
Victor Stinner 1f15111a6e
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
2017-11-23 10:43:14 +01:00