1. 29 Agu, 2018 3 kayıt (commit)
    • Victor Stinner's avatar
      bpo-34523: Support surrogatepass in locale codecs (GH-8995) · 3d4226a8
      Victor Stinner yazdı
      Add support for the "surrogatepass" error handler in
      PyUnicode_DecodeFSDefault() and PyUnicode_EncodeFSDefault()
      for the UTF-8 encoding.
      
      Changes:
      
      * _Py_DecodeUTF8Ex() and _Py_EncodeUTF8Ex() now support the
        surrogatepass error handler (_Py_ERROR_SURROGATEPASS).
      * _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() now use
        the _Py_error_handler enum instead of "int surrogateescape" to pass
        the error handler. These functions now return -3 if the error
        handler is unknown.
      * Add unit tests on _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx()
        in test_codecs.
      * Rename get_error_handler() to _Py_GetErrorHandler() and expose it
        as a private function.
      * _freeze_importlib doesn't need config.filesystem_errors="strict"
        workaround anymore.
      3d4226a8
    • Victor Stinner's avatar
      bpo-34523: Add _PyCoreConfig.filesystem_encoding (GH-8963) · b2457efc
      Victor Stinner yazdı
      _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.
      b2457efc
    • Victor Stinner's avatar
      bpo-34485: Add _PyCoreConfig.stdio_encoding (GH-8881) · dfe0dc74
      Victor Stinner yazdı
      * Add stdio_encoding and stdio_errors fields to _PyCoreConfig.
      * Add unit tests on stdio_encoding and stdio_errors.
      dfe0dc74
  2. 28 Agu, 2018 1 kayıt (commit)
    • Victor Stinner's avatar
      bpo-34485: Enhance init_sys_streams() (GH-8978) · 9e4994d4
      Victor Stinner yazdı
      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).
      9e4994d4
  3. 03 Agu, 2018 2 kayıt (commit)
  4. 01 Agu, 2018 4 kayıt (commit)
  5. 26 Tem, 2018 2 kayıt (commit)
  6. 25 Tem, 2018 1 kayıt (commit)
    • Victor Stinner's avatar
      bpo-34170: Add _Py_InitializeFromConfig() (GH-8454) · 1dc6e390
      Victor Stinner yazdı
      * If _Py_InitializeCore() is called twice, the second call now copies
        and apply (partially) the new configuration.
      * Rename _Py_CommandLineDetails to _PyCmdline
      * Move more code into pymain_init(). The core configuration created
        by Py_Main() is new destroyed before running Python to reduce the
        memory footprint.
      * _Py_InitializeCore() now returns the created interpreter.
        _Py_InitializeMainInterpreter() now expects an interpreter.
      * Remove _Py_InitializeEx_Private(): _freeze_importlib now uses
        _Py_InitializeFromConfig()
      * _PyCoreConfig_InitPathConfig() now only computes the path
        configuration if needed.
      1dc6e390
  7. 20 Tem, 2018 1 kayıt (commit)
  8. 22 Haz, 2018 1 kayıt (commit)
  9. 30 Mar, 2018 1 kayıt (commit)
  10. 25 Mar, 2018 1 kayıt (commit)
    • Nick Coghlan's avatar
      bpo-33042: Fix pre-initialization sys module configuration (GH-6157) · bc77eff8
      Nick Coghlan yazdı
      - new test case for pre-initialization of sys.warnoptions and sys._xoptions
      - restored ability to call these APIs prior to Py_Initialize
      - updated the docs for the affected APIs to make it clear they can be
        called before Py_Initialize
      - also enhanced the existing embedding test cases
        to check for expected settings in the sys module
      bc77eff8
  11. 20 Ara, 2017 1 kayıt (commit)
  12. 18 Ara, 2017 1 kayıt (commit)
  13. 16 Ara, 2017 1 kayıt (commit)
    • Victor Stinner's avatar
      bpo-29240, bpo-32030: Py_Main() re-reads config if encoding changes (#4899) · 9454060e
      Victor Stinner yazdı
      bpo-29240, bpo-32030: If the encoding change (C locale coerced or
      UTF-8 Mode changed), Py_Main() now reads again the configuration with
      the new encoding.
      
      Changes:
      
      * Add _Py_UnixMain() called by main().
      * Rename pymain_free_pymain() to pymain_clear_pymain(), it can now be
        called multipled times.
      * Rename pymain_parse_cmdline_envvars() to pymain_read_conf().
      * Py_Main() now clears orig_argc and orig_argv at exit.
      * Remove argv_copy2, Py_Main() doesn't modify argv anymore. There is
        no need anymore to get two copies of the wchar_t** argv.
      * _PyCoreConfig: add coerce_c_locale and coerce_c_locale_warn.
      * Py_UTF8Mode is now initialized to -1.
      * Locale coercion (PEP 538) now respects -I and -E options.
      9454060e
  14. 13 Ara, 2017 1 kayıt (commit)
    • Victor Stinner's avatar
      bpo-29240: PEP 540: Add a new UTF-8 Mode (#855) · 91106cd9
      Victor Stinner yazdı
      * Add -X utf8 command line option, PYTHONUTF8 environment variable
        and a new sys.flags.utf8_mode flag.
      * If the LC_CTYPE locale is "C" at startup: enable automatically the
        UTF-8 mode.
      * Add _winapi.GetACP(). encodings._alias_mbcs() now calls
        _winapi.GetACP() to get the ANSI code page
      * locale.getpreferredencoding() now returns 'UTF-8' in the UTF-8
        mode. As a side effect, open() now uses the UTF-8 encoding by
        default in this mode.
      * Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding
        in the UTF-8 Mode.
      * Update subprocess._args_from_interpreter_flags() to handle -X utf8
      * Skip some tests relying on the current locale if the UTF-8 mode is
        enabled.
      * Add test_utf8mode.py.
      * _Py_DecodeUTF8_surrogateescape() gets a new optional parameter to
        return also the length (number of wide characters).
      * pymain_get_global_config() and pymain_set_global_config() now
        always copy flag values, rather than only copying if the new value
        is greater than the old value.
      91106cd9
  15. 30 Kas, 2017 1 kayıt (commit)
    • Victor Stinner's avatar
      bpo-20891: Fix PyGILState_Ensure() (#4650) · b4d1e1f7
      Victor Stinner yazdı
      When PyGILState_Ensure() is called in a non-Python thread before
      PyEval_InitThreads(), only call PyEval_InitThreads() after calling
      PyThreadState_New() to fix a crash.
      
      Add an unit test in test_embed.
      b4d1e1f7
  16. 29 Kas, 2017 1 kayıt (commit)
    • Victor Stinner's avatar
      bpo-32030: Rework memory allocators (#4625) · 5d39e042
      Victor Stinner yazdı
      * Fix _PyMem_SetupAllocators("debug"): always restore allocators to
        the defaults, rather than only caling _PyMem_SetupDebugHooks().
      * Add _PyMem_SetDefaultAllocator() helper to set the "default"
        allocator.
      * Add _PyMem_GetAllocatorsName(): get the name of the allocators
      * main() now uses debug hooks on memory allocators if Py_DEBUG is
        defined, rather than calling directly malloc()
      * Document default memory allocators in C API documentation
      * _Py_InitializeCore() now fails with a fatal user error if
        PYTHONMALLOC value is an unknown memory allocator, instead of
        failing with a fatal internal error.
      * Add new tests on the PYTHONMALLOC environment variable
      * Add support.with_pymalloc()
      * Add the _testcapi.WITH_PYMALLOC constant and expose it as
         support.with_pymalloc().
      * sysconfig.get_config_var('WITH_PYMALLOC') doesn't work on Windows, so
         replace it with support.with_pymalloc().
      * pythoninfo: add _testcapi collector for pymem
      5d39e042
  17. 26 Kas, 2017 1 kayıt (commit)
  18. 24 Kas, 2017 1 kayıt (commit)
    • Victor Stinner's avatar
      bpo-32096: Remove obj and mem from _PyRuntime (#4532) · 9e87e777
      Victor Stinner yazdı
      bpo-32096, bpo-30860:  Partially revert the commit
      2ebc5ce4:
      
      * Move structures back from Include/internal/mem.h to
        Objects/obmalloc.c
      * Remove _PyObject_Initialize() and _PyMem_Initialize()
      * Remove Include/internal/pymalloc.h
      * Add test_capi.test_pre_initialization_api():
         Make sure that it's possible to call Py_DecodeLocale(), and then call
         Py_SetProgramName() with the decoded string, before Py_Initialize().
      
      PyMem_RawMalloc() and Py_DecodeLocale() can be called again before
      _PyRuntimeState_Init().
      Co-Authored-By: 's avatarEric Snow <ericsnowcurrently@gmail.com>
      9e87e777
  19. 15 Kas, 2017 1 kayıt (commit)
    • Victor Stinner's avatar
      bpo-32030: Split Py_Main() into subfunctions (#4399) · f7e5b56c
      Victor Stinner yazdı
      * Don't use "Python runtime" anymore to parse command line options or
        to get environment variables: pymain_init() is now a strict
        separation.
      * Use an error message rather than "crashing" directly with
        Py_FatalError(). Limit the number of calls to Py_FatalError(). It
        prepares the code to handle errors more nicely later.
      * Warnings options (-W, PYTHONWARNINGS) and "XOptions" (-X) are now
        only added to the sys module once Python core is properly
        initialized.
      * _PyMain is now the well identified owner of some important strings
        like: warnings options, XOptions, and the "program name". The
        program name string is now properly freed at exit.
        pymain_free() is now responsible to free the "command" string.
      * Rename most methods in Modules/main.c to use a "pymain_" prefix to
        avoid conflits and ease debug.
      * Replace _Py_CommandLineDetails_INIT with memset(0)
      * Reorder a lot of code to fix the initialization ordering. For
        example, initializing standard streams now comes before parsing
        PYTHONWARNINGS.
      * Py_Main() now handles errors when adding warnings options and
        XOptions.
      * Add _PyMem_GetDefaultRawAllocator() private function.
      * Cleanup _PyMem_Initialize(): remove useless global constants: move
        them into _PyMem_Initialize().
      * Call _PyRuntime_Initialize() as soon as possible:
        _PyRuntime_Initialize() now returns an error message on failure.
      * Add _PyInitError structure and following macros:
      
        * _Py_INIT_OK()
        * _Py_INIT_ERR(msg)
        * _Py_INIT_USER_ERR(msg): "user" error, don't abort() in that case
        * _Py_INIT_FAILED(err)
      f7e5b56c
  20. 12 Kas, 2017 1 kayıt (commit)
  21. 27 Eki, 2017 1 kayıt (commit)
  22. 14 Eyl, 2017 1 kayıt (commit)
  23. 07 Eyl, 2017 1 kayıt (commit)
  24. 11 Haz, 2017 1 kayıt (commit)
    • Nick Coghlan's avatar
      bpo-28180: Implementation for PEP 538 (#659) · 6ea4186d
      Nick Coghlan yazdı
      - new PYTHONCOERCECLOCALE config setting
      - coerces legacy C locale to C.UTF-8, C.utf8 or UTF-8 by default
      - always uses C.UTF-8 on Android
      - uses `surrogateescape` on stdin and stdout in the coercion
        target locales
      - configure option to disable locale coercion at build time
      - configure option to disable C locale warning at build time
      6ea4186d
  25. 25 May, 2017 1 kayıt (commit)
  26. 23 May, 2017 1 kayıt (commit)
  27. 02 Ock, 2017 1 kayıt (commit)
  28. 07 Eyl, 2016 1 kayıt (commit)
  29. 20 Agu, 2016 1 kayıt (commit)
  30. 16 Agu, 2016 1 kayıt (commit)
  31. 19 Nis, 2016 1 kayıt (commit)
  32. 14 Mar, 2016 1 kayıt (commit)
    • Victor Stinner's avatar
      Add PYTHONMALLOC env var · 34be807c
      Victor Stinner yazdı
      Issue #26516:
      
      * Add PYTHONMALLOC environment variable to set the Python memory
        allocators and/or install debug hooks.
      * PyMem_SetupDebugHooks() can now also be used on Python compiled in release
        mode.
      * The PYTHONMALLOCSTATS environment variable can now also be used on Python
        compiled in release mode. It now has no effect if set to an empty string.
      * In debug mode, debug hooks are now also installed on Python memory allocators
        when Python is configured without pymalloc.
      34be807c
  33. 20 Ock, 2016 1 kayıt (commit)