[issue40116] Regression in memory use of shared key dictionaries for "compact dicts"

2020-03-30 Thread Mark Shannon
Mark Shannon added the comment: Indeed it shouldn't. How is that relevant? -- ___ Python tracker <https://bugs.python.org/issue40116> ___ ___ Python-bugs-list m

[issue40116] Regression in memory use of shared key dictionaries for "compact dicts"

2020-03-30 Thread Mark Shannon
New submission from Mark Shannon : The current implementation of dicts prevents keys from being shared when the order of attribute differs from the first instance created. This can potentially use a considerably larger amount of memory than expected. Consider the class: class C: opt

[issue33608] Add a cross-interpreter-safe mechanism to indicate that an object may be destroyed.

2020-03-27 Thread Mark Shannon
Mark Shannon added the comment: Just to add my 2 cents. I think this a bad idea and is likely to be unsafe. Having interpreters interfering with each other's objects is almost certain to lead to race conditions. IMO, objects should *never* be shared across interpreters (once interpreters

[issue39511] [subinterpreters] Per-interpreter singletons (None, True, False, etc.)

2020-03-17 Thread Mark Shannon
Mark Shannon added the comment: Having two CPUs write to the same cache line is a well known performance problem. There's nothing special about CPython here. The proper name for it seems to be "cache line ping-pong", but a search for "false sharing" might

