Commit Graph

103572 Commits

Author SHA1 Message Date
Inada Naoki d5f18a63cc
bpo-8677: use PY_SSIZE_T_CLEAN in PC/winreg.c (GH-12466) 2019-03-20 19:10:17 +09:00
Inada Naoki e9a1dcb423
bpo-8677: use PY_SSIZE_T_CLEAN in socketmodule.c (GH-12467) 2019-03-20 19:02:46 +09:00
Inada Naoki c5a216e0b9
bpo-8677: use PY_SSIZE_T_CLEAN in Modules/_gdbmodule.c (GH-12464) 2019-03-20 19:01:55 +09:00
Zackery Spytz 9b4a1b1e23 bpo-36374: Fix a possible null pointer dereference (GH-12449)
https://bugs.python.org/issue36374
2019-03-20 02:16:25 -07:00
Victor Stinner fa15376848
bpo-36301: Add _PyPreCmdline internal API (GH-12458)
_PyCoreConfig_ReadFromArgv() now reuses the code parsing command line
options from preconfig.c.
2019-03-20 04:25:38 +01:00
Shubham Aggarwal abbdd1fc5c bpo-23984: Improve descriptor documentation (GH-1034)
https://bugs.python.org/issue23984
2019-03-19 19:55:55 -07:00
Victor Stinner 4a1468e593
bpo-36356: Fix _PyCoreConfig_Read() (GH-12454)
Don't override parameters which are already set by the user.
2019-03-20 03:11:38 +01:00
Victor Stinner f29084d611
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.
2019-03-20 02:20:13 +01:00
Stéphane Wirtel 0d765e3849 bpo-36362: Avoid unused variables when HAVE_DYNAMIC_LOADING is not defined (GH-12430)
https://bugs.python.org/issue36362
2019-03-19 16:37:20 -07:00
Victor Stinner c70ab02df2
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.
2019-03-20 00:05:51 +01:00
Victor Stinner fd23cfa464
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.
2019-03-20 00:03:01 +01:00
Raymond Hettinger fe13883f01 bpo-36324: Improved code formatting for the NormalDist.inv_cdf rational approximation (GH-12448)
https://bugs.python.org/issue36324
2019-03-19 14:29:13 -07:00
Raymond Hettinger 52a594bd0d NormalDist.inv_cdf(): In-line constants because the variable names were not informative (GH-12446) 2019-03-19 12:48:04 -07:00
Victor Stinner fc96e5474a
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.
2019-03-19 18:22:55 +01:00
Pablo Galindo cb90c89de1
bpo-36367: Free buffer if realloc fails in tokenize.c (GH-12442) 2019-03-19 17:17:58 +00:00
Victor Stinner dcf617152e
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].
2019-03-19 16:09:27 +01:00
Victor Stinner f5f336a819
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".
2019-03-19 14:53:58 +01:00
Victor Stinner fecc4f2b47
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
2019-03-19 14:20:29 +01:00
Victor Stinner a712679a2b
bpo-36333, bpo-36356: Fix _PyEval_FiniThreads() (GH-12432)
_PyEval_FiniThreads() now free the pending lock.
2019-03-19 14:19:38 +01:00
Inada Naoki 29198ea1c6
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.
2019-03-19 22:10:18 +09:00
Stéphane Wirtel 943395fab9 bpo-36333: Fix leak _PyRuntimeState_Fini (GH-12400) 2019-03-19 11:51:32 +01:00
btharper e130a07eb2 bpo-36356: Fix memory leak in _PyPreConfig_Read() (GH-12425)
_PyPreConfig_Read() now free 'old_old' at exit.
2019-03-19 11:50:25 +01:00
Raymond Hettinger 5f1e8b4d24 Add docstrings to the arithmetic methods in NormalDist() (GH-12426) 2019-03-18 22:24:15 -07:00
Raymond Hettinger 714c60d7ac
bpo-36324: Add inv_cdf() to statistics.NormalDist() (GH-12377) 2019-03-18 20:17:14 -07:00
Victor Stinner faddaedd05
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.
2019-03-19 02:58:14 +01:00
Victor Stinner 5f9cf23502
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.
2019-03-19 01:46:25 +01:00
Victor Stinner 7b14f0c02c
bpo-36352: Add error handling to getpath.c (GH-12421)
Replace Py_FatalError() with _PyInitError to let the caller handle
the fatal error.
2019-03-18 23:54:59 +01:00
Victor Stinner c183444f7e
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>
2019-03-18 22:24:28 +01:00
stratakis a10d426bab bpo-36292: Mark unreachable code as such in long bitwise ops (GH-12333) 2019-03-18 18:59:20 +01:00
Raymond Hettinger f7b57df0c0 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
2019-03-18 09:53:56 -07:00
Victor Stinner 1be0d1135f
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.
2019-03-18 17:47:26 +01:00
Victor Stinner 72c7b372cf
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().
2019-03-18 17:19:02 +01:00
Stéphane Wirtel 9e06d2b865 bpo-36328: Fix compiler warning in Py_NewInterpreter() (GH-12381) 2019-03-18 17:10:29 +01:00
Pablo Galindo 0c9258a6d2
bpo-36332: Allow compile() to handle AST objects with assignment expressions (GH-12398) 2019-03-18 13:51:53 +00:00
Inada Naoki 2ddc7f6d62
bpo-30040: optimize inserting into empty dict (GH-12307) 2019-03-18 20:38:33 +09:00
Stéphane Wirtel 09a9f1799c 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
2019-03-18 11:47:55 +01:00
CAM Gerlach 74ae50e53e bpo-36307: Travis: upgrade to Xenial environment (GH-12356) 2019-03-18 19:44:58 +09:00
Rémi Lapeyre b4b97af8be Fix typo in _PyObject_FastCallDict documentation (GH-12383) 2019-03-18 11:07:53 +01:00
Raymond Hettinger 23581c018f
bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375) 2019-03-18 00:27:39 -07:00
Inada Naoki 6a16b18224
bpo-36297: remove "unicode_internal" codec (GH-12342) 2019-03-18 15:44:11 +09:00
Harmon 6fb544d8bc Fix "catchs" typos in NEWS entries (GH-12364) 2019-03-17 16:48:21 -07:00
Joan Massich dc69f69f14 Fix typo in unittest.mock documentation: manger -> manager (GH-12352) 2019-03-17 16:34:22 -07:00
Fantix King f683f46425 bpo-34745: Fix asyncio sslproto memory issues (GH-12386)
* Fix handshake timeout leak in asyncio/sslproto

