| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
_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.
|
|
|
|
| |
* Add stdio_encoding and stdio_errors fields to _PyCoreConfig.
* Add unit tests on stdio_encoding and stdio_errors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* _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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
Robust caching of calculated properties is
harder than it looks at first glance, so add
a solid, well-tested implementation to the
standard library.
|
| |
|
|
|
| |
AIX uses ISO-8859-1 encoding for the C locale.
|
| |
|
| |
|
|
|
|
| |
Remove "trace.cover" left from previous test runs before testing
that it is no longer created.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
An old apparent AIX behavior workaround in test_subprocess's
test_undecodable_env is no longer needed.
|
| |
|
|
|
| |
Reported by Svace static analyzer.
|
|
|
|
|
| |
dereferencing it. (GH-8930)
Reported by Svace static analyzer.
|
| |
|
|
|
|
| |
(GH-8281)
|
| |
|
|
|
|
| |
_pickle.c. (GH-8788)
|
|
|
| |
Previously marks stack was upsized even there was space for additional item.
|
| |
|
|
|
|
| |
compute_cr_origin() (GH-8911)
|
|
|
| |
`yield conn`, instead of just `yield`.
|
| |
|
|
|
| |
Avoids an integer underflow in the time module's year handling code.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
tzinfo_from_isoformat_results. (GH-8869)
Reported by Svace static analyzer.
|
|
|
|
| |
(GH-8864)
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
builtin_sum_impl() (GH-8872)
Reported by Svace static analyzer.
|
|
|
|
|
| |
type_init() (GH-8876)
Reported by Svace static analyzer.
|
|
|
| |
There was a missing comma.
|
|
|
| |
semapthores -> semaphores
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
(GH-8844)
|
|
|
|
|
|
| |
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-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.
|
|
|
|
|
| |
(GH-8826)
Reported by Svace static analyzer.
|
| |
|
|
|
|
| |
Reported by Svace static analyzer.
|
|
|
|
|
| |
Previously, its behavior was platform-dependent and there was no error checking
under Windows.
|