[issue40222] "Zero cost" exception handling

2021-04-30 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +24440 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25729 ___ Python tracker <https://bugs.python.org/issu

[issue43977] Implement the latest semantics for PEP 634 for matching collections

2021-04-30 Thread Mark Shannon
Mark Shannon added the comment: New changeset 069e81ab3da46c441335ca762c4333b7bd91861d by Mark Shannon in branch 'master': bpo-43977: Use tp_flags for collection matching (GH-25723) https://github.com/python/cpython/commit/069e81ab3da46c441335ca762c4333b7bd91861d

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-29 Thread Mark Shannon
Mark Shannon added the comment: New changeset 088a15c49d99ecb4c3bef93f8f40dd513c6cae3b by Mark Shannon in branch 'master': bpo-43933: Show frame.f_lineno as None, rather than -1, if there is no line number. (GH-25717) https://github.com/python/cpython/commit

[issue43977] Implement the latest semantics for PEP 634 for matching collections

2021-04-29 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +24415 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25723 ___ Python tracker <https://bugs.python.org/issu

[issue43977] Implement the latest semantics for PEP 634 for matching collections

2021-04-29 Thread Mark Shannon
New submission from Mark Shannon : PEP 634 has been updated to allow a faster and more robust implementation of matching sequences and mappings: https://github.com/python/peps/pull/1937 It needs to be implemented. -- assignee: Mark.Shannon messages: 392330 nosy: Mark.Shannon priority

[issue40222] "Zero cost" exception handling

2021-04-29 Thread Mark Shannon
Mark Shannon added the comment: I've played around with a few formats, and what I've ended up with is this: 1. Use the >> marker for for exception targets, as well as normal branch targets. 2. Add a text version of the exception handler table at the end of the disassembly. This h

[issue40222] "Zero cost" exception handling

2021-04-29 Thread Mark Shannon
Mark Shannon added the comment: Responding to Serhiy's suggestions: 1 Add another column: Adding another column makes for lots of repetition in larger try blocks, and pushes useful information further to the right. 2 Add pseudo-instructions I find those misleading, as they aren't really

[issue40222] "Zero cost" exception handling

2021-04-29 Thread Mark Shannon
Mark Shannon added the comment: > BTW, what are the three POP_TOP op codes in a row popping? When exceptions are pushed to the stack, they are pushed as a triple: (exc, type, traceback) so when we pop them, we need three pops. -- ___ Pyt

[issue42739] Crash when try to disassemble bogus code object

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

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-29 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +24410 pull_request: https://github.com/python/cpython/pull/25719 ___ Python tracker <https://bugs.python.org/issue43

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-29 Thread Mark Shannon
Mark Shannon added the comment: I'm going to set the line number for executing the `__exit__()` function as that of the `with` keyword. This should give a sensible traceback, and not break coverage, as the with statement is already executed. It will impact traces and profiles, which is why

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-29 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +24408 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25717 ___ Python tracker <https://bugs.python.org/issu

[issue42739] Crash when try to disassemble bogus code object

2021-04-29 Thread Mark Shannon
Mark Shannon added the comment: New changeset c76da79b37d2bcbe575cc927ba0a9b7a9ce465db by Mark Shannon in branch 'master': bpo-42739: Don't use sentinels to mark end of line table. (GH-25657) https://github.com/python/cpython/commit/c76da79b37d2bcbe575cc927ba0a9b7a9ce465db

[issue43950] Include column offsets for bytecode instructions

2021-04-27 Thread Mark Shannon
Mark Shannon added the comment: The additional cost will not only be the line number table, but we need to store the line for exceptions that are reraised after cleanup. Adding a column will mean more stack consumption. -- ___ Python tracker

[issue42739] Crash when try to disassemble bogus code object

2021-04-27 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +24348 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25657 ___ Python tracker <https://bugs.python.org/issu

[issue42739] Crash when try to disassemble bogus code object

