1. 23 Ock, 2019 3 kayıt (commit)
  2. 22 Ock, 2019 5 kayıt (commit)
    • Victor Stinner's avatar
      bpo-35713: Split _Py_InitializeCore into subfunctions (GH-11650) · 6d43f6f0
      Victor Stinner yazdı
      * Split _Py_InitializeCore_impl() into subfunctions: add multiple pycore_init_xxx() functions
      * Preliminary sys.stderr is now set earlier to get an usable
        sys.stderr ealier.
      * Move code into _Py_Initialize_ReconfigureCore() to be able to call
        it from _Py_InitializeCore().
      * Split _PyExc_Init(): create a new _PyBuiltins_AddExceptions()
        function.
      * Call _PyExc_Init() earlier in _Py_InitializeCore_impl()
        and new_interpreter() to get working exceptions earlier.
      * _Py_ReadyTypes() now returns _PyInitError rather than calling
        Py_FatalError().
      * Misc code cleanup
      6d43f6f0
    • Steve Dower's avatar
      28f6cb34
    • Victor Stinner's avatar
      bpo-35713: Rework Python initialization (GH-11647) · bf4ac2d2
      Victor Stinner yazdı
      * The PyByteArray_Init() and PyByteArray_Fini() functions have been
        removed. They did nothing since Python 2.7.4 and Python 3.2.0, were
        excluded from the limited API (stable ABI), and were not
        documented.
      * Move "_PyXXX_Init()" and "_PyXXX_Fini()" declarations from
        Include/cpython/pylifecycle.h to
        Include/internal/pycore_pylifecycle.h. Replace
        "PyAPI_FUNC(TYPE)" with "extern TYPE".
      * _PyExc_Init() now returns an error on failure rather than calling
        Py_FatalError(). Move macros inside _PyExc_Init() and undefine them
        when done. Rewrite macros to make them look more like statement:
        add ";" when using them, add "do { ... } while (0)".
      * _PyUnicode_Init() now returns a _PyInitError error rather than call
        Py_FatalError().
      * Move stdin check from _PySys_BeginInit() to init_sys_streams().
      * _Py_ReadyTypes() now returns a _PyInitError error rather than
        calling Py_FatalError().
      bf4ac2d2
    • Lucas Cimon's avatar
      bpo-35720: Fixing a memory leak in pymain_parse_cmdline_impl() (GH-11528) · 35ca1820
      Lucas Cimon yazdı
      When the loop in the pymain_read_conf function in this same file
      calls pymain_init_cmdline_argv() a 2nd time, the pymain->command
      buffer of wchar_t is overriden and the previously allocated memory
      is never freed.
      35ca1820
    • Ivan Levkivskyi's avatar
      bpo-33416: Add end positions to Python AST (GH-11605) · 9932a228
      Ivan Levkivskyi yazdı
      The majority of this PR is tediously passing `end_lineno` and `end_col_offset` everywhere. Here are non-trivial points:
      * It is not possible to reconstruct end positions in AST "on the fly", some information is lost after an AST node is constructed, so we need two more attributes for every AST node `end_lineno` and `end_col_offset`.
      * I add end position information to both CST and AST.  Although it may be technically possible to avoid adding end positions to CST, the code becomes more cumbersome and less efficient.
      * Since the end position is not known for non-leaf CST nodes while the next token is added, this requires a bit of extra care (see `_PyNode_FinalizeEndPos`). Unless I made some mistake, the algorithm should be linear.
      * For statements, I "trim" the end position of suites to not include the terminal newlines and dedent (this seems to be what people would expect), for example in
        ```python
        class C:
            pass
      
        pass
        ```
        the end line and end column for the class definition is (2, 8).
      * For `end_col_offset` I use the common Python convention for indexing, for example for `pass` the `end_col_offset` is 4 (not 3), so that `[0:4]` gives one the source code that corresponds to the node.
      * I added a helper function `ast.get_source_segment()`, to get source text segment corresponding to a given AST node. It is also useful for testing.
      
      An (inevitable) downside of this PR is that AST now takes almost 25% more memory. I think however it is probably justified by the benefits.
      9932a228
  3. 21 Ock, 2019 5 kayıt (commit)
  4. 20 Ock, 2019 2 kayıt (commit)
  5. 18 Ock, 2019 10 kayıt (commit)
  6. 17 Ock, 2019 6 kayıt (commit)
  7. 16 Ock, 2019 3 kayıt (commit)
  8. 15 Ock, 2019 6 kayıt (commit)