]> granicus.if.org Git - python/log
python
6 years agobpo-36444: Add _PyCoreConfig._init_main (GH-12572)
Victor Stinner [Wed, 27 Mar 2019 01:04:16 +0000 (02:04 +0100)]
bpo-36444: Add _PyCoreConfig._init_main (GH-12572)

* Add _PyCoreConfig._init_main: if equals to zero,
  _Py_InitializeFromConfig() doesn't call
  _Py_InitializeMainInterpreter().
* Add interp_p parameter to _Py_InitializeFromConfig().
* pymain_init() now calls _Py_InitializeFromConfig().
* Make _Py_InitializeCore() private.

6 years agobpo-36444: Remove _PyMainInterpreterConfig (GH-12571)
Victor Stinner [Wed, 27 Mar 2019 00:36:16 +0000 (01:36 +0100)]
bpo-36444: Remove _PyMainInterpreterConfig (GH-12571)

6 years agobpo-36429: Fix starting IDLE with pyshell (#12548)
Terry Jan Reedy [Tue, 26 Mar 2019 23:58:19 +0000 (19:58 -0400)]
bpo-36429: Fix starting IDLE with pyshell (#12548)

Add idlelib.pyshell alias at top; remove pyshell alias at bottom.
Remove obsolete __name__=='__main__' command.

6 years agobpo-36301: Test Python init with isolated (GH-12569)
Victor Stinner [Tue, 26 Mar 2019 23:26:18 +0000 (00:26 +0100)]
bpo-36301: Test Python init with isolated (GH-12569)

Add test_preinit_isolated1() and test_preinit_isolated2() test_embed.

6 years agobpo-34203: FAQ: improve wording of paragraph about 2.x vs. 3.x (GH-9821)
Tal Einat [Tue, 26 Mar 2019 21:10:40 +0000 (23:10 +0200)]
bpo-34203: FAQ: improve wording of paragraph about 2.x vs. 3.x (GH-9821)

6 years agobpo-36364: fix SharedMemoryManager examples (GH-12439)
Pierre Glaser [Tue, 26 Mar 2019 19:12:26 +0000 (20:12 +0100)]
bpo-36364: fix SharedMemoryManager examples (GH-12439)

Examples of the `multiprocessing.shared_memory` module try to import `SharedMemoryManager` from `multiprocessing.shared_memory` whereas this class is defined in `multiprocessing.managers`.

6 years agobpo-36301: Cleanup preconfig.c and coreconfig.c (GH-12563)
Victor Stinner [Tue, 26 Mar 2019 15:58:50 +0000 (16:58 +0100)]
bpo-36301: Cleanup preconfig.c and coreconfig.c (GH-12563)

* _PyCoreConfig_Write() now updates _PyRuntime.preconfig
* Remove _PyPreCmdline_Copy()
* _PyPreCmdline_Read() now accepts _PyPreConfig and _PyCoreConfig
  optional configurations.
* Rename _PyPreConfig_ReadFromArgv() to _PyPreConfig_Read(). Simplify
  the code.
* Calling _PyCoreConfig_Read() no longer adds the warning options
  twice: don't add a warning option if it's already in the list.
* Rename _PyCoreConfig_ReadFromArgv() to _PyCoreConfig_Read().
* Rename config_from_cmdline() to _PyCoreConfig_ReadFromArgv().
* Add more assertions on _PyCoreConfig in _PyCoreConfig_Read().
* Move some functions.
* Make some config functions private.

6 years agobpo-36436: Fix _testcapi.pymem_buffer_overflow() (GH-12560)
Victor Stinner [Tue, 26 Mar 2019 13:35:30 +0000 (14:35 +0100)]
bpo-36436: Fix _testcapi.pymem_buffer_overflow() (GH-12560)

Handle memory allocation failure.

6 years agobpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556)
Inada Naoki [Tue, 26 Mar 2019 09:26:33 +0000 (18:26 +0900)]
bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556)

https://bugs.python.org/issue36433

6 years agoPost v3.8.0a3
Łukasz Langa [Tue, 26 Mar 2019 09:11:11 +0000 (10:11 +0100)]
Post v3.8.0a3

6 years agoMerge tag 'v3.8.0a3'
Łukasz Langa [Tue, 26 Mar 2019 09:08:49 +0000 (10:08 +0100)]
Merge tag 'v3.8.0a3'

Python 3.8.0a3

6 years agobpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)
Zackery Spytz [Tue, 26 Mar 2019 06:05:29 +0000 (00:05 -0600)]
bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551)

6 years agoDocument that logging registers shutdown as an atexit handler (GH-12378)
Andre Delfino [Tue, 26 Mar 2019 05:42:26 +0000 (02:42 -0300)]
Document that logging registers shutdown as an atexit handler (GH-12378)

