Commit Graph

100726 Commits

Author SHA1 Message Date
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
Victor Stinner e32e79f7d8
bpo-32030: Move PYTHONPATH to _PyMainInterpreterConfig (#4511)
Move _PyCoreConfig.module_search_path_env to _PyMainInterpreterConfig
structure.
2017-11-23 01:49:45 +01: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
Cheryl Sabella 20d48a44a5 bpo-32100: IDLE: Fix pathbrowser errors; improve tests. (#4484)
Patch mostly by Cheryl Sabella
2017-11-22 19:05:25 -05:00
Victor Stinner d434110974
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.
2017-11-23 00:12:09 +01:00
Victor Stinner 82656276ca
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
2017-11-22 23:51:42 +01:00
Victor Stinner bb11c3c967
bpo-31324: Fix test.support.set_match_tests(None) (#4505) 2017-11-22 20:58:59 +01:00
Victor Stinner 803ddd8ce2
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>
2017-11-21 15:34:02 -08: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 25420fe290
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
2017-11-20 18:12:22 -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
Victor Stinner f39b674876
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().
2017-11-20 15:24:56 -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 895862aa01 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.
2017-11-20 18:47:03 +01: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
Riccardo Magliocchetti 04dee27208 Remove duplicated import from datetime tests (#4444) 2017-11-20 10:48:56 +02:00
Vinay Sajip e96ba183c4
bpo-30904: Removed duplicated Host: header. (#4465) 2017-11-19 18:36:17 +00: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
xdegaye ebfaa71c2e
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.
2017-11-18 18:20:21 +01:00
xdegaye d34d8fc24f
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.
2017-11-18 18:17:16 +01:00
xdegaye 9001d1f438
bpo-29184: Skip test_socketserver tests on PermissionError raised by Android (GH-4387) 2017-11-18 18:10:53 +01:00
Andrew Svetlov 51d546ae4d
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
2017-11-18 18:54:05 +02:00
Henk-Jaap Wagenaar f02f5e5c3e bpo-31867: Remove duplicates in default mimetypes. (#4388) 2017-11-17 12:10:19 +02:00
Victor Stinner f2ddc6ac93
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.
2017-11-17 01:25:47 -08:00
native-api fd0fa67464 bpo-31691: Specify where to find build instructions for the Windows installer (#4426) 2017-11-16 15:56:27 -08: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 3daaafb700
bpo-32037: Use the INT opcode for 32-bit integers in protocol 0 pickles. (#4407) 2017-11-16 09:44:43 +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
Victor Stinner a7368ac636
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.
2017-11-15 18:11:45 -08:00
Victor Stinner f7e5b56c37
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)
2017-11-15 15:48:08 -08:00
Yury Selivanov 43605e6bfa
bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable #4409 2017-11-15 17:14:28 -05: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