2021-04-27 Thread Mark Shannon
Mark Shannon added the comment: Using sentinels as a marker to terminate the line number table, might be a problem if we want to use a different format. So I'm fixing this for 3.10. -- ___ Python tracker <https://bugs.python.org/issue42

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-26 Thread Mark Shannon
Mark Shannon added the comment: This test case was added for 3.10. In 3.9 it reports that the pass statement executes, even though it is unreachable. https://github.com/python/cpython/blob/master/Lib/test/test_sys_settrace.py#L919 -- ___ Python

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-26 Thread Mark Shannon
Mark Shannon added the comment: In this case, if happens that line 10 was the last line of code executing in the body of the with statement. But the reason it was listed, was that it was statically the last line of code in the body. If the body is something like: 1. if TRUE: 2. ... 3

[issue43933] Regression in python3.10 with traceback frame having lineno of -1

2021-04-26 Thread Mark Shannon
Mark Shannon added the comment: What exactly is the issue here? That the line number is -1, or that is different from 3.9? The `-1` should be `None`. I can fix that, but there is the issue of whether the cleanup code in a with statement should have a line number or not. The traceback

[issue43908] array.array should remain immutable

2021-04-22 Thread Mark Shannon
Mark Shannon added the comment: Adding an extra flag seems like the sensible thing to do for 3.10 Longer term, we should decouple immutability from whether something is a heap type. I don't know why we would care that it is a heap type at all. Which bit of memory it happens to sit in seems

[issue40222] "Zero cost" exception handling

2021-04-21 Thread Mark Shannon
Mark Shannon added the comment: The changes to pyc format aren't user visible so shouldn't matter, but what about the dis output? Consider this program: def f(): try: 1/0 except: return "fail" Currently it compiles to: 2 0 SETUP_FINALLY

[issue43846] Control stack usage in large expressions

2021-04-21 Thread Mark Shannon
Mark Shannon added the comment: I've not measured performance, as the sort of large literals it would impact are very rare, and the sort of calls it would change are almost non-existent. I'd be surprised if any performance difference could be reliably detected with our current performance

[issue43846] Control stack usage in large expressions

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

[issue43846] Control stack usage in large expressions

2021-04-15 Thread Mark Shannon
Mark Shannon added the comment: New changeset 11e0b295dee235dd6fd66a10d4823b0dcb014dc4 by Mark Shannon in branch 'master': bpo-43846: Use less stack for large literals and calls (GH-25403) https://github.com/python/cpython/commit/11e0b295dee235dd6fd66a10d4823b0dcb014dc4

[issue43846] Control stack usage in large expressions

2021-04-14 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +24136 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/25403 ___ Python tracker <https://bugs.python.org/issu

[issue43846] Control stack usage in large expressions

2021-04-14 Thread Mark Shannon
Change by Mark Shannon : -- nosy: +pablogsal ___ Python tracker <https://bugs.python.org/issue43846> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43846] Control stack usage in large expressions

