Commit Graph

104 Commits

Author SHA1 Message Date
Stéphane Wirtel 07fbbfde1b bpo-34906: Doc: Fix typos (GH-9712) 2018-10-05 16:17:18 +02:00
Serhiy Storchaka 7bdf28265a
bpo-32455: Add jump parameter to dis.stack_effect(). (GH-6610)
Add C API function PyCompile_OpcodeStackEffectWithJump().
2018-09-18 09:54:26 +03:00
Serhiy Storchaka 5e99b56d6b
bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784) 2018-09-17 15:15:03 +03:00
Serhiy Storchaka 702f8f3611
bpo-33041: Rework compiling an "async for" loop. (#6142)
* 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.
2018-03-23 14:34:35 +02:00
Serhiy Storchaka fe2bbb1869
bpo-32489: Allow 'continue' in 'finally' clause. (GH-5822) 2018-03-18 09:56:52 +02:00
Serhiy Storchaka 520b7ae27e
bpo-17611. Move unwinding of stack for "pseudo exceptions" from interpreter to compiler. (GH-5006)
Co-authored-by: Mark Shannon <mark@hotpy.org>
Co-authored-by: Antoine Pitrou <antoine@python.org>
2018-02-22 23:33:30 +02:00
Serhiy Storchaka 12e7cd8a51
bpo-32565: Add missed versionadded directives for all new opcodes. (#5199) 2018-02-01 13:48:33 +02:00
Mark Shannon 332cd5ee4f bpo-32550. Remove the STORE_ANNOTATION bytecode. (GH-5181) 2018-01-29 16:41:04 -08:00
Moses Koledoye 0c71653cb8 [Doc] Update opcode for var-positional arguments (#4446)
`BUILD_MAP_UNPACK_WITH_CALL` was duplicated as the opcode for both var-positional and var-keyword arguments. The opcode for the former was updated as `BUILD_TUPLE_UNPACK_WITH_CALL`.
2017-11-19 00:49:15 +02:00
Yury Selivanov 02e82a0596 bpo-31709: Update importlib magic (#3906) 2017-10-06 10:18:10 -04:00
syncosmic fe2b56ab92 bpo-31183: `dis` now handles coroutines & async generators (GH-3077)
Coroutines and async generators use a distinct attribute name for their
code objects, so this updates the `dis` module to correctly disassemble
objects with those attributes.

Due to the increase in the test module length, it also fixes some latent
defects in the tests related to how the displayed source line numbers
are extracted.

https://bugs.python.org/issue31230 is a follow-up issue suggesting we
may want to solve this a different way, by instead giving all these object
types a common `__code__` attribute, avoiding the need for special
casing in the `dis` module.
2017-08-18 12:29:21 +10:00
Serhiy Storchaka 1efbf92e90 bpo-11822: Improve disassembly to show embedded code objects. (#1844)
The depth argument limits recursion.
2017-06-11 14:09:39 +03:00
Ivan Levkivskyi 8f9e1bbf2d bpo-28810: Document remaining bytecode changes in 3.6 (GH-651) 2017-03-24 14:05:04 -07:00
Ivan Levkivskyi 4b2a2a425a bpo-28810: Document changes to CALL_FUNCTION opcodes (GH-250) 2017-03-10 14:52:35 -08:00
Ivan Levkivskyi 7e52c3e7ae bpo-28810: Document BUILD_TUPLE_UNPACK_WITH_CALL bytecode added in 3.6 (GH-239) 2017-03-10 14:16:44 -08:00
Ivan Levkivskyi 0705f66eb3 bpo-26213: Document _UNPACK bytecodes and BUILD_MAP changes (#238) 2017-03-03 13:46:39 -08:00
INADA Naoki 015bce64b3 Issue #26110: Add document for LOAD_METHOD and CALL_METHOD opcode.
Changed stack layout bit for "easy to explain."
2017-01-16 17:23:30 +09:00
Serhiy Storchaka 989db5c880 Issue #19795: Mark up None as literal text. 2016-10-19 16:37:13 +03:00
Serhiy Storchaka ecf41da83e Issue #19795: Mark up None as literal text. 2016-10-19 16:29:26 +03:00
Martin Panter b1321fba53 Issue #28394: More typo fixes for 3.6+ 2016-10-10 00:38:21 +00:00
Berker Peksag 34b74fffb3 Add missing versionadded directives 2016-09-12 08:00:01 +03:00
Yury Selivanov f8cb8a16a3 Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.
Patch by Ivan Levkivskyi.
2016-09-08 20:50:03 -07:00
Serhiy Storchaka ea525a2d1a Issue #27078: Added BUILD_STRING opcode. Optimized f-strings evaluation. 2016-09-06 22:07:53 +03:00
Serhiy Storchaka 64204de04c Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes.
Patch by Demur Rumed.
2016-06-12 17:36:24 +03:00
Serhiy Storchaka 6a7506a77f Issue #27140: Added BUILD_CONST_KEY_MAP opcode. 2016-06-12 00:39:41 +03:00
Serhiy Storchaka b0f80b0312 Issue #26647: Python interpreter now uses 16-bit wordcode instead of bytecode.
Patch by Demur Rumed.
2016-05-24 09:15:14 +03:00
Serhiy Storchaka 8b9eefc363 Issue #26733: Disassembling a class now disassembles class and static methods.
Patch by Xiang Zhang.
2016-04-23 09:24:29 +03:00
Serhiy Storchaka 585c93daea Issue #26733: Disassembling a class now disassembles class and static methods.
Patch by Xiang Zhang.
2016-04-23 09:23:52 +03:00
Martin Panter c86c91aab0 Merge typo fixes from 3.5 2016-04-05 06:20:32 +00:00
Martin Panter cc71a795df Fix typos in documentation and comments 2016-04-05 06:19:42 +00:00
Eric V. Smith a3a3d732ec For FORMAT_VALUE opcode, make it clear that the result of PyObject_Format is pushed on the stack. 2015-11-04 07:11:13 -05:00
Eric V. Smith 9ce52e3bda Issue 25483: Fix doc typo and added versionadded. Thanks, Berker Peksag. 2015-11-03 16:30:49 -05:00
Eric V. Smith 281d5321a3 Issue 25483: Update dis.rst with FORMAT_VALUE opcode description. 2015-11-03 13:09:01 -05:00
Antoine Pitrou 5e8d47f6ab Issue #16554: fix description for MAKE_CLOSURE. Initial patch by Daniel Urban. 2015-08-13 20:37:28 +02:00
Antoine Pitrou 4ce4f974da Issue #16554: fix description for MAKE_CLOSURE. Initial patch by Daniel Urban. 2015-08-13 20:37:08 +02:00
Yury Selivanov 66f8828bfc Issue #24439: Improve PEP 492 related docs.
Patch by Martin Panter.
2015-06-24 11:04:15 -04:00
Yury Selivanov 5376ba9630 Issue #24400: Introduce a distinct type for 'async def' coroutines.
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")
2015-06-22 12:19:30 -04:00
Benjamin Peterson 264be6f48f remove STORE_MAP, since it's unused 2015-05-28 14:40:08 -05:00
Yury Selivanov 7544508f02 PEP 0492 -- Coroutines with async and await syntax. Issue #24017. 2015-05-11 22:57:16 -04:00
Berker Peksag da0870c87a Add versionadded directives for the matmul operator. 2015-03-12 20:56:45 +02:00
Benjamin Peterson 2f3d440549 merge 3.4 (#23561) 2015-03-02 09:36:48 -05:00
Benjamin Peterson bdf525b77c wrap everything at 80 chars 2015-03-02 09:31:40 -05:00
Benjamin Peterson 29fec92875 link to the correct dis method or function (closes #23561) 2015-03-02 09:27:43 -05:00
Berker Peksag 6897e5688d Issue #20521: Change ``TOS`` to TOS in dis documentation.
TOS is an abbreviation of top-of-stack.

Patch by Sven Berkvens-Matthijsse.
2015-03-02 06:34:00 +02:00
Berker Peksag ab4040e3c6 Issue #20521: Change ``TOS`` to TOS in dis documentation.
TOS is an abbreviation of top-of-stack.

Patch by Sven Berkvens-Matthijsse.
2015-03-02 06:33:30 +02:00
Serhiy Storchaka f4f314ba3f Issue #22845: Improved formatting of dis documentation. 2014-11-11 10:02:46 +02:00
Serhiy Storchaka f751a9e6a2 Issue #22845: Improved formatting of dis documentation. 2014-11-11 10:02:11 +02:00
Nick Coghlan efd5df9e52 Issue #21947: handle generator-iterator objects in dis
Patch by Clement Rouault.
2014-07-25 23:02:56 +10:00
Benjamin Peterson d51374ed78 PEP 465: a dedicated infix operator for matrix multiplication (closes #21176) 2014-04-09 23:55:56 -04:00
R David Murray 0bce6e7462 whatsnew: expand 'dis' entry.
Also add one missing versionadded.
2014-01-07 14:30:17 -05:00