summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* bpo-34523: Add _PyCoreConfig.filesystem_encoding (GH-8963)Victor Stinner2018-08-2912-100/+296
| | | | | | | | | | | | | | | | | | | | | | | _PyCoreConfig_Read() is now responsible to choose the filesystem encoding and error handler. Using Py_Main(), the encoding is now chosen even before calling Py_Initialize(). _PyCoreConfig.filesystem_encoding is now the reference, instead of Py_FileSystemDefaultEncoding, for the Python filesystem encoding. Changes: * Add filesystem_encoding and filesystem_errors to _PyCoreConfig * _PyCoreConfig_Read() now reads the locale encoding for the file system encoding. * PyUnicode_EncodeFSDefault() and PyUnicode_DecodeFSDefaultAndSize() now use the interpreter configuration rather than Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors global configuration variables. * Add _Py_SetFileSystemEncoding() and _Py_ClearFileSystemEncoding() private functions to only modify Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors in coreconfig.c. * _Py_CoerceLegacyLocale() now takes an int rather than _PyCoreConfig for the warning.
* bpo-34485: Add _PyCoreConfig.stdio_encoding (GH-8881)Victor Stinner2018-08-296-135/+265
| | | | * Add stdio_encoding and stdio_errors fields to _PyCoreConfig. * Add unit tests on stdio_encoding and stdio_errors.
* bpo-34485, Windows: LC_CTYPE set to user preference (GH-8988)Victor Stinner2018-08-293-19/+13
| | | | | | | | | | | | | | On Windows, the LC_CTYPE is now set to the user preferred locale at startup: _Py_SetLocaleFromEnv(LC_CTYPE) is now called during the Python initialization. Previously, the LC_CTYPE locale was "C" at startup, but changed when calling setlocale(LC_CTYPE, "") or setlocale(LC_ALL, ""). pymain_read_conf() now also calls _Py_SetLocaleFromEnv(LC_CTYPE) to behave as _Py_InitializeCore(). Moreover, it doesn't save/restore the LC_ALL anymore. On Windows, standard streams like sys.stdout now always use surrogateescape error handler by default (ignore the locale).
* bpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986)Victor Stinner2018-08-293-18/+40
| | | | | | | Standard streams like sys.stdout now use the "surrogateescape" error handler, instead of "strict", on the POSIX locale (when the C locale is not coerced and the UTF-8 Mode is disabled). Add tests on sys.stdout.errors with LC_ALL=POSIX.
* Improve commutativity of math.hypot() and math.dist() (GH-8984)Raymond Hettinger2018-08-291-13/+19
|
* bpo-34485: Add _Py_ClearStandardStreamEncoding() (GH-8982)Victor Stinner2018-08-284-97/+111
| | | | | | | | | | * Move Py_SetStandardStreamEncoding() from pylifecycle.c to coreconfig.c * Add _Py_ClearStandardStreamEncoding() private function. * pymain_free() now calls _Py_ClearStandardStreamEncoding(). * Add assertions add the end of _PyCoreConfig_Read() * _PyCoreConfig_Copy(): rename COPY_STR_ATTR() macro to COPY_WSTR_ATTR(). * Fix get_stdio_errors() indentation.
* bpo-34485: Fix _Py_InitializeCore() for C locale coercion (GH-8979)Victor Stinner2018-08-283-13/+19
| | | | | | | | * _Py_InitializeCore() now sets the LC_CTYPE locale to the user preferred locale before checking if the C locale should be coerced or not in _PyCoreConfig_Read(). * Fix pymain_read_conf(): remember if the C locale has been coerced when the configuration should be read again if the encoding has changed.
* bpo-34485: Enhance init_sys_streams() (GH-8978)Victor Stinner2018-08-288-43/+91
| | | | | | | | | | | | | | | Python now gets the locale encoding with C code to initialize the encoding of standard streams like sys.stdout. Moreover, the encoding is now initialized to the Python codec name to get a normalized encoding name and to ensure that the codec is loaded. The change avoids importing _bootlocale and _locale modules at startup by default. When the PYTHONIOENCODING environment variable only contains an encoding, the error handler is now is now set explicitly to "strict". Rename also get_default_standard_stream_error_handler() to get_stdio_errors(). Reduce the buffer to format the "cpXXX" string (Windows locale encoding).
* bpo-34403: On HP-UX, force ASCII for C locale (GH-8969)Victor Stinner2018-08-285-52/+105
| | | | | | | | On HP-UX with C or POSIX locale, sys.getfilesystemencoding() now returns "ascii" instead of "roman8" (when the UTF-8 Mode is disabled and the C locale is not coerced). nl_langinfo(CODESET) announces "roman8" whereas it uses the Latin1 encoding in practice.
* bpo-34527: POSIX locale enables the UTF-8 Mode (GH-8972)Victor Stinner2018-08-285-11/+35
| | | | | | | | | | * The UTF-8 Mode is now also enabled by the "POSIX" locale, not only by the "C" locale. * On FreeBSD, Py_DecodeLocale() and Py_EncodeLocale() now also forces the ASCII encoding if the LC_CTYPE locale is "POSIX", not only if the LC_CTYPE locale is "C". * test_utf8_mode.test_cmd_line() checks also that the command line arguments are decoded from UTF-8 when the the UTF-8 Mode is enabled with POSIX locale or C locale.
* bpo-21145: Add cached_property decorator in functools (#6982)Carl Meyer2018-08-284-0/+256
| | | | | | Robust caching of calculated properties is harder than it looks at first glance, so add a solid, well-tested implementation to the standard library.
* bpo-33635: Handling Bad file descriptor in Path.is_file and related. (GH-8542)Przemysław Spodymek2018-08-273-10/+48
|
* bpo-34347: Fix test_utf8_mode.test_cmd_line for AIX (GH-8923)Michael Felt2018-08-272-0/+3
| | | AIX uses ISO-8859-1 encoding for the C locale.
* bpo-34434: Update doc for bool(), float() and int() arguments (GH-8834)Louis Sautier2018-08-271-1/+9
|
* bpo-26544: Get rid of dependence from distutils in platform. (GH-8356)Serhiy Storchaka2018-08-271-1/+30
|
* bpo-34171: Fix test_trace. (GH-8940)Serhiy Storchaka2018-08-271-3/+6
| | | | Remove "trace.cover" left from previous test runs before testing that it is no longer created.
* bpo-32968: Make modulo and floor division involving Fraction and float ↵Elias Zamaria2018-08-274-12/+13
| | | | | | | consistent with other operations (#5956) Make mixed-type `%` and `//` operations involving `Fraction` and `float` objects behave like all other mixed-type arithmetic operations: first the `Fraction` object is converted to a `float`, then the `float` operation is performed as normal. This fixes some surprising corner cases, like `Fraction('1/3') % inf` giving a NaN. Thanks Elias Zamaria for the patch.
* Fast path for exact floats in math.hypot() and math.dist() (GH-8949)Raymond Hettinger2018-08-271-9/+21
|
* Remove AIX workaround test_subprocess (GH-8939)Michael Felt2018-08-262-8/+3
| | | | An old apparent AIX behavior workaround in test_subprocess's test_undecodable_env is no longer needed.
* bpo-34503: Fix refleak in PyErr_SetObject() (GH-8934)Alexey Izbyshev2018-08-261-0/+1
|
* closes bpo-34504: Remove the useless NULL check in PySequence_Check(). (GH-8935)Alexey Izbyshev2018-08-251-1/+1
| | | Reported by Svace static analyzer.
* closes bpo-34501: PyType_FromSpecWithBases: Check spec->name before ↵Alexey Izbyshev2018-08-251-4/+9
| | | | | dereferencing it. (GH-8930) Reported by Svace static analyzer.
* closes bpo-34502: Remove a note about utf8_mode from sys.exit() docs. (GH-8928)Alexey Izbyshev2018-08-251-3/+0
|
* Remove unneeded PyErr_Clear() in _winapi_SetNamedPipeHandleState_impl() ↵Zackery Spytz2018-08-251-2/+0
| | | | (GH-8281)
* Fix markup in stdtypes documentation (GH-8905)Andrés Delfino2018-08-251-5/+5
|
* bpo-34395: Don't free allocated memory on realloc fail in load_mark() in ↵Sergey Fedoseev2018-08-251-15/+5
| | | | _pickle.c. (GH-8788)
* Fix upsizing of marks stack in pickle module. (GH-8860)Sergey Fedoseev2018-08-252-4/+4
| | | Previously marks stack was upsized even there was space for additional item.
* bpo-34171: Prevent creating Lib/trace.cover when run the trace module. (GH-8841)Serhiy Storchaka2018-08-253-10/+10
|
* closes bpo-34493: Objects/genobject.c: Add missing NULL check to ↵Alexey Izbyshev2018-08-251-0/+3
| | | | compute_cr_origin() (GH-8911)
* Fixed typo with asynccontextmanager code example (GH-8845)Alexander Vasin2018-08-251-1/+1
| | | `yield conn`, instead of just `yield`.
* bpo-34426: fix typo (__lltrace__ -> __ltrace__) (GH-8822)Danish Prakash2018-08-251-1/+1
|
* bpo-13312: Avoid int underflow in time year. (GH-8912)Gregory P. Smith2018-08-253-6/+13
| | | Avoids an integer underflow in the time module's year handling code.
* bpo-34492: Python/coreconfig.c: Fix _Py_wstrlist_copy() (GH-8910)Alexey Izbyshev2018-08-241-1/+4
| | | | | | | bpo-34492: Python/coreconfig.c: Add missing NULL check to _Py_wstrlist_copy(). Fix _Py_wstrlist_clear() call on a wrong list. Reported by Svace static analyzer.
* bpo-34448: Improve output of usable wchar_t check (GH-8846)Michael Osipov2018-08-242-7/+9
|
* closes bpo-34471: _datetime: Add missing NULL check to ↵Alexey Izbyshev2018-08-241-1/+4
| | | | | tzinfo_from_isoformat_results. (GH-8869) Reported by Svace static analyzer.
* bpo-6700: Fix inspect.getsourcelines for module level frames/tracebacks ↵Vladimir Matveev2018-08-244-3/+26
| | | | (GH-8864)
* Fix typo in the dataclasses's doc (GH-8896)Daniel Dương2018-08-241-1/+1
|
* closes bpo-34468: Objects/rangeobject.c: Fix an always-false condition in ↵Alexey Izbyshev2018-08-241-4/+4
| | | | | | | | range_repr() (GH-8880) Also, propagate the error from PyNumber_AsSsize_t() because we don't care only about OverflowError which is not reported if the second argument is NULL. Reported by Svace static analyzer.
* closes bpo-34474: Python/bltinmodule.c: Add missing NULL check in ↵Alexey Izbyshev2018-08-241-0/+5
| | | | | builtin_sum_impl() (GH-8872) Reported by Svace static analyzer.
* closes bpo-34477: Objects/typeobject.c: Add missing NULL check to ↵Alexey Izbyshev2018-08-241-0/+3
| | | | | type_init() (GH-8876) Reported by Svace static analyzer.
* Fix doc for `add_subparsers` arguments (GH-8884)Anthony Sottile2018-08-241-1/+1
| | | There was a missing comma.
* Fix typo in asyncio.BoundedSemaphore docs (GH-8882)Jelle Zijlstra2018-08-241-1/+1
| | | semapthores -> semaphores
* bpo-34454: fix .fromisoformat() methods crashing on inputs with surrogate ↵Paul Ganssle2018-08-233-10/+84
| | | | | | | | | | | | | | | | | | | | code points (GH-8862) The current C implementations **crash** if the input includes a surrogate Unicode code point, which is not possible to encode in UTF-8. Important notes: 1. It is possible to pass a non-UTF-8 string as a separator to the `.isoformat()` methods. 2. The pure-Python `datetime.fromisoformat()` implementation accepts strings with a surrogate as the separator. In `datetime.fromisoformat()`, in the special case of non-UTF-8 separators, this implementation will take a performance hit by making a copy of the input string and replacing the separator with 'T'. Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru> Co-authored-by: Paul Ganssle <paul@ganssle.io>
* Make it more clear that setUpClass runs before each class, not "class run" ↵Ville Skyttä2018-08-231-1/+1
| | | | (GH-8844)
* bpo-34412: Make signal.strsignal() work on HP-UX (GH-8786)Michael Osipov2018-08-236-4/+27
| | | | | | Introduce a configure check for strsignal(3) which defines HAVE_STRSIGNAL for signalmodule.c. Add some common signals on HP-UX. This change applies for Windows and HP-UX.
* bpo-34207: Fix pymain_read_conf() for UTF-8 Mode (GH-8868)Victor Stinner2018-08-231-0/+6
| | | | | bpo-34170, bpo-34207: pymain_read_conf() now sets Py_UTF8Mode to config->utf8_mode. pymain_read_conf() calls indirectly Py_DecodeLocale() and Py_EncodeLocale() which depend on Py_UTF8Mode.
* bpo-34436: Fix check that disables overallocation for the last fmt specifier ↵Alexey Izbyshev2018-08-231-3/+3
| | | | | (GH-8826) Reported by Svace static analyzer.
* Remove superseded line from argparse.HelpFormatter() (GH-8839)Grant Jenks2018-08-221-1/+0
|
* bpo-34462: Add missing NULL check to _copy_raw_string() (GH-8863)Alexey Izbyshev2018-08-221-1/+1
| | | | Reported by Svace static analyzer.
* bpo-2122: Make mmap.flush() behave same on all platforms (GH-8692)Berker Peksag2018-08-225-13/+36
| | | | | Previously, its behavior was platform-dependent and there was no error checking under Windows.