Refs MagicStack/uvloop#222

* Break circular ref _SSLPipe <-> SSLProtocol

* bpo-34745: Fix asyncio ssl memory leak

* Break circular ref SSLProtocol <-> UserProtocol

* Add NEWS entry
2019-03-17 18:51:10 -04:00
Diego Rojas 06e1e68822 bpo-34160: Update news entry for XML order attributes (#12335) 2019-03-16 16:44:56 -07:00
Cheryl Sabella 0bb5e75cf8
bpo-23216: IDLE: Add docstrings to search modules (GH-12141) 2019-03-16 19:29:33 -04:00
Pablo Galindo 7c994549dc
bpo-35493: Use Process.sentinel instead of sleeping for polling worker status in multiprocessing.Pool (#11488)
* bpo-35493: Use Process.sentinel instead of sleeping for polling worker status in multiprocessing.Pool

* Use self-pipe pattern to avoid polling for changes

* Refactor some variable names and add comments

* Restore timeout and poll

* Use reader object only on wait()

* Recompute worker sentinels every time

* Remove timeout and use change notifier

* Refactor some methods to be overloaded by the ThreadPool, document the cache class and fix typos
2019-03-16 22:34:24 +00:00
Dave Chevell 962bdeab19 bpo-35715: Liberate return value of _process_worker (GH-11514)
ProcessPoolExecutor workers will hold the return value of their last task in memory until the next task is received. Since the return value has already been propagated to the parent process's Future (or has been discarded by this point), the object can be safely released.
2019-03-16 22:28:51 +00:00
Raymond Hettinger 9c68543f02 Update the seealso entries for namedtuple() (GH-12373)
* Replace external recipe link with a link to the dataclasses module.

* Highlight the class definition syntax for typing.NamedTuple
  and add an example for clarity.
2019-03-16 12:53:23 -07:00
Raymond Hettinger 5927cfdf3a Minor grammar fix in docs (GH-12371) 2019-03-16 11:16:29 -07:00
Serhiy Storchaka 1b0393d5b7
bpo-36127: Fix compiler warning in _PyArg_UnpackKeywords(). (GH-12353) 2019-03-16 19:45:00 +02:00