[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2020-03-17 Thread Mark Shannon
Mark Shannon added the comment: Even if `_PyRuntime` ends up as just a list of interpreters and doesn't disappear completely, it won't be used anything like as much as it is now. Many of the functions that it getting passed to will no longer need it, so why bother passing it now

[issue36710] Pass _PyRuntimeState as an argument rather than using the _PyRuntime global variable

2020-03-17 Thread Mark Shannon
Mark Shannon added the comment: Instead of passing `_PyRuntimeState` around everywhere, why not just let it disappear in time. Currently `_PyRuntimeState` manages "global" state, mainly the GIL and some config. Once the GIL has been migrated to the sub-interpreters, the confi

[issue39511] [subinterpreters] Per-interpreter singletons (None, True, False, etc.)

2020-03-17 Thread Mark Shannon
Mark Shannon added the comment: Consider the case where a thread that doesn't hold the GIL attempts to get a reference on `None`. The problem with having a single immortal `None`, is that it will cause data cache thrashing as two different CPUs modify the refcount on the shared `None

[issue39978] Vectorcall implementation should conform to PEP 590.

2020-03-16 Thread Mark Shannon
New submission from Mark Shannon : The implementation of `PyObject_Vectorcall` adds unnecessary overhead to PEP 590, which undermines its purpose. The implementation was changed in https://github.com/python/cpython/pull/17052, which I objected to at the time. The change has a negative impact

[issue38500] PEP 523: Add PyInterpreterState_SetEvalFrameFunc() to the public C API (Python 3.8 regression)

2020-03-12 Thread Mark Shannon
Mark Shannon added the comment: I'm not suggesting immediate removal of PEP 532. I am requesting that you don't add a new function to the C API that will prevent implementation of many meaningful optimizations to CPython. PEP 532 does not add any API functions. I understand that you want

[issue39537] Change line number table format

2020-02-21 Thread Mark Shannon
Mark Shannon added the comment: Serhiy, Although the code generator is syntax directed, not all code has an explicit piece of syntax attached. For example in the following code: ``` def foo(): if x: print("yes") else: print("no") ``` the compiler

[issue39537] Change line number table format

2020-02-06 Thread Mark Shannon
Mark Shannon added the comment: Serhiy, How would you handle bytecodes that have no line number? -- nosy: +Mark.Shannon ___ Python tracker <https://bugs.python.org/issue39

[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

2020-02-03 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +17706 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/18334 ___ Python tracker <https://bugs.python.org/issu

[issue39537] Change line number table format

2020-02-03 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +17699 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18326 ___ Python tracker <https://bugs.python.org/issu

[issue39537] Change line number table format

2020-02-03 Thread Mark Shannon
Change by Mark Shannon : -- nosy: +nedbat, pablogsal, skip.montanaro -Mark.Shannon ___ Python tracker <https://bugs.python.org/issue39537> ___ ___ Python-bug

[issue39537] Change line number table format

2020-02-03 Thread Mark Shannon
New submission from Mark Shannon : The current line number table format has two issues that need to be addressed. 1. There is no way to express that a bytecode does not have have a line number. The `END_ASYNC_FOR` bytecode, bytecodes for cleaning up the variable used to store exceptions

[issue39320] Handle unpacking of */** arguments and rvalues in the compiler

2020-01-27 Thread Mark Shannon
Mark Shannon added the comment: New changeset 8a4cd700a7426341c2074a2b580306d2d60ec839 by Mark Shannon in branch 'master': bpo-39320: Handle unpacking of **values in compiler (GH-18141) https://github.com/python/cpython/commit/8a4cd700a7426341c2074a2b580306d2d60ec839

[issue39320] Handle unpacking of */** arguments and rvalues in the compiler

2020-01-23 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +17527 pull_request: https://github.com/python/cpython/pull/18141 ___ Python tracker <https://bugs.python.org/issue39

[issue39320] Handle unpacking of */** arguments and rvalues in the compiler

2020-01-23 Thread Mark Shannon
Mark Shannon added the comment: New changeset 13bc13960cc83dbd1cb5701d9a59ac9b9144b205 by Mark Shannon in branch 'master': bpo-39320: Handle unpacking of *values in compiler (GH-17984) https://github.com/python/cpython/commit/13bc13960cc83dbd1cb5701d9a59ac9b9144b205

[issue39156] Break up COMPARE_OP into logically distinct operations.

2020-01-14 Thread Mark Shannon
Mark Shannon added the comment: New changeset 9af0e47b1705457bb6b327c197f2ec5737a1d8f6 by Mark Shannon in branch 'master': bpo-39156: Break up COMPARE_OP into four logically distinct opcodes. (GH-17754) https://github.com/python/cpython/commit/9af0e47b1705457bb6b327c197f2ec5737a1d8f6

[issue39156] Break up COMPARE_OP into logically distinct operations.

2020-01-14 Thread Mark Shannon
Change by Mark Shannon : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue39320] Handle unpacking of */** arguments and rvalues in the compiler

2020-01-13 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +17388 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17984 ___ Python tracker <https://bugs.python.org/issu

[issue39320] Handle unpacking of */** arguments and rvalues in the compiler

2020-01-13 Thread Mark Shannon
New submission from Mark Shannon : Currently the unpacking of starred values in arguments and the right hand side of assignments is handled in the interpreter without any help from the compiler. The layout of arguments and values is visible to the compiler, so the compiler should do more

[issue39166] Python 3.9.0a2 changed how "async for" traces its final iteration

2020-01-10 Thread Mark Shannon
Mark Shannon added the comment: I think this is now fixed. Ned, feel free to reopen if it still isn't fixed. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue39166] Python 3.9.0a2 changed how "async for" traces its final iteration

2020-01-10 Thread Mark Shannon
Mark Shannon added the comment: New changeset 4c53e63cc966f98e141a09bc435b9f9c713b152d by Mark Shannon (Pablo Galindo) in branch 'master': bpo-39166: Fix trace of last iteration of async for loops (#17800) https://github.com/python/cpython/commit/4c53e63cc966f98e141a09bc435b9f9c713b152d

[issue39166] Python 3.9.0a2 changed how "async for" traces its final iteration

2020-01-01 Thread Mark Shannon
Mark Shannon added the comment: Ned, can you confirm that the trace has changed from 3.8 to 3.9? The bytecode for `doit_async` is identical for 3.8 and 3.9. -- ___ Python tracker <https://bugs.python.org/issue39

[issue39114] Python 3.9.0a2 changed how finally/return is traced

2019-12-30 Thread Mark Shannon
Mark Shannon added the comment: Ned, I think this is fixed. Feel free to re-open if you disagree. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue33387] Simplify bytecodes for try-finally, try-except and with blocks.

2019-12-30 Thread Mark Shannon
Change by Mark Shannon : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue39156] Break up COMPARE_OP into logically distinct operations.

2019-12-30 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +17190 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17754 ___ Python tracker <https://bugs.python.org/issu

[issue39156] Break up COMPARE_OP into logically distinct operations.

2019-12-30 Thread Mark Shannon
Mark Shannon added the comment: Moving work from the interpreter to the compiler is always a good idea. Performance: The compiler is run once per code unit, the interpreter thousands or millions of times. The compiler is easier to test. Just match the expected bytecode with the actual

[issue39156] Break up COMPARE_OP into logically distinct operations.

2019-12-29 Thread Mark Shannon
New submission from Mark Shannon : Currently the COMPARE_OP instruction performs one of four different tasks. We should break it up into four different instructions, that each performs only one of those tasks. The four tasks are: Rich comparison (>, <, ==, !=, >=, <=) Identit

[issue39114] Python 3.9.0a2 changed how finally/return is traced

2019-12-29 Thread Mark Shannon
Mark Shannon added the comment: With PR 17737 the bytecode is: 2 0 SETUP_FINALLY 16 (to 18) 3 2 POP_BLOCK 5 4 LOAD_GLOBAL 0 (a) 6 LOAD_METHOD 1 (append) 8 LOAD_CONST 1 (16

[issue39114] Python 3.9.0a2 changed how finally/return is traced

2019-12-29 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +17180 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17737 ___ Python tracker <https://bugs.python.org/issu

[issue39114] Python 3.9.0a2 changed how finally/return is traced

2019-12-29 Thread Mark Shannon
Mark Shannon added the comment: Exammining the bytecode for: def finally_return(): try: return 14 finally: a.append(16) We have: 2 0 SETUP_FINALLY 16 (to 18) 3 2 POP_BLOCK 5 4 LOAD_GLOBAL 0

[issue39151] Simplify the deep-first-search of the assembler

2019-12-29 Thread Mark Shannon
Mark Shannon added the comment: This seems correct, but your change assumes that there is no optimisation pass that reorders the blocks. While the is currently true, it might not be in future. The code that orders blocks for output should not make assumptions about the shape of the CFG, IMO

[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-21 Thread Mark Shannon
Mark Shannon added the comment: Fabio, Can you give me a specific example where changing the bytecode via the `__code__` attribute of a function does not work as expected? I am assuming that adding a breakpoint on a line is equivalent to adding `breakpoint();` at the beginning of that line

[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-21 Thread Mark Shannon
Mark Shannon added the comment: Brett, PEP 523 makes no mention of adding a getter or setter. Adding them is a big change to Python semantics and shouldn't, IMO, be done without a PEP that explicit states they are going to be added. -- ___ Python

[issue33387] Simplify bytecodes for try-finally, try-except and with blocks.

2019-11-21 Thread Mark Shannon
Mark Shannon added the comment: New changeset 82f897bf8f72d09f537054d64a94e645ad23d8d6 by Mark Shannon in branch 'master': Correct release version to 3.9 for RERAISE and WITH_EXCEPT_START bytecodes. (#17318) https://github.com/python/cpython/commit/82f897bf8f72d09f537054d64a94e645ad23d8d6

[issue33387] Simplify bytecodes for try-finally, try-except and with blocks.

2019-11-21 Thread Mark Shannon
Mark Shannon added the comment: Thanks for noticing. https://github.com/python/cpython/pull/17318 -- ___ Python tracker <https://bugs.python.org/issue33

[issue33387] Simplify bytecodes for try-finally, try-except and with blocks.

2019-11-21 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +16805 pull_request: https://github.com/python/cpython/pull/17318 ___ Python tracker <https://bugs.python.org/issue33

[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-11 Thread Mark Shannon
Mark Shannon added the comment: Fabio, If the user changes the `__code__` attribute of a function then, AFAICT, your debugger does the wrong thing, but bytecode modification does the right thing. Suppose we have two functions `spam` and `eggs`. Set a break point in `eggs`, set `spam

[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-08 Thread Mark Shannon
Mark Shannon added the comment: It sounds to me like `PyInterpreterState.eval_frame` is being used to lazily modify the bytecode to support breakpoints. I can see no reason why changing the bytecode can't be done via `function.__code__`. Suppose the code-object with the breakpoint add

[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-07 Thread Mark Shannon
Mark Shannon added the comment: Victor, I don't think this is a regression. `PyThreadState` is an internal opaque data structure, which means we are free to change it. That the `eval_frame` is hard to access is a feature not a bug, as it discourages misuse and enables us to remove it easily

[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-04 Thread Mark Shannon
Mark Shannon added the comment: Fabio, OOI what are you trying achieve by changing the frame evaluator? -- ___ Python tracker <https://bugs.python.org/issue38

[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-04 Thread Mark Shannon
Mark Shannon added the comment: I'm strongly opposed to this change. PEP 523 does not specify what the semantics of changing the interpreter frame evaluator actually is: Is the VM obliged to call the new interpreter? What happens if the custom evaluator leaves the VM in a inconsistent state

[issue26219] implement per-opcode cache in ceval

2019-10-07 Thread Mark Shannon
Mark Shannon added the comment: Given that def foo(): int; str; bytes; float; int; str; bytes; float can be trivially be rewritten as def foo(): pass I think that benchmark is meaningless. I really don't think we should be making claims like "40% speedup" for such contrive

[issue26219] implement per-opcode cache in ceval

2019-10-07 Thread Mark Shannon
Mark Shannon added the comment: "What's new in Python 3.8" says that this change speeds up the LOAD_GLOBAL opcode by 40%. That seems meaningless as a program cannot have LOAD_GLOBAL in isolation so any test would have other bytecodes as well. What's the evidence for the claim

[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

2019-09-12 Thread Mark Shannon
Mark Shannon added the comment: I expect to fix this is as part of the general improvements I am making to the bytecode, interpreter and compiler. So it should be fixed for 3.9 but not for 3.8 -- ___ Python tracker <https://bugs.python.

[issue38135] Depth first search in compile.c creates wrong BB order for certain CFG.

2019-09-12 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +15664 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16042 ___ Python tracker <https://bugs.python.org/issu

[issue38135] Depth first search in compile.c creates wrong BB order for certain CFG.

2019-09-12 Thread Mark Shannon
Change by Mark Shannon : -- nosy: +pablogsal ___ Python tracker <https://bugs.python.org/issue38135> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38135] Depth first search in compile.c creates wrong BB order for certain CFG.

2019-09-12 Thread Mark Shannon
New submission from Mark Shannon : Consider a flow graph of four nodes, A, B, C, D where the A, B, C are "next" successors of each other (in order) and C branches to B and B branches to D. Note that there is no "next" link to the D block. The correct order is A, B, C, D bu

[issue21120] PyArena type is used in headers from the limited API

2019-09-12 Thread Mark Shannon
Change by Mark Shannon : -- status: open -> closed ___ Python tracker <https://bugs.python.org/issue21120> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue21120] PyArena type is used in headers from the limited API

2019-09-12 Thread Mark Shannon
Change by Mark Shannon : -- stage: patch review -> resolved ___ Python tracker <https://bugs.python.org/issue21120> ___ ___ Python-bugs-list mailing list Un

[issue21120] PyArena type is used in headers from the limited API

2019-09-12 Thread Mark Shannon
Mark Shannon added the comment: New changeset 421a72af4deaec96a49a79951b9c2546a2faa13d by Mark Shannon (Zackery Spytz) in branch 'master': bpo-21120: Exclude Python-ast.h, ast.h and asdl.h from the limited API (#14634) https://github.com/python/cpython/commit

[issue21120] PyArena type is used in headers from the limited API

2019-09-09 Thread Mark Shannon
Mark Shannon added the comment: This seems like the correct thing to do. Since the AST changes from version to version, I don't see how these files could reasonably be part of the limited API. -- nosy: +Mark.Shannon ___ Python tracker <ht

[issue37562] PEP 590 implementation may have introduced a performance regression

2019-07-13 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +14529 stage: -> patch review pull_request: https://github.com/python/cpython/pull/14735 ___ Python tracker <https://bugs.python.org/issu

[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2019-06-09 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +13796 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13930 ___ Python tracker <https://bugs.python.org/issu

[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2019-06-09 Thread Mark Shannon
New submission from Mark Shannon : PEP 590 allows us the short circuit the __new__, __init__ slow path for commonly created builtin types. As an initial step, we can speed up calls to range, list and dict by about 30%. See https://gist.github.com/markshannon/5cef3a74369391f6ef937d52cca9bfc8

[issue27639] UserList.__getitem__ doesn't account for slices

2019-05-26 Thread Mark Shannon
Mark Shannon added the comment: New changeset f3d909428c7c61ea32e8fbb9c8b48344e7904a53 by Mark Shannon (Michael Blahay) in branch '3.7': BPO-27639: Correct return type for UserList slicing operation (#13203) https://github.com/python/cpython/commit/f3d909428c7c61ea32e8fbb9c8b48344e7904a53

[issue28866] Type cache is not correctly invalidated on a class defining mro()

2019-05-26 Thread Mark Shannon
Mark Shannon added the comment: New changeset 180dc1b0f4a57c3f66351568ae8488fa8576d7f0 by Mark Shannon (Julien Palard) in branch 'master': bpo-28866: No type cache for types with specialized mro, invalidation is hard. (#13157) https://github.com/python/cpython/commit

[issue25217] Method cache can crash at shutdown in _PyType_Lookup

2019-05-08 Thread Mark Shannon
Mark Shannon added the comment: Do you have a reproducible way to cause this crash? -- ___ Python tracker <https://bugs.python.org/issue25217> ___ ___ Python-bug

[issue27639] UserList.__getitem__ doesn't account for slices

2019-05-07 Thread Mark Shannon
Mark Shannon added the comment: New changeset b1c3167c232c36ed3543ca351ff10c613639b5f5 by Mark Shannon (Michael Blahay) in branch 'master': bpo-27639: Correct return type for UserList slicing operation (#13169) https://github.com/python/cpython/commit/b1c3167c232c36ed3543ca351ff10c613639b5f5

[issue34408] possible null pointer dereference in pystate.c

2019-05-07 Thread Mark Shannon
Mark Shannon added the comment: Any reason not to close this issue? -- nosy: +Mark.Shannon ___ Python tracker <https://bugs.python.org/issue34408> ___ ___ Pytho

[issue33153] interpreter crash when multiplying large tuples

2019-05-07 Thread Mark Shannon
Mark Shannon added the comment: I can't reproduce on 2.7.15rc1 on an x64 machine. Can you confirm that this is still an issue? -- nosy: +Mark.Shannon ___ Python tracker <https://bugs.python.org/issue33

[issue35354] Generator functions stack overflow

2019-05-07 Thread Mark Shannon
Mark Shannon added the comment: I'm closing this as a duplicate of https://bugs.python.org/issue6028 Making a recursive call in an except block cannot be handled sensibly by the interpreter. On exceeding the stack depth, the interpreter will raise a RecursionError. Catching

[issue28866] Type cache is not correctly invalidated on a class defining mro()

2019-05-06 Thread Mark Shannon
Mark Shannon added the comment: This failure appears to be a symptom of recursively traversing __bases__ rather scanning __mro__ in the implementation of type.__subclasses__ The MCACHE depends on type.__subclasses__ being correct and it is not correct for weird.py python -i weird.py >&

[issue30040] new empty dict can be more small

2019-03-12 Thread Mark Shannon
Mark Shannon added the comment: Serhiy, for {'a': None} the dict is created using _PyDict_NewPresized() so this makes no difference. -- ___ Python tracker <https://bugs.python.org/issue30

[issue30040] new empty dict can be more small

2019-03-12 Thread Mark Shannon
Mark Shannon added the comment: In general, I agree with Raymond that this is likely to counter-productive. But let's not guess, let's measure :) I expect that there are few live empty dicts at any time for most programs. In which case there is no point in any change that attempts to save

[issue34705] Python 3.8 changes how returns through finally clauses are traced

2018-09-24 Thread Mark Shannon
Mark Shannon added the comment: When I get a chance I'll see what happens with https://github.com/python/cpython/pull/6641 -- ___ Python tracker <https://bugs.python.org/issue34

[issue34705] Python 3.8 changes how returns through finally clauses are traced

2018-09-24 Thread Mark Shannon
Mark Shannon added the comment: The new behaviour looks the more correct to me. Arguably the sequence should not include the second "4 line", but is otherwise correct. -- ___ Python tracker <https://bugs.python.o

[issue33996] Crash in gen_send_ex(): _PyErr_GetTopmostException() returns freed memory

2018-07-01 Thread Mark Shannon
Mark Shannon added the comment: This looks like a Greenlet bug to me. Possibly https://github.com/python-greenlet/greenlet/commit/780a12b51fcef9adcc4f2c9a4cc5b05c2d652ba4 is incomplete. It is not clear to me why greenlets hold their own exception state, but I suspect that if they didn't

[issue33996] Crash in gen_send_ex(): _PyErr_GetTopmostException() returns freed memory

2018-07-01 Thread Mark Shannon
Mark Shannon added the comment: Strange. I could only reproduce this intermittently with 3.7 build. But with a debug build, I cannot reproduce this at all. Rebuilding Python (optimised, but without PGO) I cannot reproduce at all now. -- ___ Python

[issue33525] os.spawnvpe() returns error code 127 instead of raising when env argument is invalid.

2018-05-15 Thread Mark Shannon
New submission from Mark Shannon <m...@hotpy.org>: >>> os.spawnvpe(os.P_WAIT, "python2", ["python2", "-c", "print 'Hello >>> World!'"], {}) Hello World! 0 >>> os.spawnvpe(os.P_WAIT, "python2", ["pytho

[issue31802] 'import posixpath' fails if 'os.path' has not be imported already.

2018-04-30 Thread Mark Shannon
Change by Mark Shannon <m...@hotpy.org>: -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <https://bu

[issue33318] Move folding tuples of constants into compiler.c from peephole.c

2018-04-29 Thread Mark Shannon
Change by Mark Shannon <m...@hotpy.org>: -- pull_requests: -6338 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33318> ___ _

[issue33318] Move folding tuples of constants into compiler.c from peephole.c

2018-04-29 Thread Mark Shannon
Change by Mark Shannon <m...@hotpy.org>: -- pull_requests: +6338 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33318> ___ __

[issue33387] Simplify bytecodes for try-finally, try-except and with blocks.

2018-04-29 Thread Mark Shannon
Change by Mark Shannon <m...@hotpy.org>: -- keywords: +patch pull_requests: +6337 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33387] Simplify bytecodes for try-finally, try-except and with blocks.

2018-04-29 Thread Mark Shannon
Change by Mark Shannon <m...@hotpy.org>: -- Removed message: https://bugs.python.org/msg315906 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33387] Simplify bytecodes for try-finally, try-except and with blocks.

2018-04-29 Thread Mark Shannon
New submission from Mark Shannon <m...@hotpy.org>: The six complex bytecodes currently used for implementing 'with' and 'try' statements can be replaced with just two simpler bytecodes. The six bytecodes are WITH_CLEANUP_START, WITH_CLEANUP_FINISH, BEGIN_FINALLY, END_FINALLY, CALL_F

[issue33387] Simplify bytecodes for try-finally, try-except and with blocks.

2018-04-29 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: The six complex bytecodes currently used for implementing 'with' and 'try' statements can be replaced with just two simpler bytecodes. The six bytecodes are WITH_CLEANUP_START, WITH_CLEANUP_FINISH, BEGIN_FINALLY, END_FINALLY, CALL_F

[issue33325] Optimize sequences of constants in the compiler

2018-04-22 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: There seems to be an implicit assumption here that fewer bytecodes is better. But that isn't always the case. Do you have evidence that the sequence 0 LOAD_CONST 5 ((('a', 'b', 'c'), 3, 2, 1)) 2 UNPACK_SEQUENCE

[issue32949] Simplify "with"-related opcodes

2018-03-18 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: It is fiddly to get the frame-setlineno code right for duplicated catch blocks, but it is far from impossible. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue32949] Simplify "with"-related opcodes

2018-03-18 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: I intend to reuse RERAISE to implement the exceptional case for a finally block. Something like: SETUP_FINALLY final body finalbody JUMP exit final: finalbody RERAIS

[issue32949] Simplify "with"-related opcodes

2018-03-17 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: We have two competing PRs for this issue. Again. For comparison, using the same micro-benchmark, PR 5112 has these timings: Master branch: Mean +- std dev: 252 ns +- 4 ns PR 5112: Mean +- std dev: 216 ns +

[issue33092] The bytecode for f-string formatting is inefficient.

2018-03-17 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: Even if doesn't speed things up by a significant amount, I would suggest that a simper interpreter with smaller, simpler bytecodes is a worthy goal in itself. -- ___ Python tracke

[issue33092] The bytecode for f-string formatting is inefficient.

2018-03-17 Thread Mark Shannon
Change by Mark Shannon <m...@hotpy.org>: -- keywords: +patch pull_requests: +5893 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33092] The bytecode for f-string formatting is inefficient.

2018-03-17 Thread Mark Shannon
New submission from Mark Shannon <m...@hotpy.org>: f-string expressions can be formatted in four ways: with or without a conversion and with or without a format specifier Rather than have one bytecode that parses the opcode argument at runtime it would be more efficient and p

[issue32911] Doc strings no longer stored in body of AST

2018-03-17 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: I still think that option 2 would be best, but given that it is late in the release cycle, I will accept the status quo. A couple of comments for the record: Constant folding occurs after AST creation, so doesn't make the AST worse. The

[issue33072] The interpreter bytecodes for with statements are overly complex.

2018-03-13 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: So you did. Sorry for the duplication -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33072] The interpreter bytecodes for with statements are overly complex.

2018-03-13 Thread Mark Shannon
Change by Mark Shannon <m...@hotpy.org>: -- keywords: +patch pull_requests: +5871 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33072] The interpreter bytecodes for with statements are overly complex.

2018-03-13 Thread Mark Shannon
New submission from Mark Shannon <m...@hotpy.org>: The bytecodes WITH_CLEANUP_START and WITH_CLEANUP_FINISH are complex and implement entirely different behavior depending on what is on the stack. This is unnecessary as the same semantics can be implemented with much simpler byt

[issue13897] Move fields relevant to sys.exc_info out of frame into generator/threadstate

2018-02-26 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: Nothing left to do. This is now obsolete. -- resolution: -> out of date stage: patch review -> resolved status: pending -> open ___ Python tracker <rep...@bugs.python.org> <

[issue32911] Doc strings omitted from AST

2018-02-23 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: Serhiy, thanks for reopening this issue. It seems to be that there are three reasonable choices: 1. Revert to 3.6 behaviour, with the addition of `docstring` attribute. 2. Change the docstring attribute to an AST node, possibly by mod

[issue32911] Doc strings omitted from AST

2018-02-22 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: Stating that "this is a feature not a bug" does not make it so. This breaks existing code and reduces the capabilities of the `ast` module. For example, how does one get the location of the docstring now? >From a syntactic poi

[issue32911] Doc strings omitted from AST

2018-02-22 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: That issue has to do with bytecode generation, not the AST. The AST should be an accurate representation of the Python source code. Making a better representation of the source would be fine, but this makes it worse. Doc-strin

[issue32911] Doc strings omitted from AST

2018-02-22 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: This is an unnecessary and breaking change. Changes like this should not be made unless necessary to fix a bug. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue32911] Doc strings omitted from AST

2018-02-22 Thread Mark Shannon
New submission from Mark Shannon <m...@hotpy.org>: Python 3.7.0b1+ (heads/3.7:dfa1144, Feb 22 2018, 12:10:59) >>> m = ast.parse("def foo():\n 'help'") >>> m.body[0].body [] Correct behaviour (3.6 or earlier) >>> m = ast.parse("def foo():\n

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: Rebased, pushed and CI is green. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-29 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: If it can wait another hour, I will be at home and can do the rebase then. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: Works as expected: >>> class C: ... exec('x: int') ... >>> C.__annotations__ {'x': } >>> __annotations__ {} -- ___ Python tracker <rep...@bugs.python.org&

[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.

2018-01-14 Thread Mark Shannon
Mark Shannon <m...@hotpy.org> added the comment: > 3. It doesn't add a name constant. Instead it uses a name from the names list > (which already has to contain this name). This PR moves the constant for the name from `co_names` to `co_consts`. There is no duplicatio

<    5   6   7   8   9   10   11   12   >