Skip to content
Permalink
Branch: master
Commits on Feb 6, 2020
  1. bpo-39555: Fix distutils test to handle _d suffix on Windows debug bu…

    zooba committed Feb 6, 2020
    …ild (GH-18357)
Commits on Feb 5, 2020
  1. bpo-39127: Make _Py_HashPointer's argument be const (GH-17690)

    petdance committed Feb 5, 2020
  2. bpo-39542: Declare _Py_AddToAllObjects() in pycore_object.h (GH-18368)

    vstinner committed Feb 5, 2020
    _Py_AddToAllObjects() is used in bltinmodule.c and typeobject.c when
    Py_TRACE_REFS is defined.
    
    Fix Py_TRACE_REFS build.
  3. Add PyInterpreterState.fs_codec.utf8 (GH-18367)

    vstinner committed Feb 5, 2020
    Add a fast-path for UTF-8 encoding in PyUnicode_EncodeFSDefault()
    and PyUnicode_DecodeFSDefaultAndSize().
    
    Add _PyUnicode_FiniEncodings() helper function for _PyUnicode_Fini().
  4. bpo-39542: Define PyTypeObject earlier in object.h (GH-18366)

    vstinner committed Feb 5, 2020
    Replace "struct _typeobject" with PyTypeObject in object.h.
  5. bpo-39542: Convert PyType_Check() to static inline function (GH-18364)

    vstinner committed Feb 5, 2020
    Convert PyType_HasFeature(), PyType_Check() and PyType_CheckExact()
    macros to static inline functions.
  6. bpo-39542: Make PyObject_INIT() opaque in limited C API (GH-18363)

    vstinner committed Feb 5, 2020
    In the limited C API, PyObject_INIT() and PyObject_INIT_VAR() are now
    defined as aliases to PyObject_Init() and PyObject_InitVar() to make
    their implementation opaque. It avoids to leak implementation details
    in the limited C API.
    
    Exclude the following functions from the limited C API, move them
    from object.h to cpython/object.h:
    
    * _Py_NewReference()
    * _Py_ForgetReference()
    * _PyTraceMalloc_NewReference()
    * _Py_GetRefTotal()
  7. bpo-39542: Exclude trashcan from the limited C API (GH-18362)

    vstinner committed Feb 5, 2020
    Exclude trashcan mechanism from the limited C API: it requires access to
    PyTypeObject and PyThreadState structure fields, whereas these structures
    are opaque in the limited C API.
    
    The trashcan mechanism never worked with the limited C API. Move it
    from object.h to cpython/object.h.
  8. bpo-39543: Remove unused _Py_Dealloc() macro (GH-18361)

    vstinner committed Feb 5, 2020
    The macro is defined after Py_DECREF() and so is no longer used by
    Py_DECREF().
    
    Moving _Py_Dealloc() macro back from cpython/object.h to object.h
    would require to move a lot of definitions as well: PyTypeObject and
    many related types used by PyTypeObject.
    
    Keep _Py_Dealloc() as an opaque function call to avoid leaking
    implementation details in the limited C API (object.h): remove
    _Py_Dealloc() macro from cpython/object.h.
  9. bpo-39553: Delete HAVE_SXS protected code (GH-18356)

    ZackerySpytz committed Feb 5, 2020
  10. bpo-39491: Merge PEP 593 (typing.Annotated) support (#18260)

    jstasiak committed Feb 5, 2020
    * bpo-39491: Merge PEP 593 (typing.Annotated) support
    
    PEP 593 has been accepted some time ago. I got a green light for merging
    this from Till, so I went ahead and combined the code contributed to
    typing_extensions[1] and the documentation from the PEP 593 text[2].
    
    My changes were limited to:
    
    * removing code designed for typing_extensions to run on older Python
      versions
    * removing some irrelevant parts of the PEP text when copying it over as
      documentation and otherwise changing few small bits to better serve
      the purpose
    * changing the get_type_hints signature to match reality (parameter
      names)
    
    I wasn't entirely sure how to go about crediting the authors but I used
    my best judgment, let me know if something needs changing in this
    regard.
    
    [1] https://github.com/python/typing/blob/8280de241fd8c8afe727c7860254b753e383b360/typing_extensions/src_py3/typing_extensions.py
    [2] https://github.com/python/peps/blob/17710b879882454d55f82c2d44596e8e9f8e4bff/pep-0593.rst
  11. bpo-39184: Add audit events to command execution functions in os and …

    gousaiyang committed Feb 5, 2020
    …pty modules (GH-17824)
  12. bpo-39542: Make _Py_NewReference() opaque in C API (GH-18346)

    vstinner committed Feb 5, 2020
    _Py_NewReference() becomes a regular opaque function, rather than a
    static inline function in the C API (object.h), to better hide
    implementation details.
    
    Move _Py_tracemalloc_config from public pymem.h to internal
    pycore_pymem.h header.
    
    Make _Py_AddToAllObjects() private.
  13. Fix MinGW library generation command (GH-17917)

    Baljak committed Feb 5, 2020
    To print the exports to stdout, the gendef command requires the option "-". Without this option, no output is generated.
Commits on Feb 4, 2020
  1. closes bpo-39510: Fix use-after-free in BufferedReader.readinto() (GH…

    phi-gamma committed Feb 4, 2020
    …-18295)
    
    When called on a closed object, readinto() segfaults on account
    of a write to a freed buffer:
    
        ==220553== Process terminating with default action of signal 11 (SIGSEGV): dumping core
        ==220553==  Access not within mapped region at address 0x2A
        ==220553==    at 0x48408A0: memmove (vg_replace_strmem.c:1272)
        ==220553==    by 0x58DB0C: _buffered_readinto_generic (bufferedio.c:972)
        ==220553==    by 0x58DCBA: _io__Buffered_readinto_impl (bufferedio.c:1053)
        ==220553==    by 0x58DCBA: _io__Buffered_readinto (bufferedio.c.h:253)
    
    Reproducer:
    
        reader = open ("/dev/zero", "rb")
        _void  = reader.read (42)
        reader.close ()
        reader.readinto (bytearray (42)) ### BANG!
    
    The problem exists since 2012 when commit dc46945 added code
    to free the read buffer on close().
    
    Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
  2. bpo-39432: Implement PEP-489 algorithm for non-ascii "PyInit_*" symbo…

    scoder committed Feb 4, 2020
    …l names in distutils (GH-18150)
    
    Make it export the correct init symbol also on Windows.
    
    
    
    https://bugs.python.org/issue39432
  3. Restore PyObject_IsInstance() comment (GH-18345)

    vstinner committed Feb 4, 2020
    Restore PyObject_IsInstance() comment explaining why only tuples of
    types are accepted, but not general sequence. Comment written by
    Guido van Rossum in commit 03290ec
    which implements isinstance(x, (A, B, ...)). The comment was lost in
    a PyObject_IsInstance() optimization:
    commit ec569b7.
    
    Cleanup also the code. recursive_isinstance() is no longer recursive,
    so rename it to object_isinstance(), whereas object_isinstance() is
    recursive and so rename it to object_recursive_isinstance().
  4. bpo-38076 Clear the interpreter state only after clearing module glob…

    eduardo-elizondo committed Feb 4, 2020
    …als (GH-18039)
    
    Currently, during runtime destruction, `_PyImport_Cleanup` is clearing the interpreter state before clearing out the modules themselves. This leads to a segfault on modules that rely on the module state to clear themselves up.
    
    For example, let's take the small snippet added in the issue by @DinoV :
    ```
    import _struct
    
    class C:
        def __init__(self):
            self.pack = _struct.pack
        def __del__(self):
            self.pack('I', -42)
    
    _struct.x = C()
    ```
    
    The module `_struct` uses the module state to run `pack`. Therefore, the module state has to be alive until after the module has been cleared out to successfully run `C.__del__`. This happens at line 606, when `_PyImport_Cleanup` calls `_PyModule_Clear`. In fact, the loop that calls `_PyModule_Clear` has in its comments: 
    
    > Now, if there are any modules left alive, clear their globals to minimize potential leaks.  All C extension modules actually end up here, since they are kept alive in the interpreter state.
    
    That means that we can't clear the module state (which is used by C Extensions) before we run that loop.
    
    Moving `_PyInterpreterState_ClearModules` until after it, fixes the segfault in the code snippet.
    
    Finally, this updates a test in `io` to correctly assert the error that it now throws (since it now finds the io module state). The test that uses this is: `test_create_at_shutdown_without_encoding`. Given this test is now working is a proof that the module state now stays alive even when `__del__` is called at module destruction time. Thus, I didn't add a new tests for this.
    
    
    https://bugs.python.org/issue38076
  5. add whatsnew that was missed from 31d6de5 (#18344)

    cjw296 committed Feb 4, 2020
Commits on Feb 3, 2020
  1. bpo-38558: Link to further docs from walrus operator mention in tutor…

    adorilson committed Feb 3, 2020
    …ial (GH-16973)
  2. bpo-39542: Simplify _Py_NewReference() (GH-18332)

    vstinner committed Feb 3, 2020
    * Remove _Py_INC_REFTOTAL and _Py_DEC_REFTOTAL macros: modify
      directly _Py_RefTotal.
    * _Py_ForgetReference() is no longer defined if the Py_TRACE_REFS
      macro is not defined.
    * Remove _Py_NewReference() implementation from object.c:
      unify the two implementations in object.h inline function.
    * Fix Py_TRACE_REFS build: _Py_INC_TPALLOCS() macro has been removed.
  3. Fixes in sorting descriptions (GH-18317)

    pochmann committed Feb 3, 2020
    Improvements in listsort.txt and a comment in sortperf.py.
    
    Automerge-Triggered-By: @csabella
  4. bpo-39542: Move object.h debug functions to internal C API (GH-18331)

    vstinner committed Feb 3, 2020
    Move the following functions from the public C API to the internal C
    API:
    
    * _PyDebug_PrintTotalRefs(),
    * _Py_PrintReferenceAddresses()
    * _Py_PrintReferences()
  5. bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)

    vstinner committed Feb 3, 2020
    Remove:
    
    * COUNT_ALLOCS macro
    * sys.getcounts() function
    * SHOW_ALLOC_COUNT code in listobject.c
    * SHOW_TRACK_COUNT code in tupleobject.c
    * PyConfig.show_alloc_count field
    * -X showalloccount command line option
    * @test.support.requires_type_collecting decorator
  6. bpo-36051: Fix compiler warning. (GH-18325)

    methane committed Feb 3, 2020
  7. bpo-39450 Stripped whitespace before parsing the docstring in TestCas…

    scirelli committed Feb 3, 2020
    …e.shortDescription (GH-18175)
Commits on Feb 2, 2020
  1. bpo-39492: Fix a reference cycle between reducer_override and a Pickl…

    pierreglaser committed Feb 2, 2020
    …er instance (GH-18266)
    
    This also needs a backport to 3.8
    
    
    https://bugs.python.org/issue39492
    
    
    
    Automerge-Triggered-By: @pitrou
  2. bpo-39349: Add *cancel_futures* to Executor.shutdown() (GH-18057)

    aeros committed Feb 2, 2020
  3. Fix 5-space indentation and trailing whitespace (GH-18311)

    mdickinson committed Feb 2, 2020
Commits on Feb 1, 2020
Older
You can’t perform that action at this time.