Commit Graph

103478 Commits

Author SHA1 Message Date
Pablo Galindo 0411411c6b
Rework integer overflow path in math.prod and add more tests (GH-11809)
The overflow check was relying on undefined behaviour as it was using the result of the multiplication to do the check, and once the overflow has already happened, any operation on the result is undefined behaviour.

Some extra checks that exercise code paths related to this are also added.
2019-03-09 19:18:08 +00:00
Carl Bordum Hansen 62fa51f121 Fix typos and improve grammar in threading.Barrier docstrings (GH-12210) 2019-03-09 09:38:05 -08:00
tyomitch 1b304f992d Remove d_initial from the parser as it is unused (GH-12212)
d_initial, the first state of a particular DFA in the parser has always been initialized to 0 in the old pgen as well as the new pgen. As this value is not used and the first state of each DFA is assumed to be the first element in the array representing it, remove d_initial from the parser to reduce complexity.
2019-03-09 15:35:50 +00:00
Raymond Hettinger d70a359adf Make a documentation link target more specific (GH-12249) 2019-03-09 00:42:23 -08:00
Eric Snow 8479a3426e
bpo-33608: Make sure locks in the runtime are properly re-created. (gh-12245) 2019-03-08 23:44:33 -07:00
Eric Snow 5be45a6105
bpo-33608: Minor cleanup related to pending calls. (gh-12247) 2019-03-08 22:47:07 -07:00
Eric Snow 7bda9de550
Simplify DISPATCH by hoisting eval_breaker ahead of time. (gh-12243) 2019-03-08 17:25:54 -07:00
Cheryl Sabella d5a70c6b03
bpo-35661: Store the venv prompt in pyvenv.cfg (GH-11440) 2019-03-08 17:01:27 -05:00
Eric Snow 2aab5d310c
Fix the Py_atomic_* macros. (#12240)
The macros were working only because our usage happened to parse correctly.  Changing that usage (e.g. with pointers) would break the macros.  This fixes that.
2019-03-08 12:06:56 -07:00
Anthony Sottile ab9b31f947 bpo-35843: Implement __getitem__ for _NamespacePath (GH-11690) 2019-03-08 10:58:00 -08:00
Terry Jan Reedy 8a1bab9291
bpo-34162: Add entries for idlelib/NEWS.txt (#12232) 2019-03-08 03:04:32 -05:00
Benedikt Werner f2320b37d9 Fix typo (double 'the') in CODEOWNERS (GH-12227) 2019-03-07 17:09:40 -08:00
Guido van Rossum 495da29225 bpo-35975: Support parsing earlier minor versions of Python 3 (GH-12086)
This adds a `feature_version` flag to `ast.parse()` (documented) and `compile()` (hidden) that allow tweaking the parser to support older versions of the grammar. In particular if `feature_version` is 5 or 6, the hacks for the `async` and `await` keyword from PEP 492 are reinstated. (For 7 or higher, these are unconditionally treated as keywords, but they are still special tokens rather than `NAME` tokens that the parser driver recognizes.)



https://bugs.python.org/issue35975
2019-03-07 12:38:08 -08:00
Zackery Spytz bf94cc7b49 bpo-36140: Fix an incorrect check in msidb_getsummaryinformation() (GH-12074) 2019-03-07 10:20:13 -08:00
Steve Dower 2f8f56499c
bpo-36108: Avoid failing the build on race condition in clean (GH-12217) 2019-03-07 09:09:15 -08:00
Raymond Hettinger 14bab7abee NormalDist.overlap() only needs one example (GH-12218) 2019-03-07 08:54:31 -08:00
Steve Dower 16e6f7dee7
bpo-36216: Add check for characters in netloc that normalize to separators (GH-12201) 2019-03-07 08:02:26 -08:00
Raymond Hettinger 1f58f4fa6a Refine statistics.NormalDist documentation and improve test coverage (GH-12208) 2019-03-06 23:23:55 -08:00
Raymond Hettinger 318d537daa
bpo-36169 : Add overlap() method to statistics.NormalDist (GH-12149) 2019-03-06 22:59:40 -08:00
Andre Delfino e942e7b5c9 Fix the documentation for set.copy() (GH-12176)
Remove 's' mention as there's no argument.
2019-03-07 07:23:21 +02:00
Emmanuel Arias ecc161d120 bpo-36185: Fix typo in Doc/c-api/objbuffer.rst. (GH-12204) 2019-03-07 07:16:41 +02:00
Davide Rizzo dc078947a5 bpo-36139: Fix mmap_object_dealloc(): hold the GIL to call PyMem_Free() (GH-12199) 2019-03-06 18:08:31 +01:00
Jeremy Kloth edad38e3e0 bpo-9566: Fix compiler warnings in gcmodule.c (GH-11010)
Change PyDTrace_GC_DONE() argument type from int to Py_ssize_t.
2019-03-06 17:54:12 +01:00
Davide Rizzo bb9593af0a closes bpo-36139: release GIL around munmap(). (GH-12073) 2019-03-06 07:52:34 -08:00
Emmanuel Arias b71e28ea91 bpo-36209: Fix typo on hashlib error message (GH-12194) 2019-03-06 15:35:35 +01:00
Victor Stinner 25d13f37aa
bpo-36142: PYTHONMALLOC overrides PYTHONDEV (GH-12191)
bpo-34247, bpo-36142: The PYTHONMALLOC environment variable has the
priority over PYTHONDEV env var and "-X dev" command line option.
For example, PYTHONMALLOC=malloc PYTHONDEVMODE=1 sets the memory
allocators to "malloc" (and not to "debug").

Add an unit test.
2019-03-06 12:51:53 +01:00
Pradyun Gedam 01e0f439f5 bpo-35807: Upgrade ensurepip bundled pip and setuptools (GH-12189)
* Update pip to 19.0.3
* Update setuptools to 40.8.0
2019-03-06 06:42:21 -05:00
Raymond Hettinger 18ee50d5da Add more tests for pdf() and cdf() (GH-12190) 2019-03-06 02:31:14 -08:00
Victor Stinner 4fffd380a4
bpo-36142: _PyPreConfig_Read() sets LC_CTYPE (GH-12188)
* _PyPreConfig_Read() now sets temporarily LC_CTYPE to the user
  preferred locale, as _PyPreConfig_Write() will do permanentely.
* Fix _PyCoreConfig_Clear(): clear run_xxx attributes
* _Py_SetArgcArgv() doesn't have to be exported
* _PyCoreConfig_SetGlobalConfig() no longer applies preconfig
2019-03-06 01:44:31 +01:00
Victor Stinner c656e25667
bpo-36142: Add _PyPreConfig_SetAllocator() (GH-12187)
* _PyPreConfig_Write() now reallocates the pre-configuration with the
  new memory allocator.
* It is no longer needed to force the "default raw memory allocator"
  to clear pre-configuration and core configuration. Simplify the
  code.
* _PyPreConfig_Write() now does nothing if called after
  Py_Initialize(): no longer check if the allocator is the same.
* Remove _PyMem_GetDebugAllocatorsName(): dev mode sets again
  allocator to "debug".
2019-03-06 01:13:43 +01:00
Victor Stinner 7d2ef3ef50
bpo-36142: _PyPreConfig_Write() sets the allocator (GH-12186)
* _PyPreConfig_Write() now sets the memory allocator.
* _PyPreConfig_Write() gets a return type: _PyInitError.
* _Py_InitializeCore() now reads and writes the pre-configuration
  (set the memory allocator, configure the locale) before reading and
  writing the core configuration.
2019-03-06 00:36:56 +01:00
Victor Stinner a9df651eb4
bpo-36142: Add _PyMem_GetDebugAllocatorsName() (GH-12185)
The development mode now uses the effective name of the debug memory
allocator ("pymalloc_debug" or "malloc_debug"). So the name doesn't
change after setting the memory allocator.
2019-03-05 23:31:54 +01:00
Serhiy Storchaka d8b3a98c90
bpo-36187: Remove NamedStore. (GH-12167)
NamedStore has been replaced with Store. The difference between
NamedStore and Store is handled when precess the NamedExpr node
one level upper.
2019-03-05 20:42:06 +02:00
Serhiy Storchaka adfffc7343
Fix the C function signature for _collections._tuplegetter.__reduce__. (GH-12180)
Correctly fixes bpo-36197.
2019-03-05 18:41:09 +02:00
Victor Stinner b35be4b333
bpo-36142: Add _PyPreConfig.allocator (GH-12181)
* Move 'allocator' and 'dev_mode' fields from _PyCoreConfig
  to _PyPreConfig.
* Fix InitConfigTests of test_embed: dev_mode sets allocator to
  "debug", add a new tests for env vars with dev mode enabled.
2019-03-05 17:37:44 +01:00
Stéphane Wirtel 359a2f3dab bpo-33012: Fix compilation warnings in memoryobject.c and _collectionsmodule.c (GH-12179)
Cast function pointers to (void(*)(void)) before casting to (PyCFunction)
to make "warning: cast between incompatible function types" false alarm quiet.
2019-03-05 16:10:53 +01:00
Victor Stinner 5a02e0d1c8
bpo-36142: Add _PyPreConfig.utf8_mode (GH-12174)
* Move following fields from _PyCoreConfig to _PyPreConfig:

  * coerce_c_locale
  * coerce_c_locale_warn
  * legacy_windows_stdio
  * utf8_mode

* _PyPreConfig_ReadFromArgv() is now responsible to choose the
  filesystem encoding
* _PyPreConfig_Write() now sets the LC_CTYPE locale
2019-03-05 12:32:09 +01:00
Serhiy Storchaka 5b10b98247
bpo-22831: Use "with" to avoid possible fd leaks in tests (part 2). (GH-10929) 2019-03-05 10:06:26 +02:00
Serhiy Storchaka 9e4861f523
bpo-22831: Use "with" to avoid possible fd leaks in tests (part 1). (GH-10928) 2019-03-05 10:05:57 +02:00
Martijn Pieters b727239575 closes bpo-36188: Clean up 'unbound' method left-overs. (GH-12169)
Methods are always bound, and `__self__` can no longer be `NULL`
(`method_new()` and `PyMethod_New()` both explicitly check for this).

Moreover, once a bound method is bound, it *stays* bound and won't be re-bound
to something else, so the section in the datamodel that talks about accessing
an methods in a different descriptor-binding context doesn't apply any more in
Python 3.
2019-03-04 21:19:34 -08:00
NAKAMURA Osamu 0983fcd0d5 Doc: Use `option` word for command line interface. (GH-12142)
For command line option, `option` is better than `parameter`.
2019-03-04 20:43:43 -08:00
Victor Stinner 6dcb54228e
bpo-36142: Add _PyPreConfig_ReadFromArgv() (GH-12173)
The new function is now responsible to parse -E and -I command line
arguments.
2019-03-05 02:44:12 +01:00
Victor Stinner cad1f747da
bpo-36142: Add _PyPreConfig structure (GH-12172)
* Add _PyPreConfig structure
* Move 'ignored' and 'use_environment' fields from _PyCoreConfig
  to _PyPreConfig
* Add a new "_PyPreConfig preconfig;" field to _PyCoreConfig
2019-03-05 02:01:27 +01:00
Jules Lasne (jlasne) 7e9ce4c89e Fixed a missing . and a missing capital letter. (GH-12170) 2019-03-04 20:12:04 +02:00
Christian Heimes b7bc283ab6 bpo-36179: Fix ref leaks in _hashopenssl (GH-12158)
Fix two unlikely reference leaks in _hashopenssl. The leaks only occur in
out-of-memory cases. Thanks to Charalampos Stratakis.

Signed-off-by: Christian Heimes <christian@python.org>



https://bugs.python.org/issue36179
2019-03-04 07:45:41 -08:00
Kevin Adler 800d5cd750 bpo-35198 Fix C++ extension compilation on AIX (GH-10437)
For C++ extensions, distutils tries to replace the C compiler with the
C++ compiler, but it assumes that C compiler is the first element after
any environment variables set. On AIX, linking goes through ld_so_aix,
so it is the first element and the compiler is the next element. Thus
the replacement is faulty:

ld_so_aix gcc ... -> g++ gcc ...

Also, it assumed that self.compiler_cxx had only 1 element or that
there were the same number of elements as the linker has and in the
same order. This might not be the case, so instead concatenate
everything together.
2019-03-04 15:48:40 +01:00
Victor Stinner 4d61e6e3b8
Revert: bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (GH-11617) (GH-12159)
* Revert "bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as necessary). (#12003)"

This reverts commit bcfa450f21.

* Revert "bpo-33608: Simplify ceval's DISPATCH by hoisting eval_breaker ahead of time. (gh-12062)"

This reverts commit bda918bf65.

* Revert "bpo-33608: Use _Py_AddPendingCall() in _PyCrossInterpreterData_Release(). (gh-12024)"

This reverts commit b05b711a2c.

* Revert "bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (GH-11617)"

This reverts commit ef4ac967e2.
2019-03-04 14:21:28 +01:00
pxinwr f4b0a1c0da bpo-31904: Add encoding support for VxWorks RTOS (GH-12051)
Use UTF-8 as the system encoding on VxWorks.

The main reason are:

1. The locale is frequently misconfigured.
2. Missing some functions to deal with locale in VxWorks C library.
2019-03-04 10:02:06 +01:00
Pablo Galindo 8bc401a55c
Clean implementation of Parser/pgen and fix some style issues (GH-12156) 2019-03-04 07:26:13 +00:00
Andrew Kuchling 97c288df61
bpo-20906: Various revisions to the Unicode howto (#8394)
* bpo-20906: Corrections & revisions to Unicode HOWTO

* bpo-34484: don't describe range as a Private Use Area
2019-03-03 23:10:28 -05:00