2021-04-14 Thread Mark Shannon
New submission from Mark Shannon : Large literals or function calls with many arguments can consume a lot of stack space. This will be a problem for any future work to use a contiguous stack for data and possibly eliminate frame objects for most calls. It is also possible (I haven't

[issue43760] The DISPATCH() macro is not as efficient as it could be.

2021-04-13 Thread Mark Shannon
Mark Shannon added the comment: New changeset 9e7b2076fb4380987ad0262c4c0ca900b06475ad by Mark Shannon in branch 'master': bpo-43760: Speed up check for tracing in interpreter dispatch (#25276) https://github.com/python/cpython/commit/9e7b2076fb4380987ad0262c4c0ca900b06475ad

[issue43682] Make static methods created by @staticmethod callable

2021-04-12 Thread Mark Shannon
Mark Shannon added the comment: Are you asking why breaking backwards compatibility is an issue? Or how it breaks backwards compatibility? pydoc could be changed to produce the proposed output, it doesn't need this change. We don't know what this change will break, but we do know

[issue43682] Make static methods created by @staticmethod callable

2021-04-12 Thread Mark Shannon
Mark Shannon added the comment: This is a significant change to the language. There should be a PEP, or at the very least a discussion on Python Dev. There may well be a very good reason why static methods have not been made callable before that you have overlooked. Changing static methods

[issue43760] The DISPATCH() macro is not as efficient as it could be.

2021-04-08 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +24013 pull_request: https://github.com/python/cpython/pull/25276 ___ Python tracker <https://bugs.python.org/issue43

[issue43760] The DISPATCH() macro is not as efficient as it could be.

2021-04-08 Thread Mark Shannon
Mark Shannon added the comment: New changeset 28d28e053db6b69d91c2dfd579207cd8ccbc39e7 by Mark Shannon in branch 'master': bpo-43760: Streamline dispatch sequence for machines without computed gotos. (GH-25244) https://github.com/python/cpython/commit

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-04-07 Thread Mark Shannon
Mark Shannon added the comment: I implemented it ages ago :) https://github.com/python/cpython/pull/24417 I need to be better at closing issues. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Pytho

[issue43495] Missing frame block push in compiler_async_comprehension_generator()

2021-04-07 Thread Mark Shannon
Mark Shannon added the comment: New changeset 7a7ba3d343d360a03a34bc3901628f9f40a58307 by tomKPZ in branch 'master': bpo-43495 : Push missing frame block in compile.c (GH-24865) https://github.com/python/cpython/commit/7a7ba3d343d360a03a34bc3901628f9f40a58307 -- nosy: +Mark.Shannon

[issue43760] The DISPATCH() macro is not as efficient as it could be.

2021-04-07 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +23984 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25244 ___ Python tracker <https://bugs.python.org/issu

[issue43760] The DISPATCH() macro is not as efficient as it could be.

2021-04-07 Thread Mark Shannon
New submission from Mark Shannon : The DISPATCH() macro has two failings. 1. Its check for tracing involves too much pointer chaser. 2. The logic assumes that computed-gotos is the "fast path" which makes switch dispatch, and therefore Python on Windows unnecess

[issue39537] Change line number table format

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

[issue39537] Change line number table format

2021-04-07 Thread Mark Shannon
Mark Shannon added the comment: PEP 626 fixed this -- ___ Python tracker <https://bugs.python.org/issue39537> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40228] Make setting line number in frame more robust.

2021-04-07 Thread Mark Shannon
Change by Mark Shannon : -- resolution: -> fixed status: open -> closed ___ Python tracker <https://bugs.python.org/issue40228> ___ ___ Python-bugs-list

[issue43753] [C API] Add Py_Is(x, y) and Py_IsNone(x) functions

2021-04-07 Thread Mark Shannon
Mark Shannon added the comment: For any sane design of tagged pointers, `x == y` (in C) will work fine. `is` is not well defined except for a small set of values, so the docs for `Py_Is` would have to so vague as to be worthless, IMO. -- nosy: +Mark.Shannon

[issue43683] Handle generator (and coroutine) state in the bytecode.

2021-04-06 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +23961 pull_request: https://github.com/python/cpython/pull/25224 ___ Python tracker <https://bugs.python.org/issue43

[issue43683] Handle generator (and coroutine) state in the bytecode.

2021-04-06 Thread Mark Shannon
Mark Shannon added the comment: New changeset b37181e69209746adc2119c471599a1ea5faa6c8 by Mark Shannon in branch 'master': bpo-43683: Handle generator entry in bytecode (GH-25138) https://github.com/python/cpython/commit/b37181e69209746adc2119c471599a1ea5faa6c8

[issue27129] Wordcode, part 2

2021-04-04 Thread Mark Shannon
Mark Shannon added the comment: New changeset c368ce74d2c9bcbf1ec320466819c2d4768252f7 by Dennis Sweeney in branch 'master': bpo-27129: Update magic numbers and bootstrapping for GH-25069 (GH-25172) https://github.com/python/cpython/commit/c368ce74d2c9bcbf1ec320466819c2d4768252f7

[issue43710] Access violations in C extension modules on Python 3.9.3

2021-04-03 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +23907 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25160 ___ Python tracker <https://bugs.python.org/issu

[issue43693] Logically merge cell and locals array. They are already contiguous in memory

2021-04-02 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +23899 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/25152 ___ Python tracker <https://bugs.python.org/issu

[issue27129] Wordcode, part 2

2021-04-01 Thread Mark Shannon
Mark Shannon added the comment: That assertion is correct, and hasn't changed. Do you have a traceback? The buildbot just shows the assertion message with no context. -- ___ Python tracker <https://bugs.python.org/issue27

[issue43683] Handle generator (and coroutine) state in the bytecode.

2021-04-01 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +23885 pull_request: https://github.com/python/cpython/pull/25138 ___ Python tracker <https://bugs.python.org/issue43

[issue27129] Wordcode, part 2

2021-04-01 Thread Mark Shannon
Mark Shannon added the comment: New changeset fcb55c0037baab6f98f91ee38ce84b6f874f034a by Mark Shannon in branch 'master': bpo-27129: Use instruction offsets, not byte offsets, in bytecode and internally. (GH-25069) https://github.com/python/cpython/commit

[issue43693] Logically merge cell and locals array. They are already contiguous in memory

2021-04-01 Thread Mark Shannon
New submission from Mark Shannon : In the interpreter and compiler, the "fast" locals array and cells array are treated separately. By merging them in the compiler, the interpreter can be simplified a bit. -- assignee: Mark.Shannon components: Interpreter Core messages: 3

[issue43683] Handle generator (and coroutine) state in the bytecode.

2021-04-01 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +23884 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/25137 ___ Python tracker <https://bugs.python.org/issu

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

2021-03-31 Thread Mark Shannon
Mark Shannon added the comment: The bytecode instruction set has changed a lot since 3.6, so I think a backport would be impractical. 3.6 is in security fix only mode, so you'd need to take this up with Red Hat. -- ___ Python tracker <ht

[issue43683] Handle generator (and coroutine) state in the bytecode.

2021-03-31 Thread Mark Shannon
Change by Mark Shannon : -- assignee: -> Mark.Shannon stage: -> needs patch type: -> performance ___ Python tracker <https://bugs.python.or

[issue42823] Incorrect frame.f_lineno when frame.f_trace is set

2021-03-31 Thread Mark Shannon
Mark Shannon added the comment: Ned, can I close this? -- ___ Python tracker <https://bugs.python.org/issue42823> ___ ___ Python-bugs-list mailing list Unsub

[issue43683] Handle generator (and coroutine) state in the bytecode.

2021-03-31 Thread Mark Shannon
New submission from Mark Shannon : Every time we send, or throw, to a generator, the C code in genobject.c needs to check what state the generator is in. This is inefficient and couples the generator code, which should just be a thin wrapper around the interpreter, to the internals

[issue43682] Make static methods created by @staticmethod callable

2021-03-31 Thread Mark Shannon
Mark Shannon added the comment: Isn't the problem that Python functions are (non-overriding) descriptors, but builtin-functions are not descriptors? Changing static methods is not going to fix that. How about adding wrappers to make Python functions behave like builtin functions and vice

[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread Mark Shannon
Mark Shannon added the comment: I don't understand what the problem is. _pyio.open is a function not a static method. >>> import _pyio >>> _pyio.open -- nosy: +Mark.Shannon title: Make static methods created by @staticmethod callable -> Make function wr

[issue27129] Wordcode, part 2

2021-03-29 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +23819 pull_request: https://github.com/python/cpython/pull/25069 ___ Python tracker <https://bugs.python.org/issue27

[issue27129] Wordcode, part 2

2021-03-29 Thread Mark Shannon
Mark Shannon added the comment: frame.f_lasti and traceback.tb_lasti are best left as byte offsets. There is no guarantee that we won't go back to variable length instructions. For example, a "LONG_JUMP" instruction which is 4 bytes long and takes a 3 byte offset might well be a

[issue26300] "unpacked" bytecode

2021-03-29 Thread Mark Shannon
Mark Shannon added the comment: PEP 511 was rejected. The "peephole" optimizer now operates on the internal IR, not the bytecode. -- nosy: +Mark.Shannon resolution: -> out of date stage: -> resolved status: open -> closed ___

[issue43563] Use dedicated opcodes to speed up calls/attribute lookups with super() as receiver

2021-03-22 Thread Mark Shannon
Mark Shannon added the comment: Numbers please. What is "non-negligible cost of allocation/initialization" mean as a fraction of runtime? What sort of speed up are you seeing on whole programs? -- ___ Python tracker <https://bu

[issue43563] Use dedicated opcodes to speed up calls/attribute lookups with super() as receiver

2021-03-20 Thread Mark Shannon
Mark Shannon added the comment: Why? Do you have any evidence that the overhead of super() is significant in real programs, or that the proposed change actually speeds up anything beyond your micro-benchmark? -- nosy: +Mark.Shannon ___ Python

[issue42246] Implement PEP 626 -- Precise line numbers for debugging

2021-03-17 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +23665 pull_request: https://github.com/python/cpython/pull/24902 ___ Python tracker <https://bugs.python.org/issue42

[issue42246] Implement PEP 626 -- Precise line numbers for debugging

2021-03-16 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +23654 pull_request: https://github.com/python/cpython/pull/24892 ___ Python tracker <https://bugs.python.org/issue42

[issue42246] Implement PEP 626 -- Precise line numbers for debugging

2021-03-16 Thread Mark Shannon
Mark Shannon added the comment: No. We should add it. -- ___ Python tracker <https://bugs.python.org/issue42246> ___ ___ Python-bugs-list mailing list Unsub

[issue43497] SyntaxWarning for "assertion is always true, perhaps remove parentheses?" does not work with constants

2021-03-16 Thread Mark Shannon
Mark Shannon added the comment: New changeset a8ef4572a6b28bcfc0b10b34fa4204954b9dd761 by tsukasa-au in branch 'master': bpo-43497: Emit SyntaxWarnings for assertions with tuple constants. (GH-24867) https://github.com/python/cpython/commit/a8ef4572a6b28bcfc0b10b34fa4204954b9dd761

[issue42246] Implement PEP 626 -- Precise line numbers for debugging

2021-03-14 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +23620 pull_request: https://github.com/python/cpython/pull/24860 ___ Python tracker <https://bugs.python.org/issue42

[issue39316] settrace skips lines when chaining methods without arguments

2021-03-14 Thread Mark Shannon
Mark Shannon added the comment: New changeset d48848c83e0f3e41b65c8f741f3fb6dbce5b9c29 by Mark Shannon in branch 'master': bpo-39316: Make sure that attribute accesses and stores, including method calls, conform to PEP 626. (GH-24859) https://github.com/python/cpython/commit

[issue39316] settrace skips lines when chaining methods without arguments

2021-03-14 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +23619 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24859 ___ Python tracker <https://bugs.python.org/issu

[issue43271] AMD64 Windows10 3.x crash with Windows fatal exception: stack overflow

2021-03-01 Thread Mark Shannon
Mark Shannon added the comment: PEP 651 would prevent any crashes, although some of the tests might still fail with a StackOverflowException, if they weren't expecting a RecursionError. -- ___ Python tracker <https://bugs.python.org/issue43

[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-19 Thread Mark Shannon
Mark Shannon added the comment: In Python 3.9 the binding is more late-ish binding, than true late binding. Because globals['__builtins__'] is cached for each function activation, executing functions don't see updates. Example: >>> def f(): ... print(len("test")

[issue43228] Regression in function builtins

2021-02-18 Thread Mark Shannon
Mark Shannon added the comment: I don't think PR 24559 will be sufficient to fix this. Pickled functions need to share the builtins dict, not just have a copy of it. Adding a "builtins" parameter to types.FunctionType() should be be enough. So: function(code, globals, name=Non

[issue43228] Regression in function builtins

2021-02-15 Thread Mark Shannon
Mark Shannon added the comment: You need to define __builtins__ in the globals dictionary. def func(s): return len(s) text = "abc" print(func(text)) FuncType = type(func) func_globals = {"__builtins__":__builtins__.__dict__} code = func.__code__ func2 = FuncTyp

[issue43228] Regression in function builtins

2021-02-15 Thread Mark Shannon
Mark Shannon added the comment: Do you have a reproducer that does not use cloudpickle? Pickling functions seems to work correctly. >>> import pickle >>> def func(): ... return len([]) ... >>> func2 = pickle.loads(pickle.dumps(func)) >>> >&g

[issue43054] What does the existence of a struct in a header file imply about the C-API

2021-02-12 Thread Mark Shannon
Mark Shannon added the comment: Why do you think the distinction between category 1 and 2 is not clear? If the struct if not produced, or initialized, by an API function, then it cannot be accessed in the first place. If you can't access the struct in the first place, then you can't access

[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Mark Shannon
Change by Mark Shannon : -- assignee: -> Mark.Shannon components: +Interpreter Core -Library (Lib) versions: -Python 3.10 ___ Python tracker <https://bugs.python.org/issu

[issue42500] crash with unbounded recursion in except statement

2021-02-10 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +23290 pull_request: https://github.com/python/cpython/pull/24501 ___ Python tracker <https://bugs.python.org/issue42

[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Mark Shannon
Mark Shannon added the comment: I think this was fixed by https://github.com/python/cpython/pull/23568 The root cause seems to be the same as #42500, so I'm going to backport https://github.com/python/cpython/pull/23568 to 3.9 -- ___ Python

[issue43185] AssertRaises() causes core dump in handling recursion

2021-02-10 Thread Mark Shannon
Mark Shannon added the comment: 3.9 crashes. On master, I'm not seeing a crash, just a RecursionError. >>> import unittest >>> >>> def f(): ... raise TypeError ... >>> class TestAudioop(unittest.TestCase): ... def test_invalid_adpcm_state(

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

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

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-02-02 Thread Mark Shannon
Mark Shannon added the comment: It isn't a specific optimization at all, but the combination of several. I will change the behavior to match what appears to be the consensus. BUT, we need to define what the semantics should be. Otherwise implementing the compiler is just guesswork

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-02-02 Thread Mark Shannon
Mark Shannon added the comment: Option 3 with what semantics exactly? https://docs.python.org/3/reference/datamodel.html#object.__bool__ says that __bool__ should return True or False. If we don't allow the optimizer the freedom to assume that __bool__ is self-consistent and has no side

[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

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

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-02-01 Thread Mark Shannon
Mark Shannon added the comment: The differences between allowing the optimiser to remove truly redundant (in terms of control flow) boolean tests, or not, is slight. It only matters for __bool__() calls that have side effects. Like __hash__(), __bool__() should not produce side effects

[issue42634] Incorrect line number in bytecode for try-except-finally

2021-02-01 Thread Mark Shannon
Mark Shannon added the comment: Sorry. I forgot the close the issue when it was fixed. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-01 Thread Mark Shannon
Mark Shannon added the comment: New changeset 0332e569c12d3dc97171546c6dc10e42c27de34b by Mark Shannon in branch 'master': bpo-42990: Further refactoring of PyEval_ functions. (GH-24368) https://github.com/python/cpython/commit/0332e569c12d3dc97171546c6dc10e42c27de34b

[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-01-29 Thread Mark Shannon
Change by Mark Shannon : -- pull_requests: +23192 pull_request: https://github.com/python/cpython/pull/24368 ___ Python tracker <https://bugs.python.org/issue42

[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-01-29 Thread Mark Shannon
Mark Shannon added the comment: New changeset d6c33fbd346765c6a8654dccacb2338006bf2b47 by Mark Shannon in branch 'master': bpo-42990: Introduce 'frame constructor' struct to simplify API for PyEval_CodeEval and friends (GH-24298) https://github.com/python/cpython/commit

[issue43054] What does the existence of a struct in a header file imply about the C-API

2021-01-28 Thread Mark Shannon
New submission from Mark Shannon : Given the lack of explicit documentation on this subject, and differing opinions among core developers, I though it would be good to discuss how the existence of a struct in a header file constrains the C-API. Original PR provoking this discussion: https

[issue42979] _zoneinfo: zoneinfomodule_exec() doesn't check for PyDateTime_IMPORT failure

2021-01-27 Thread Mark Shannon
Mark Shannon added the comment: New changeset c9b8e9c421b57acdcaf24fab0c93bc29b3ef7c67 by Victor Stinner in branch 'master': bpo-42979: Enhance abstract.c assertions checking slot result (GH-24352) https://github.com/python/cpython/commit/c9b8e9c421b57acdcaf24fab0c93bc29b3ef7c67

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

2021-01-26 Thread Mark Shannon
Mark Shannon added the comment: New changeset dea5bf9d15999bfcc58095b157c0678d45b00bdd by Irit Katriel in branch 'master': bpo-33387: update documentation for exception handling opcode changes (GH-24334) https://github.com/python/cpython/commit/dea5bf9d15999bfcc58095b157c0678d45b00bdd

[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-01-22 Thread Mark Shannon
Change by Mark Shannon : -- keywords: +patch pull_requests: +23121 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/24298 ___ Python tracker <https://bugs.python.org/issu

[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-01-22 Thread Mark Shannon
Mark Shannon added the comment: Rather than: f = create_frame_or_gen(...); if () return f; retval = _PyEval_EvalFrame(tstate, f, 0); _PyObject_GC_TRACK(f); return retval; I was thinking: f = create_frame(...); if () return make_gen(f); retval = _PyEval_EvalFrame(tstate, f, 0

[issue42990] Improve the C code for calling Python code

2021-01-21 Thread Mark Shannon
New submission from Mark Shannon : Currently, to make a call to Python (modules, classes, etc, not just functions) from C has to use the monster that is `_PyEval_EvalCode`. As Python has adding features over the years, _PyEval_EvalCode has grown and grown. It is time for a refactor

[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-21 Thread Mark Shannon
Mark Shannon added the comment: If the point of the proposed change is not to deny access to globals, then what is the point of it? You say that this change is to "close a simpler gap in the audit system". What it is that the audit system is supposed to prevent, that is currently

[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-21 Thread Mark Shannon
Mark Shannon added the comment: I agree with Victor, we should not be attempting to build a sandbox. https://www.python.org/dev/peps/pep-0578/#why-not-a-sandbox Preventing access to global variables is next to impossible. Adding more and more hooks to prevent access to globals, merely adds

[issue42917] Block stack size for frame objects should be dynamically sizable

2021-01-21 Thread Mark Shannon
Mark Shannon added the comment: I see no advantage of getting rid of the limit of 20. No one ever gets near 20 deep in practice. Given the limit has been there for so long, it is likely that some tooling that expects the depth of try-statements to be limited. Why would a code generator need

[issue42925] Error trace of else inside class

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

[issue42951] Random and infinite loop in dealing with recursion error for "try-except "

2021-01-21 Thread Mark Shannon
Change by Mark Shannon : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue42951> ___ ___

[issue42951] Random and infinite loop in dealing with recursion error for "try-except "

2021-01-21 Thread Mark Shannon
Mark Shannon added the comment: Yes, see PEP 651 -- ___ Python tracker <https://bugs.python.org/issue42951> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42197] Disable automatic update of frame locals during tracing

2021-01-20 Thread Mark Shannon
Mark Shannon added the comment: I don't think so. Tracing is already somewhat fragile, see https://bugs.python.org/issue30744. Making it more complex is likely to add more bugs. PEP 558 should help, as f_locals becomes a proxy. There are some minor issues with PEP 558 (I'm not convinced

<    2   3   4   5   6   7   8   9   10   11   >