1. 23 Mar, 2018 1 kayıt (commit)
    • Serhiy Storchaka's avatar
      bpo-33041: Rework compiling an "async for" loop. (#6142) · 702f8f36
      Serhiy Storchaka yazdı
      * Added new opcode END_ASYNC_FOR.
      * Setting global StopAsyncIteration no longer breaks "async for" loops.
      * Jumping into an "async for" loop is now disabled.
      * Jumping out of an "async for" loop no longer corrupts the stack.
      * Simplify the compiler.
      702f8f36
  2. 22 Şub, 2018 1 kayıt (commit)
  3. 04 Şub, 2018 1 kayıt (commit)
  4. 30 Ock, 2018 1 kayıt (commit)
  5. 14 Ara, 2016 1 kayıt (commit)
  6. 02 Eki, 2016 1 kayıt (commit)
  7. 09 Eyl, 2016 2 kayıt (commit)
    • Victor Stinner's avatar
      Rework CALL_FUNCTION* opcodes · f9b760f4
      Victor Stinner yazdı
      Issue #27213: Rework CALL_FUNCTION* opcodes to produce shorter and more
      efficient bytecode:
      
      * CALL_FUNCTION now only accepts position arguments
      * CALL_FUNCTION_KW accepts position arguments and keyword arguments, but keys
        of keyword arguments are packed into a constant tuple.
      * CALL_FUNCTION_EX is the most generic, it expects a tuple and a dict for
        positional and keyword arguments.
      
      CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW opcodes have been removed.
      
      2 tests of test_traceback are currently broken: skip test, the issue #28050 was
      created to track the issue.
      
      Patch by Demur Rumed, design by Serhiy Storchaka, reviewed by Serhiy Storchaka
      and Victor Stinner.
      f9b760f4
    • Yury Selivanov's avatar
      Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations. · f8cb8a16
      Yury Selivanov yazdı
      Patch by Ivan Levkivskyi.
      f8cb8a16
  8. 06 Eyl, 2016 1 kayıt (commit)
  9. 12 Haz, 2016 1 kayıt (commit)
  10. 11 Haz, 2016 1 kayıt (commit)
  11. 12 Nis, 2016 1 kayıt (commit)
  12. 03 Kas, 2015 1 kayıt (commit)
  13. 22 Haz, 2015 1 kayıt (commit)
    • Yury Selivanov's avatar
      Issue #24400: Introduce a distinct type for 'async def' coroutines. · 5376ba96
      Yury Selivanov yazdı
      Summary of changes:
      
      1. Coroutines now have a distinct, separate from generators
         type at the C level: PyGen_Type, and a new typedef PyCoroObject.
         PyCoroObject shares the initial segment of struct layout with
         PyGenObject, making it possible to reuse existing generators
         machinery.  The new type is exposed as 'types.CoroutineType'.
      
         As a consequence of having a new type, CO_GENERATOR flag is
         no longer applied to coroutines.
      
      2. Having a separate type for coroutines made it possible to add
         an __await__ method to the type.  Although it is not used by the
         interpreter (see details on that below), it makes coroutines
         naturally (without using __instancecheck__) conform to
         collections.abc.Coroutine and collections.abc.Awaitable ABCs.
      
         [The __instancecheck__ is still used for generator-based
         coroutines, as we don't want to add __await__ for generators.]
      
      3. Add new opcode: GET_YIELD_FROM_ITER.  The opcode is needed to
         allow passing native coroutines to the YIELD_FROM opcode.
      
         Before this change, 'yield from o' expression was compiled to:
      
            (o)
            GET_ITER
            LOAD_CONST
            YIELD_FROM
      
         Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.
      
         The reason for adding a new opcode is that GET_ITER is used
         in some contexts (such as 'for .. in' loops) where passing
         a coroutine object is invalid.
      
      4. Add two new introspection functions to the inspec module:
         getcoroutinestate(c) and getcoroutinelocals(c).
      
      5. inspect.iscoroutine(o) is updated to test if 'o' is a native
         coroutine object.  Before this commit it used abc.Coroutine,
         and it was requested to update inspect.isgenerator(o) to use
         abc.Generator; it was decided, however, that inspect functions
         should really be tailored for checking for native types.
      
      6. sys.set_coroutine_wrapper(w) API is updated to work with only
         native coroutines.  Since types.coroutine decorator supports
         any type of callables now, it would be confusing that it does
         not work for all types of coroutines.
      
      7. Exceptions logic in generators C implementation was updated
         to raise clearer messages for coroutines:
      
         Before: TypeError("generator raised StopIteration")
         After: TypeError("coroutine raised StopIteration")
      5376ba96
  14. 28 May, 2015 1 kayıt (commit)
  15. 12 May, 2015 1 kayıt (commit)
  16. 06 May, 2015 1 kayıt (commit)
  17. 10 Nis, 2014 1 kayıt (commit)
  18. 23 Kas, 2013 1 kayıt (commit)
  19. 16 May, 2013 1 kayıt (commit)
  20. 30 Nis, 2013 1 kayıt (commit)
  21. 07 Haz, 2012 1 kayıt (commit)
  22. 13 Ock, 2012 1 kayıt (commit)
  23. 18 Tem, 2011 1 kayıt (commit)
  24. 10 Eyl, 2010 1 kayıt (commit)
    • Amaury Forgeot d'Arc's avatar
      #4617: Previously it was illegal to delete a name from the local · ba117ef7
      Amaury Forgeot d'Arc yazdı
      namespace if it occurs as a free variable in a nested block.  This limitation
      of the compiler has been lifted, and a new opcode introduced (DELETE_DEREF).
      
      This sample was valid in 2.6, but fails to compile in 3.x without this change::
      
         >>> def f():
         ...     def print_error():
         ...        print(e)
         ...     try:
         ...        something
         ...     except Exception as e:
         ...        print_error()
         ...        # implicit "del e" here
      
      
      This sample has always been invalid in Python, and now works::
      
         >>> def outer(x):
         ...     def inner():
         ...        return x
         ...     inner()
         ...     del x
      
      There is no need to bump the PYC magic number: the new opcode is used
      for code that did not compile before.
      ba117ef7
  25. 04 Eyl, 2010 1 kayıt (commit)
  26. 11 Ock, 2010 1 kayıt (commit)
  27. 09 Ock, 2010 1 kayıt (commit)
  28. 28 Haz, 2009 1 kayıt (commit)
    • Benjamin Peterson's avatar
      Merged revisions 72912,72920,72940 via svnmerge from · 876b2f28
      Benjamin Peterson yazdı
      svn+ssh://pythondev@svn.python.org/python/trunk
      
      ........
        r72912 | benjamin.peterson | 2009-05-25 08:13:44 -0500 (Mon, 25 May 2009) | 5 lines
      
        add a SETUP_WITH opcode
      
        It speeds up the with statement and correctly looks up the special
        methods involved.
      ........
        r72920 | benjamin.peterson | 2009-05-25 15:12:57 -0500 (Mon, 25 May 2009) | 1 line
      
        take into account the fact that SETUP_WITH pushes a finally block
      ........
        r72940 | benjamin.peterson | 2009-05-26 07:49:59 -0500 (Tue, 26 May 2009) | 1 line
      
        teach the peepholer about SETUP_WITH
      ........
      876b2f28
  29. 25 May, 2009 1 kayıt (commit)
  30. 28 Şub, 2009 1 kayıt (commit)
  31. 25 Şub, 2009 1 kayıt (commit)
    • Jeffrey Yasskin's avatar
      http://bugs.python.org/issue4715 · 9de7ec78
      Jeffrey Yasskin yazdı
      This patch by Antoine Pitrou optimizes the bytecode for conditional branches by
      merging the following "POP_TOP" instruction into the conditional jump.  For
      example, the list comprehension "[x for x in l if not x]" produced the
      following bytecode:
      
        1           0 BUILD_LIST               0
                    3 LOAD_FAST                0 (.0)
              >>    6 FOR_ITER                23 (to 32)
                    9 STORE_FAST               1 (x)
                   12 LOAD_FAST                1 (x)
                   15 JUMP_IF_TRUE            10 (to 28)
                   18 POP_TOP
                   19 LOAD_FAST                1 (x)
                   22 LIST_APPEND              2
                   25 JUMP_ABSOLUTE            6
              >>   28 POP_TOP
                   29 JUMP_ABSOLUTE            6
              >>   32 RETURN_VALUE
      
      but after the patch it produces the following bytecode:
      
        1           0 BUILD_LIST               0
                    3 LOAD_FAST                0 (.0)
              >>    6 FOR_ITER                18 (to 27)
                    9 STORE_FAST               1 (x)
                   12 LOAD_FAST                1 (x)
                   15 POP_JUMP_IF_TRUE         6
                   18 LOAD_FAST                1 (x)
                   21 LIST_APPEND              2
                   24 JUMP_ABSOLUTE            6
              >>   27 RETURN_VALUE
      
      Notice that not only the code is shorter, but the conditional jump
      (POP_JUMP_IF_TRUE) jumps right to the start of the loop instead of going through
      the JUMP_ABSOLUTE at the end. "continue" statements are helped
      similarly.
      
      Furthermore, the old jump opcodes (JUMP_IF_FALSE, JUMP_IF_TRUE) have been
      replaced by two new opcodes:
      - JUMP_IF_TRUE_OR_POP, which jumps if true and pops otherwise
      - JUMP_IF_FALSE_OR_POP, which jumps if false and pops otherwise
      9de7ec78
  32. 18 Ara, 2008 1 kayıt (commit)
  33. 17 Ara, 2008 1 kayıt (commit)
  34. 20 Tem, 2008 1 kayıt (commit)
  35. 11 Haz, 2008 1 kayıt (commit)
  36. 18 Mar, 2008 1 kayıt (commit)
  37. 19 Ara, 2007 1 kayıt (commit)
    • Christian Heimes's avatar
      Merged revisions 59541-59561 via svnmerge from · 99170a5d
      Christian Heimes yazdı
      svn+ssh://pythondev@svn.python.org/python/trunk
      
      ........
        r59544 | raymond.hettinger | 2007-12-18 01:13:45 +0100 (Tue, 18 Dec 2007) | 1 line
      
        Add more namedtuple() test cases.  Neaten the code and comments.
      ........
        r59545 | christian.heimes | 2007-12-18 04:38:03 +0100 (Tue, 18 Dec 2007) | 3 lines
      
        Fixed for #1601: IDLE not working correctly on Windows (Py30a2/IDLE30a1)
      
        Amaury's ideas works great. Should we build the Python core with WINVER=0x0500 and _WIN32_WINNT=0x0500, too?
      ........
        r59546 | christian.heimes | 2007-12-18 10:00:13 +0100 (Tue, 18 Dec 2007) | 1 line
      
        Make it a bit easier to test Tcl/Tk and idle from a build dir.
      ........
        r59547 | christian.heimes | 2007-12-18 10:12:10 +0100 (Tue, 18 Dec 2007) | 1 line
      
        Removed several unused files from the PCbuild9 directory. They are relics from the past.
      ........
        r59548 | raymond.hettinger | 2007-12-18 19:26:18 +0100 (Tue, 18 Dec 2007) | 29 lines
      
        Speed-up dictionary constructor by about 10%.
      
        New opcode, STORE_MAP saves the compiler from awkward stack manipulations
        and specializes for dicts using PyDict_SetItem instead of PyObject_SetItem.
      
        Old disassembly:
                      0 BUILD_MAP                0
                      3 DUP_TOP
                      4 LOAD_CONST               1 (1)
                      7 ROT_TWO
                      8 LOAD_CONST               2 ('x')
                     11 STORE_SUBSCR
                     12 DUP_TOP
                     13 LOAD_CONST               3 (2)
                     16 ROT_TWO
                     17 LOAD_CONST               4 ('y')
                     20 STORE_SUBSCR
      
        New disassembly:
                      0 BUILD_MAP                0
                      3 LOAD_CONST               1 (1)
                      6 LOAD_CONST               2 ('x')
                      9 STORE_MAP
                     10 LOAD_CONST               3 (2)
                     13 LOAD_CONST               4 ('y')
                     16 STORE_MAP
      ........
        r59549 | thomas.heller | 2007-12-18 20:00:34 +0100 (Tue, 18 Dec 2007) | 2 lines
      
        Issue #1642: Fix segfault in ctypes when trying to delete attributes.
      ........
        r59551 | guido.van.rossum | 2007-12-18 21:10:42 +0100 (Tue, 18 Dec 2007) | 2 lines
      
        Issue #1645 by Alberto Bertogli.  Fix a comment.
      ........
        r59553 | raymond.hettinger | 2007-12-18 22:24:09 +0100 (Tue, 18 Dec 2007) | 12 lines
      
        Give meaning to the oparg for BUILD_MAP:  estimated size of the dictionary.
      
        Allows dictionaries to be pre-sized (upto 255 elements) saving time lost
        to re-sizes with their attendant mallocs and re-insertions.
      
        Has zero effect on small dictionaries (5 elements or fewer), a slight
        benefit for dicts upto 22 elements (because they had to resize once
        anyway), and more benefit for dicts upto 255 elements (saving multiple
        resizes during the build-up and reducing the number of collisions on
        the first insertions).  Beyond 255 elements, there is no addional benefit.
      ........
        r59554 | christian.heimes | 2007-12-18 22:56:09 +0100 (Tue, 18 Dec 2007) | 1 line
      
        Fixed #1649: IDLE error: dictionary changed size during iteration
      ........
        r59557 | raymond.hettinger | 2007-12-18 23:21:27 +0100 (Tue, 18 Dec 2007) | 1 line
      
        Simplify and speedup _asdict() for named tuples.
      ........
        r59558 | christian.heimes | 2007-12-19 00:22:54 +0100 (Wed, 19 Dec 2007) | 3 lines
      
        Applied patch #1635: Float patch for inf and nan on Windows (and other platforms).
      
        The patch unifies float("inf") and repr(float("inf")) on all platforms.
      ........
        r59559 | raymond.hettinger | 2007-12-19 00:51:15 +0100 (Wed, 19 Dec 2007) | 1 line
      
        Users demand iterable input for named tuples. The author capitulates.
      ........
        r59560 | raymond.hettinger | 2007-12-19 01:21:06 +0100 (Wed, 19 Dec 2007) | 1 line
      
        Beef-up tests for dict literals
      ........
        r59561 | raymond.hettinger | 2007-12-19 01:27:21 +0100 (Wed, 19 Dec 2007) | 1 line
      
        Zap a duplicate line
      ........
      99170a5d
  38. 18 Ara, 2007 2 kayıt (commit)
    • Raymond Hettinger's avatar
      Give meaning to the oparg for BUILD_MAP: estimated size of the dictionary. · fd7ed407
      Raymond Hettinger yazdı
      Allows dictionaries to be pre-sized (upto 255 elements) saving time lost
      to re-sizes with their attendant mallocs and re-insertions.
      
      Has zero effect on small dictionaries (5 elements or fewer), a slight
      benefit for dicts upto 22 elements (because they had to resize once
      anyway), and more benefit for dicts upto 255 elements (saving multiple
      resizes during the build-up and reducing the number of collisions on
      the first insertions).  Beyond 255 elements, there is no addional benefit.
      fd7ed407
    • Raymond Hettinger's avatar
      Speed-up dictionary constructor by about 10%. · effde12f
      Raymond Hettinger yazdı
      New opcode, STORE_MAP saves the compiler from awkward stack manipulations
      and specializes for dicts using PyDict_SetItem instead of PyObject_SetItem.
      
      Old disassembly:
                    0 BUILD_MAP                0
                    3 DUP_TOP
                    4 LOAD_CONST               1 (1)
                    7 ROT_TWO
                    8 LOAD_CONST               2 ('x')
                   11 STORE_SUBSCR
                   12 DUP_TOP
                   13 LOAD_CONST               3 (2)
                   16 ROT_TWO
                   17 LOAD_CONST               4 ('y')
                   20 STORE_SUBSCR
      
      New disassembly:
                    0 BUILD_MAP                0
                    3 LOAD_CONST               1 (1)
                    6 LOAD_CONST               2 ('x')
                    9 STORE_MAP
                   10 LOAD_CONST               3 (2)
                   13 LOAD_CONST               4 ('y')
                   16 STORE_MAP
      effde12f