6 years agoFix "the the" in the idle docs. (GH-12549)
Benjamin Peterson [Tue, 26 Mar 2019 04:46:35 +0000 (21:46 -0700)]
Fix "the the" in the idle docs. (GH-12549)

6 years agobpo-36301: Remove _PyCoreConfig.preconfig (GH-12546)
Victor Stinner [Tue, 26 Mar 2019 01:31:11 +0000 (02:31 +0100)]
bpo-36301: Remove _PyCoreConfig.preconfig (GH-12546)

* Replace _PyCoreConfig.preconfig with 3 new fields in _PyCoreConfig:
  isolated, use_environment, dev_mode.
* Add _PyPreCmdline.dev_mode.
* Add _Py_PreInitializeFromPreConfigInPlace().

6 years agobpo-36301: Add _Py_GetEnv() function (GH-12542)
Victor Stinner [Mon, 25 Mar 2019 23:03:15 +0000 (00:03 +0100)]
bpo-36301: Add _Py_GetEnv() function (GH-12542)

* Make _PyPreConfig_GetEnv(), _PyCoreConfig_GetEnv() and
  _PyCoreConfig_GetEnvDup() private
* _Py_get_env_flag() first parameter becomes "int use_environment"

6 years agobpo-34085: Improve wording on classmethod/staticmethod (#8228)
Andre Delfino [Mon, 25 Mar 2019 22:53:43 +0000 (19:53 -0300)]
bpo-34085: Improve wording on classmethod/staticmethod (#8228)

* bpo-34085: Improve wording on classmethod/staticmethod

* Address comments from Éric

* Address comments from Éric

6 years agobpo-36345: Add a new example in the documentation of wsgiref (#12511)
Stéphane Wirtel [Mon, 25 Mar 2019 22:52:56 +0000 (23:52 +0100)]
bpo-36345: Add a new example in the documentation of wsgiref (#12511)

6 years agobpo-36301: Add _Py_GetConfigsAsDict() function (GH-12540)
Victor Stinner [Mon, 25 Mar 2019 22:19:57 +0000 (23:19 +0100)]
bpo-36301: Add _Py_GetConfigsAsDict() function (GH-12540)

* Add _Py_GetConfigsAsDict() function to get all configurations as a
  dict.
* dump_config() of _testembed.c now dumps preconfig as a separated
  key: call _Py_GetConfigsAsDict().
* Make _PyMainInterpreterConfig_AsDict() private.

6 years agobpo-36143: Regenerate Lib/keyword.py from the Grammar and Tokens file using pgen...
Pablo Galindo [Mon, 25 Mar 2019 22:01:12 +0000 (22:01 +0000)]
bpo-36143: Regenerate Lib/keyword.py from the Grammar and Tokens file using pgen (GH-12456)

Now that the parser generator is written in Python (Parser/pgen) we can make use of it to regenerate the Lib/keyword file that contains the language keywords instead of parsing the autogenerated grammar files. This also allows checking in the CI that the autogenerated files are up to date.

6 years agobpo-36370: Check for PyErr_Occurred() after PyImport_GetModule() (GH-12504)
Stefan Krah [Mon, 25 Mar 2019 20:50:58 +0000 (21:50 +0100)]
bpo-36370: Check for PyErr_Occurred() after PyImport_GetModule() (GH-12504)

6 years agobpo-36326: Let inspect.getdoc() find docstrings for __slots__ (GH-12498)
Raymond Hettinger [Mon, 25 Mar 2019 20:01:13 +0000 (13:01 -0700)]
bpo-36326: Let inspect.getdoc() find docstrings for __slots__ (GH-12498)

6 years agoAdd note to Queue.get() docs about block=True (GH-2223)
Stephen Rosen [Mon, 25 Mar 2019 19:55:20 +0000 (15:55 -0400)]
Add note to Queue.get() docs about block=True (GH-2223)

6 years agov3.8.0a3 v3.8.0a3
Łukasz Langa [Mon, 25 Mar 2019 19:36:40 +0000 (20:36 +0100)]
v3.8.0a3

6 years agobpo-36301: Add _Py_PreInitializeFromConfig() (GH-12536)
Victor Stinner [Mon, 25 Mar 2019 17:37:10 +0000 (18:37 +0100)]
bpo-36301: Add _Py_PreInitializeFromConfig() (GH-12536)

* Initialize _PyPreConfig.dev_mode to -1.
* _PyPreConfig_Read(): coreconfig has the priority over preconfig.
* _PyCoreConfig_Read() now calls _PyPreCmdline_Read() internally.
* config_from_cmdline() now pass _PyPreCmdline to config_read().
* Add _PyPreCmdline_Copy().

6 years agobpo-36301: Cleanup preconfig code (GH-12535)
Victor Stinner [Mon, 25 Mar 2019 16:54:58 +0000 (17:54 +0100)]
bpo-36301: Cleanup preconfig code (GH-12535)

Prepare code to move some _PyPreConfig parameters into _PyPreCmdline.
Changes:

* _PyCoreConfig_ReadFromArgv(): remove preconfig parameter,
  use _PyRuntime.preconfig.
* Add _PyPreCmdline_GetPreConfig() (called by _PyPreConfig_Read()).
* Rename _PyPreCmdline_Init() to _PyPreCmdline_SetArgv()
* Factorize _Py_PreInitializeFromPreConfig() code: add
  pyinit_preinit().
* _PyPreConfig_Read() now sets coerce_c_locale to 2 if it must be
  coerced.
* Remove _PyCoreConfig_ReadPreConfig().
* _PyCoreConfig_Write() now copies updated preconfig into _PyRuntime.

6 years agobpo-35884: Add string-keys-only microbenchmark for dict access to var_access_benchmar...
Stefan Behnel [Mon, 25 Mar 2019 08:20:53 +0000 (09:20 +0100)]
bpo-35884: Add string-keys-only microbenchmark for dict access to var_access_benchmark.py (GH-11905)

6 years agobpo-36421: Fix a possible double decref in _ctypes.c's PyCArrayType_new(). (GH-12530)
Zackery Spytz [Mon, 25 Mar 2019 08:07:47 +0000 (02:07 -0600)]
bpo-36421: Fix a possible double decref in _ctypes.c's PyCArrayType_new(). (GH-12530)

Set type_attr to NULL after the assignment to stgdict->proto (like
what is done with stgdict after the Py_SETREF() call) so that it is
not decrefed twice on error.

6 years agobpo-36218: Fix handling of heterogeneous values in list.sort (GH-12209)
Rémi Lapeyre [Mon, 25 Mar 2019 07:25:37 +0000 (08:25 +0100)]
bpo-36218: Fix handling of heterogeneous values in list.sort (GH-12209)

6 years agoFix line ending (GH-12531)
Raymond Hettinger [Mon, 25 Mar 2019 07:23:39 +0000 (00:23 -0700)]
Fix line ending (GH-12531)

6 years agobpo-36401: Have help() show readonly properties separately (GH-12517)
Raymond Hettinger [Mon, 25 Mar 2019 00:07:47 +0000 (17:07 -0700)]
bpo-36401: Have help() show readonly properties separately (GH-12517)

6 years agobpo-30348: IDLE: Add test_autocomplete unittest (GH-2209)
Louie Lu [Sun, 24 Mar 2019 23:33:12 +0000 (07:33 +0800)]
bpo-30348: IDLE: Add test_autocomplete unittest (GH-2209)

6 years agobpo-31822: Document that urllib.parse.{Defrag,Split,Parse}Result are namedtuples...
Lisa Roach [Sun, 24 Mar 2019 21:28:48 +0000 (14:28 -0700)]
bpo-31822: Document that urllib.parse.{Defrag,Split,Parse}Result are namedtuples (GH-4434)

6 years agobpo-36405: IDLE - Restore __main__ and add tests (#12518)
Terry Jan Reedy [Sun, 24 Mar 2019 21:12:28 +0000 (17:12 -0400)]
bpo-36405: IDLE - Restore __main__ and add tests (#12518)

Fix error in commit 2b75155 noticed by Serhiy Storchaka.

6 years agoReplace "DOS box" with link to Windows FAQ. (GH-12390)
Ned Deily [Sun, 24 Mar 2019 19:03:54 +0000 (15:03 -0400)]
Replace "DOS box" with link to Windows FAQ. (GH-12390)

6 years agobpo-36412: fix a possible crash in dictobject.c's new_dict() (GH-12519)
Zackery Spytz [Sun, 24 Mar 2019 02:23:29 +0000 (20:23 -0600)]
bpo-36412: fix a possible crash in dictobject.c's new_dict() (GH-12519)

6 years agobpo-32217: Correct usage of ABI tags in freeze. (GH-4719)
AraHaan [Sat, 23 Mar 2019 16:29:49 +0000 (12:29 -0400)]
bpo-32217: Correct usage of ABI tags in freeze. (GH-4719)

Check for sys.abiflags before using since not all platforms have it defined.

6 years agobpo-36381: warn when no PY_SSIZE_T_CLEAN defined (GH-12473)
Inada Naoki [Sat, 23 Mar 2019 12:04:40 +0000 (21:04 +0900)]
bpo-36381: warn when no PY_SSIZE_T_CLEAN defined (GH-12473)

We will remove int support from 3.10 or 4.0.

6 years agobpo-23205: IDLE: Add tests and refactor grep's findfiles (GH-12203)
Cheryl Sabella [Sat, 23 Mar 2019 11:33:42 +0000 (07:33 -0400)]
bpo-23205: IDLE: Add tests and refactor grep's findfiles (GH-12203)

* Add tests for grep findfiles.
* Move findfiles to module function.
* Change findfiles to use os.walk.

Based on a patch by Al Sweigart.

6 years agobpo-36301: Add _PyRuntimeState.preconfig (GH-12506)
Victor Stinner [Sat, 23 Mar 2019 11:05:43 +0000 (12:05 +0100)]
bpo-36301: Add _PyRuntimeState.preconfig (GH-12506)

_PyPreConfig_Write() now writes the applied pre-configuration into
_PyRuntimeState.preconfig.

6 years agobpo-36405: Use dict unpacking in idlelib (#12507)
Terry Jan Reedy [Sat, 23 Mar 2019 07:50:15 +0000 (03:50 -0400)]
bpo-36405: Use dict unpacking in idlelib (#12507)

Remove now unneeded imports.

6 years agobpo-33319: Clarify subprocess call docs. (GH-12508)
Gregory P. Smith [Sat, 23 Mar 2019 07:40:28 +0000 (00:40 -0700)]
bpo-33319: Clarify subprocess call docs. (GH-12508)

Clarify capturing or suppressing stdout and stderr on the old call APIs.

Do not state that they are equivalent to run() calls when they are not implemented using run as that was misleading. Unlike run they cannot handle stdout or stderr being set to PIPE without a risk of deadlock.

6 years agoFix typo in doc for pprint.pp (GH-12500)
Xavier GUIHOT [Sat, 23 Mar 2019 01:17:29 +0000 (01:17 +0000)]
Fix typo in doc for pprint.pp (GH-12500)

6 years agobpo-36396: Remove fgBg param of idlelib.config.GetHighlight() (GH-12491)
Terry Jan Reedy [Fri, 22 Mar 2019 22:23:41 +0000 (18:23 -0400)]
bpo-36396: Remove fgBg param of idlelib.config.GetHighlight() (GH-12491)

This param was only used once and changed the return type.

6 years agobpo-36298: Raise ModuleNotFoundError in pyclbr when a module can't be found (GH-12358)
Brett Cannon [Fri, 22 Mar 2019 22:16:50 +0000 (15:16 -0700)]
bpo-36298: Raise ModuleNotFoundError in pyclbr when a module can't be found (GH-12358)

Before, an `AttributeError` was raised due to trying to access an attribute that exists on specs but having received `None` instead for a non-existent module.

https://bugs.python.org/issue36298

6 years agobpo-35155: clarify protocol handler method naming (GH-10313)
Denton Liu [Fri, 22 Mar 2019 21:49:55 +0000 (14:49 -0700)]
bpo-35155: clarify protocol handler method naming (GH-10313)

Clarify that the naming of protocol handler methods shouldn't be literally called "protocol" but should be named after the actual protocol.

https://bugs.python.org/issue35155

6 years agobpo-30670: Add pp function to the pprint module (GH-11769)
Rémi Lapeyre [Fri, 22 Mar 2019 17:22:20 +0000 (18:22 +0100)]
bpo-30670: Add pp function to the pprint module (GH-11769)

6 years agoasyncio: PendingDeprecationWarning -> DeprecationWarning (GH-12494)
Inada Naoki [Fri, 22 Mar 2019 11:07:32 +0000 (20:07 +0900)]
asyncio: PendingDeprecationWarning -> DeprecationWarning (GH-12494)

`Task.current_task()` and `Task.all_tasks()` will be removed in 3.9.

6 years agobpo-21269: Provide args and kwargs attributes on mock call objects GH11807
Kumar Akshay [Fri, 22 Mar 2019 08:10:40 +0000 (13:40 +0530)]
bpo-21269: Provide args and kwargs attributes on mock call objects GH11807

6 years agoRaise the timeout in test_multiprocessing_* for slow buildbots (GH-12489)
Pablo Galindo [Fri, 22 Mar 2019 07:36:56 +0000 (07:36 +0000)]
Raise the timeout in test_multiprocessing_* for slow buildbots (GH-12489)

6 years agobpo-35284: Fix the error handling in the compiler's compiler_call(). (GH-10625)
Zackery Spytz [Fri, 22 Mar 2019 07:30:32 +0000 (01:30 -0600)]
bpo-35284: Fix the error handling in the compiler's compiler_call(). (GH-10625)

compiler_call() needs to check if an error occurred during the
maybe_optimize_method_call() call.

6 years agobpo-36398: Fix a possible crash in structseq_repr(). (GH-12492)
Zackery Spytz [Fri, 22 Mar 2019 07:24:34 +0000 (01:24 -0600)]
bpo-36398: Fix a possible crash in structseq_repr(). (GH-12492)

If the first PyUnicode_DecodeUTF8() call fails in structseq_repr(),
_PyUnicodeWriter_Dealloc() will be called on an uninitialized
_PyUnicodeWriter.

6 years agobpo-36256: Fix bug in parsermodule when parsing if statements (GH-12477)
Pablo Galindo [Thu, 21 Mar 2019 23:33:02 +0000 (23:33 +0000)]
bpo-36256: Fix bug in parsermodule when parsing if statements (GH-12477)

bpo-36256: Fix bug in parsermodule when parsing if statements

In the parser module, when validating nodes before starting the parsing with to create a ST in "parser_newstobject" there is a problem that appears when two arcs in the same DFA state has transitions with labels with the same type. For example, the DFA for if_stmt has a state with
two labels with the same type: "elif" and "else" (type NAME). The algorithm tries one by one the arcs until the label that starts the arc transition has a label with the same type of the current child label we are trying to accept. In this case, the arc for "elif" comes before the arc for "else"and passes this test (because the current child label is "else" and has the same type as "elif"). This lead to expecting a namedexpr_test (305) instead of a colon (11). The solution is to compare also the string representation (in case there is one) of the labels to see if the transition that we have is the correct one.

6 years agoFix registry key for Windows SDK detection (GH-12445)
Isuru Fernando [Thu, 21 Mar 2019 17:52:57 +0000 (12:52 -0500)]
Fix registry key for Windows SDK detection (GH-12445)

6 years agobpo-35978: Correctly skips venv tests in venvs (GH-12220)
Steve Dower [Thu, 21 Mar 2019 17:04:21 +0000 (10:04 -0700)]
bpo-35978: Correctly skips venv tests in venvs (GH-12220)

Also fixes venvs from the build directory on Windows.

6 years agobpo-36245: Avoid problems when building in a directory containing spaces. (GH-12241)
Jess [Thu, 21 Mar 2019 16:02:59 +0000 (09:02 -0700)]
bpo-36245: Avoid problems when building in a directory containing spaces. (GH-12241)

6 years agoFix table formatting in itertools doc (GH-12228)
Benedikt Werner [Thu, 21 Mar 2019 15:28:49 +0000 (16:28 +0100)]
Fix table formatting in itertools doc (GH-12228)

6 years agobpo-36268: Change default tar format to pax from GNU. (GH-12355)
CAM Gerlach [Thu, 21 Mar 2019 14:44:51 +0000 (09:44 -0500)]
bpo-36268: Change default tar format to pax from GNU. (GH-12355)

6 years agobpo-36385: Add ``elif`` sentence on to avoid multiple ``if`` (GH-12478)
Emmanuel Arias [Thu, 21 Mar 2019 04:39:17 +0000 (01:39 -0300)]
bpo-36385: Add ``elif`` sentence on to avoid multiple ``if`` (GH-12478)

Currently, when arguments on Parser/asdl_c.py are parsed
``ìf`` sentence is used. This PR Propose to use ``elif``
to avoid multiple evaluting of the ifs.

https://bugs.python.org/issue36385

6 years agobpo-36324: NormalDist() add more tests and update comments (GH-12476)
Raymond Hettinger [Wed, 20 Mar 2019 20:28:59 +0000 (13:28 -0700)]
bpo-36324: NormalDist() add more tests and update comments (GH-12476)

* Improve coverage.
* Note inherent limitations of the accuracy tests

https://bugs.python.org/issue36324

6 years agobpo-36285: Fix integer overflow in the array module. (GH-12317)
sth [Wed, 20 Mar 2019 19:49:39 +0000 (20:49 +0100)]
bpo-36285: Fix integer overflow in the array module. (GH-12317)

6 years agobpo-36312: Fix decoders for some code pages. (GH-12369)
Serhiy Storchaka [Wed, 20 Mar 2019 19:45:18 +0000 (21:45 +0200)]
bpo-36312: Fix decoders for some code pages. (GH-12369)

6 years agobpo-8677: use PY_DWORD_MAX instead of INT_MAX (GH-12469)
Inada Naoki [Wed, 20 Mar 2019 11:53:08 +0000 (20:53 +0900)]
bpo-8677: use PY_DWORD_MAX instead of INT_MAX (GH-12469)

6 years agobpo-8677: use PY_SSIZE_T_CLEAN in PC/winreg.c (GH-12466)
Inada Naoki [Wed, 20 Mar 2019 10:10:17 +0000 (19:10 +0900)]
bpo-8677: use PY_SSIZE_T_CLEAN in PC/winreg.c (GH-12466)

6 years agobpo-8677: use PY_SSIZE_T_CLEAN in socketmodule.c (GH-12467)
Inada Naoki [Wed, 20 Mar 2019 10:02:46 +0000 (19:02 +0900)]
bpo-8677: use PY_SSIZE_T_CLEAN in socketmodule.c (GH-12467)

6 years agobpo-8677: use PY_SSIZE_T_CLEAN in Modules/_gdbmodule.c (GH-12464)
Inada Naoki [Wed, 20 Mar 2019 10:01:55 +0000 (19:01 +0900)]
bpo-8677: use PY_SSIZE_T_CLEAN in Modules/_gdbmodule.c (GH-12464)

6 years agobpo-36374: Fix a possible null pointer dereference (GH-12449)
Zackery Spytz [Wed, 20 Mar 2019 09:16:25 +0000 (03:16 -0600)]
bpo-36374: Fix a possible null pointer dereference (GH-12449)

https://bugs.python.org/issue36374

6 years agobpo-36301: Add _PyPreCmdline internal API (GH-12458)
Victor Stinner [Wed, 20 Mar 2019 03:25:38 +0000 (04:25 +0100)]
bpo-36301: Add _PyPreCmdline internal API (GH-12458)

_PyCoreConfig_ReadFromArgv() now reuses the code parsing command line
options from preconfig.c.

6 years agobpo-23984: Improve descriptor documentation (GH-1034)
Shubham Aggarwal [Wed, 20 Mar 2019 02:55:55 +0000 (08:25 +0530)]
bpo-23984: Improve descriptor documentation (GH-1034)

https://bugs.python.org/issue23984

6 years agobpo-36356: Fix _PyCoreConfig_Read() (GH-12454)
Victor Stinner [Wed, 20 Mar 2019 02:11:38 +0000 (03:11 +0100)]
bpo-36356: Fix _PyCoreConfig_Read() (GH-12454)

Don't override parameters which are already set by the user.

6 years agobpo-36301: Add _PyRuntime.pre_initialized (GH-12457)
Victor Stinner [Wed, 20 Mar 2019 01:20:13 +0000 (02:20 +0100)]
bpo-36301: Add _PyRuntime.pre_initialized (GH-12457)

* Add _PyRuntime.pre_initialized: set to 1 when Python
  is pre-initialized
* Add _Py_PreInitialize() and _Py_PreInitializeFromPreConfig().
* _PyCoreConfig_Read() now calls  _Py_PreInitialize().
* Move _PyPreConfig_GetGlobalConfig() and
  _PyCoreConfig_GetGlobalConfig() calls from main.c to preconfig.c
  and coreconfig.c.

6 years agobpo-36362: Avoid unused variables when HAVE_DYNAMIC_LOADING is not defined (GH-12430)
Stéphane Wirtel [Tue, 19 Mar 2019 23:37:20 +0000 (00:37 +0100)]
bpo-36362: Avoid unused variables when HAVE_DYNAMIC_LOADING is not defined (GH-12430)

https://bugs.python.org/issue36362

6 years agobpo-36365: Rewrite structseq_repr() using _PyUnicodeWriter (GH-12440)
Victor Stinner [Tue, 19 Mar 2019 23:05:51 +0000 (00:05 +0100)]
bpo-36365: Rewrite structseq_repr() using _PyUnicodeWriter (GH-12440)

No longer limit repr(structseq) to 512 bytes. Use _PyUnicodeWriter
for better performance and to write directly Unicode rather than
encoding repr() value to UTF-8 and then decoding from UTF-8.

6 years agobpo-35388: Fix _PyRuntime_Finalize() (GH-12443)
Victor Stinner [Tue, 19 Mar 2019 23:03:01 +0000 (00:03 +0100)]
bpo-35388: Fix _PyRuntime_Finalize() (GH-12443)

Calling _PyRuntime_Initialize() after _PyRuntime_Finalize() now re-initializes
_PyRuntime structure. Previously, _PyRuntime_Initialize() did
nothing in that case.

6 years agobpo-36324: Improved code formatting for the NormalDist.inv_cdf rational approximation...
Raymond Hettinger [Tue, 19 Mar 2019 21:29:13 +0000 (14:29 -0700)]
bpo-36324: Improved code formatting for the NormalDist.inv_cdf rational approximation (GH-12448)

https://bugs.python.org/issue36324

6 years agoNormalDist.inv_cdf(): In-line constants because the variable names were not informati...
Raymond Hettinger [Tue, 19 Mar 2019 19:48:04 +0000 (12:48 -0700)]
NormalDist.inv_cdf(): In-line constants because the variable names were not informative (GH-12446)

6 years agobpo-36236: Fix _PyPathConfig_ComputeSysPath0() for empty argv (GH-12441)
Victor Stinner [Tue, 19 Mar 2019 17:22:55 +0000 (18:22 +0100)]
bpo-36236: Fix _PyPathConfig_ComputeSysPath0() for empty argv (GH-12441)

* _PyPathConfig_ComputeSysPath0() now returns 0 if argv is empty.
* Cleanup also _PyPathConfig_ComputeSysPath0() code: move variables
  definitions closer to where they are used.

6 years agobpo-36367: Free buffer if realloc fails in tokenize.c (GH-12442)
Pablo Galindo [Tue, 19 Mar 2019 17:17:58 +0000 (17:17 +0000)]
bpo-36367: Free buffer if realloc fails in tokenize.c (GH-12442)

6 years agobpo-36236: Handle removed cwd at Python init (GH-12424)
Victor Stinner [Tue, 19 Mar 2019 15:09:27 +0000 (16:09 +0100)]
bpo-36236: Handle removed cwd at Python init (GH-12424)

At Python initialization, the current directory is no longer
prepended to sys.path if it has been removed.

Rename _PyPathConfig_ComputeArgv0() to
_PyPathConfig_ComputeSysPath0() to avoid confusion between argv[0]
and sys.path[0].

6 years agobpo-36356: pymain_free() calls _PyRuntime_Finalize() (GH-12435)
Victor Stinner [Tue, 19 Mar 2019 13:53:58 +0000 (14:53 +0100)]
bpo-36356: pymain_free() calls _PyRuntime_Finalize() (GH-12435)

Ensure that _PyRuntime_Finalize() is always call. This change fix a
few memory leaks when running "python3 -V".

6 years agobpo-36356: Release Unicode interned strings on Valgrind (#12431)
Victor Stinner [Tue, 19 Mar 2019 13:20:29 +0000 (14:20 +0100)]
bpo-36356: Release Unicode interned strings on Valgrind (#12431)

When Python is compiled with Valgrind support, release Unicode
interned strings at exit in _PyUnicode_Fini().

* Rename _Py_ReleaseInternedUnicodeStrings() to
  unicode_release_interned() and make it private.
* unicode_release_interned() is now called from _PyUnicode_Fini():
  it must be called with a running Python thread state for TRASHCAN,
  it cannot be called from pymain_free().
* Don't display statistics on interned strings at exit anymore

6 years agobpo-36333, bpo-36356: Fix _PyEval_FiniThreads() (GH-12432)
Victor Stinner [Tue, 19 Mar 2019 13:19:38 +0000 (14:19 +0100)]
bpo-36333, bpo-36356: Fix _PyEval_FiniThreads() (GH-12432)

_PyEval_FiniThreads() now free the pending lock.

6 years agobpo-8677: use PY_SSIZE_T_CLEAN in sqlite (GH-12434)
Inada Naoki [Tue, 19 Mar 2019 13:10:18 +0000 (22:10 +0900)]
bpo-8677: use PY_SSIZE_T_CLEAN in sqlite (GH-12434)

Modules/_sqlite/cursor.c uses "y#" format.
It didn't declare PY_SSIZE_T_CLEAN, but the argument is Py_ssize_t already.

6 years agobpo-36333: Fix leak _PyRuntimeState_Fini (GH-12400)
Stéphane Wirtel [Tue, 19 Mar 2019 10:51:32 +0000 (11:51 +0100)]
bpo-36333: Fix leak _PyRuntimeState_Fini (GH-12400)

6 years agobpo-36356: Fix memory leak in _PyPreConfig_Read() (GH-12425)
btharper [Tue, 19 Mar 2019 10:50:25 +0000 (06:50 -0400)]
bpo-36356: Fix memory leak in _PyPreConfig_Read() (GH-12425)

_PyPreConfig_Read() now free 'old_old' at exit.

6 years agoAdd docstrings to the arithmetic methods in NormalDist() (GH-12426)
Raymond Hettinger [Tue, 19 Mar 2019 05:24:15 +0000 (22:24 -0700)]
Add docstrings to the arithmetic methods in NormalDist() (GH-12426)

6 years agobpo-36324: Add inv_cdf() to statistics.NormalDist() (GH-12377)
Raymond Hettinger [Tue, 19 Mar 2019 03:17:14 +0000 (20:17 -0700)]
bpo-36324: Add inv_cdf() to statistics.NormalDist() (GH-12377)

6 years agobpo-36352: Avoid hardcoded MAXPATHLEN size in getpath.c (GH-12423)
Victor Stinner [Tue, 19 Mar 2019 01:58:14 +0000 (02:58 +0100)]
bpo-36352: Avoid hardcoded MAXPATHLEN size in getpath.c (GH-12423)

* Use Py_ARRAY_LENGTH() rather than hardcoded MAXPATHLEN in getpath.c.
* Pass string length to functions modifying strings.

6 years agobpo-36301: Error if decoding pybuilddir.txt fails (GH-12422)
Victor Stinner [Tue, 19 Mar 2019 00:46:25 +0000 (01:46 +0100)]
bpo-36301: Error if decoding pybuilddir.txt fails (GH-12422)

Python initialization now fails if decoding pybuilddir.txt
configuration file fails at startup.

_PyPathConfig_Calculate() now reports memory allocation failure and
decoding error on decoding pybuilddir.txt content from
UTF-8/surrogateescape.

6 years agobpo-36352: Add error handling to getpath.c (GH-12421)
Victor Stinner [Mon, 18 Mar 2019 22:54:59 +0000 (23:54 +0100)]
bpo-36352: Add error handling to getpath.c (GH-12421)

Replace Py_FatalError() with _PyInitError to let the caller handle
the fatal error.

6 years agobpo-36301: Fix Py_Main() memory leaks (GH-12420)
Victor Stinner [Mon, 18 Mar 2019 21:24:28 +0000 (22:24 +0100)]
bpo-36301: Fix Py_Main() memory leaks (GH-12420)

bpo-36301, bpo-36333:

* Fix memory allocator used by _PyPathConfig_ClearGlobal():
  force the default allocator.
* _PyPreConfig_ReadFromArgv(): free init_ctype_locale memory.
* pymain_main(): call pymain_free() on init error

Co-Authored-By: Stéphane Wirtel <stephane@wirtel.be>
6 years agobpo-36292: Mark unreachable code as such in long bitwise ops (GH-12333)
stratakis [Mon, 18 Mar 2019 17:59:20 +0000 (18:59 +0100)]
bpo-36292:  Mark unreachable code as such in long bitwise ops (GH-12333)

6 years agobpo-36320: Switch typing.NamedTuple from OrderedDict to regular dict (GH-12396)
Raymond Hettinger [Mon, 18 Mar 2019 16:53:56 +0000 (09:53 -0700)]
bpo-36320: Switch typing.NamedTuple from OrderedDict to regular dict (GH-12396)

Also,  deprecate the *_field_types* attributes which duplicated the information in *\__annotations__*.

https://bugs.python.org/issue36320

6 years agobpo-36352: Clarify fileutils.h documentation (GH-12406)
Victor Stinner [Mon, 18 Mar 2019 16:47:26 +0000 (17:47 +0100)]
bpo-36352: Clarify fileutils.h documentation (GH-12406)

The last parameter of _Py_wreadlink(), _Py_wrealpath() and
_Py_wgetcwd() is a length, not a size: number of characters including
the trailing NUL character.

Enhance also documentation of error conditions.

6 years agobpo-36235: Enhance distutils test_customize_compiler() (GH-12403)
Victor Stinner [Mon, 18 Mar 2019 16:19:02 +0000 (17:19 +0100)]
bpo-36235: Enhance distutils test_customize_compiler() (GH-12403)

The test test_customize_compiler() now mocks all sysconfig variables
and all environment variables used by customize_compiler().

6 years agobpo-36328: Fix compiler warning in Py_NewInterpreter() (GH-12381)
Stéphane Wirtel [Mon, 18 Mar 2019 16:10:29 +0000 (17:10 +0100)]
bpo-36328: Fix compiler warning in Py_NewInterpreter() (GH-12381)

6 years agobpo-36332: Allow compile() to handle AST objects with assignment expressions (GH...
Pablo Galindo [Mon, 18 Mar 2019 13:51:53 +0000 (13:51 +0000)]
bpo-36332: Allow compile() to handle AST objects with assignment expressions (GH-12398)

6 years agobpo-30040: optimize inserting into empty dict (GH-12307)
Inada Naoki [Mon, 18 Mar 2019 11:38:33 +0000 (20:38 +0900)]
bpo-30040: optimize inserting into empty dict (GH-12307)

6 years agobpo-36329: Declare the version of Python to use for Tools/scripts/serve.py (#12385)
Stéphane Wirtel [Mon, 18 Mar 2019 10:47:55 +0000 (11:47 +0100)]
bpo-36329: Declare the version of Python to use for Tools/scripts/serve.py (#12385)

* bpo-36329: Declare the version of Python to use for Tools/scripts/serve.py

* Add the blurb entry

6 years agobpo-36307: Travis: upgrade to Xenial environment (GH-12356)
CAM Gerlach [Mon, 18 Mar 2019 10:44:58 +0000 (05:44 -0500)]
bpo-36307: Travis: upgrade to Xenial environment (GH-12356)