Change by Batuhan Taskaya :
--
components: +Interpreter Core -None
priority: low -> normal
title: Compiling evil ast crashes interpreter -> Compiling recursive Python
ASTs crash the interpreter
versions: +Python 3.11, Python 3.9
___
Python t
Batuhan Taskaya added the comment:
I think this is a duplicate of issue 44273.
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue44
Change by Batuhan Taskaya :
--
nosy: +pablogsal
___
Python tracker
<https://bugs.python.org/issue44273>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
> 1. It can be a str subclass with an overridden __format__. In this case the
> result will be different.
Thanks! Though this should be possible to do, so not a blocker for suggestion
(if I am not missing something)
> 2. If it is a str subclas
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue44207>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
> We should check on a real-world benchmark instead of a micro benchmark.
It is a pretty-targeted optimization, so I don't expect it to speed up the
macro benchmarks. Though that shouldn't be a blocker for small, targeted
optimizati
Batuhan Taskaya added the comment:
> May I ask, is this going forward? I installed 3.11-dev, it's not there
> (though __future__ claims it should be). I understand if it isn't done yet,
> just want to know if there's risk it will be postponed again (or even given
> up).
New submission from Batuhan Taskaya :
Since strings are immutable types, we could fold some operation on top of them.
Serhiy has done some work on issue 28307 regarding folding `str % args`
combination, which I think we can extend even further. One simple example that
I daily encounter
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue44187>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Batuhan Taskaya :
--
keywords: +patch
pull_requests: +24790
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26156
___
Python tracker
<https://bugs.python.org/issu
New submission from Batuhan Taskaya :
This issue is for tracking possible places where we could generate better code
on ast.unparse (better as in more closely to what people are actually writing
than our naive implementation).
Examples;
>>> import ast
>>> ast.unparse(
Change by Batuhan Taskaya :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue44081>
___
___
Pyth
Batuhan Taskaya added the comment:
I've implemented a new revision that works without making slices hashable.
Updating PR 23496
--
___
Python tracker
<https://bugs.python.org/issue42
Change by Batuhan Taskaya :
--
keywords: +patch
pull_requests: +24653
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26000
___
Python tracker
<https://bugs.python.org/issu
New submission from Batuhan Taskaya :
Previously:
>>> import ast
>>> ast.unparse(ast.parse("lambda: 'hey!'"))
"lambda : 'hey!'"
Expected:
>>> import ast
>>> ast.unparse(ast.parse("lambda: 'hey!'"))
"lambda: 'hey!'&quo
Change by Batuhan Taskaya :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue43417>
___
___
Pyth
Change by Batuhan Taskaya :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue42725>
___
___
Pyth
Change by Batuhan Taskaya :
--
pull_requests: +24630
pull_request: https://github.com/python/cpython/pull/25974
___
Python tracker
<https://bugs.python.org/issue42
Change by Batuhan Taskaya :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue44063>
___
___
Pyth
Batuhan Taskaya added the comment:
New changeset 13de28f17af02563cb8c6d0f6da3c178a4241ff3 by Miss Islington (bot)
in branch '3.10':
bpo-44063: set the missing end locations on the compiler (GH-25956) (#25972)
https://github.com/python/cpython/commit/13de28f17af02563cb8c6d0f6da3c178a4241ff3
Change by Batuhan Taskaya :
--
keywords: +patch
pull_requests: +24617
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25956
___
Python tracker
<https://bugs.python.org/issu
New submission from Batuhan Taskaya :
Something that I've stumbled up while working on another patch is that, the
compiler doesn't revert the end_lineno and the end_col_offset attributes back
unlike regular lineno/col_offset. An example of this problem;
ar rcs libpython3.10d.a Modules
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
> Batuhan, can this issue be closed?
No, I still need to take care of what's new entry.
--
___
Python tracker
<https://bugs.python.org/issu
Batuhan Taskaya added the comment:
New changeset ad106c68eb00f5e4af2f937107baff6141948cee by Batuhan Taskaya in
branch 'master':
bpo-42725: Render annotations effectless on symbol table with PEP 563 (GH-25583)
https://github.com/python/cpython/commit/ad106c68eb00f5e4af2f937107baff6141948cee
Batuhan Taskaya added the comment:
Coverage runs are still failing on the master, and I think at least we should
do something like allow failure or other wise github will send notifications
for this flaky run.
--
nosy: +BTaskaya
___
Python
Batuhan Taskaya added the comment:
Ah, seems like there is still one open PR. Keeping this up for that...
--
resolution: postponed ->
status: closed -> open
___
Python tracker
<https://bugs.python.org/i
Change by Batuhan Taskaya :
--
resolution: -> postponed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Batuhan Taskaya :
--
keywords: +patch
pull_requests: +24303
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25583
___
Python tracker
<https://bugs.python.org/issu
Batuhan Taskaya added the comment:
New changeset 8cc3cfa8afab1651c4f6e9ba43a7ab7f10f64c32 by Batuhan Taskaya in
branch 'master':
bpo-42737: annotations with complex targets no longer causes any runtime
effects (GH-23952)
https://github.com/python/cpython/commit
Batuhan Taskaya added the comment:
> That can be done after the PEG grammar has accepted them
But wouldn't we still end up with maintaining a custom flag to see if we are in
annotation (e.g a: Something((yield) + 2)) and act upon that which would seem
to do a bit messy in the gram
Batuhan Taskaya added the comment:
> This was easy in my 649 branch; walrus adds locals, and yield / yield from
> make it a generator. So the code raises an error if the generated
> annotations code object has locals or is a generator. I don't think I had to
> do anyt
Batuhan Taskaya added the comment:
> Hopefully Batuhan has a recollection of what I am thinking of, there was some
> significant delay while we figured out what to do about some of these.
The major one that I'd recall is that inspect.signature() just uses whatever is
in __annotat
Batuhan Taskaya added the comment:
I've posted an entry on python-dev to collect comments about how we should act
(whether just act them as strings on the symbol table or just forbid them
completely):
https://mail.python.org/archives/list/python-...@python.org/thread
Batuhan Taskaya added the comment:
> | MatchStar(identifier? target)
+1 on MatchStar(). Much more similiar to the existing node names, and also less
semantically-named.
> attributes (int lineno, int col_offset, int? end_lineno, int?
> end_col_offset)
I'm n
Batuhan Taskaya added the comment:
> Hum, there seems to be an actual bug here: even with PEP 563, the annotations
> for "complex targets" are evaluated. For example:
Yes, that is what this issue is about. This bug only surfaced while doing other
stuff and PEP 563 being
Batuhan Taskaya added the comment:
> Batuhan, can you summarize the argument from the thread? What do you think
> yourself? Myself, I'm not sure either way, but it seems okay to remove the
> remnant bytecode.
I feel like we shouldn't generate code for these annotations at all,
Change by Batuhan Taskaya :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue43897>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
> Actually, I didn't see that there are still 2 open linked PRs. I'll wait
> until those are merged.
I've moved the AST validator to its own separate issue so feel free to close
this Brandt!
--
___
Change by Batuhan Taskaya :
--
pull_requests: -23539
___
Python tracker
<https://bugs.python.org/issue42128>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Batuhan Taskaya :
--
keywords: +patch
pull_requests: +24213
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/24771
___
Python tracker
<https://bugs.python.org/issu
Batuhan Taskaya added the comment:
> Batuhan, perhaps we should change the linked issue for your AST validator PR
> to this one. That way we can close the old catch-all PEP 634 implementation
> issue and keep the discussion focused here.
I think it might be better as a separ
Change by Batuhan Taskaya :
--
dependencies: +Make match patterns explicit in the AST
___
Python tracker
<https://bugs.python.org/issue43897>
___
___
Python-bug
New submission from Batuhan Taskaya :
ASTs of case clauses for PEP 636 are not validated through PyAST_Validate right
now, which might crash the Python interpreter when compiling some trees that
doesn't hold the assumptions of the compiler.
--
assignee: BTaskaya
messages: 391469
nosy
Batuhan Taskaya added the comment:
> I think I'd be okay if `foo[bar]: baz` and `foo.bar: baz` (etc.) didn't
> generate any bytecode at all. Is that what you're proposing here? If so, and
> assuming the code is reasonably straightforward, I'd say go ahead and make a
> PR (and c
Batuhan Taskaya added the comment:
If there is enough interest, I'd like to propose to this before the beta cut
--
___
Python tracker
<https://bugs.python.org/issue42
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue43684>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
> @BTaskaya I've seen this in third party ides and type checker. For example
> they are referring to "Union[Callable[[], Union[int, str]], None]" as "() ->
> (int | str) | None" where there are parentheses around the ret
Batuhan Taskaya added the comment:
Hey @cleoold! Technically the second AST you gave is invalid (fun2),
considering that the FunctionType is not an expression;
mod = Module(stmt* body, type_ignore* type_ignores)
| FunctionType(expr* argtypes, expr returns)
expr = BoolOp
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue43535>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue43563>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
The reason that we weren't support these cases was there were simply no way
achieve them by parsing code so we simply ignored (empty sets etc). Though
considering that you have a decent use case in hy, I'd agree that these small
additions are viable
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue43521>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
> @BTaskaya, do you have any interest in helping me iterate on new AST nodes?
Sure!
--
___
Python tracker
<https://bugs.python.org/issu
Batuhan Taskaya added the comment:
> This seams really inconsistent with the rest of the ast, where identifiers
> are always wrapped in a ast.Name object. The only other exception to this is
> ast.Attribute.
import ... as
from ... import ... as
try:
...
except ... as :
..
Change by Batuhan Taskaya :
--
keywords: +patch
pull_requests: +23540
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/24772
___
Python tracker
<https://bugs.python.org/issu
New submission from Batuhan Taskaya :
Currently, buffer is just an instance-level list that is used in various places
to avoid directly writing stuff into the real source buffer, though the design
is pretty complicated and hard to use.
There are various use cases (like omitting the empty
Change by Batuhan Taskaya :
--
pull_requests: +23539
pull_request: https://github.com/python/cpython/pull/24771
___
Python tracker
<https://bugs.python.org/issue42
Batuhan Taskaya added the comment:
> @BTaskaya, do you think you'll have time to open a PR with your AST validator
> this weekend? It looks good to me (assuming tests pass).
Unfortunately not. I believe it still lacks tests for invalid cases, but other
than that should work. If you'
Change by Batuhan Taskaya :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Batuhan Taskaya added the comment:
New changeset 15bd9efd01e44087664e78bf766865a6d2e06626 by Anthony Sottile in
branch 'master':
bpo-43014: Improve performance of tokenize.tokenize by 20-30%
https://github.com/python/cpython/commit/15bd9efd01e44087664e78bf766865a6d2e06626
--
nosy
Change by Batuhan Taskaya :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.9
___
Python tracker
<https://bugs.python.or
Batuhan Taskaya added the comment:
> The use of nonlocal variables in an annotation will be a syntax error in
> Python 3.10
What is the reasoning for forbidding nonlocal variables
(https://bugs.python.org/msg383659), can't we just treat them like regular
variables and leave the
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue42927>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
It is actually much easier now, considering that we are operating on the AST
instead of the token stream. You probably only have to add a new field to
Function/Class classes for end_lineno and access .end_lineno attribute here
just like how we do
Batuhan Taskaya added the comment:
Well even though I still don't understand 'how this issue is different than
issue42725', I don't think you actually fix the symbol table;
see this one: https://bugs.python.org/msg383659
Annotations still have side effects on the symbol table (even though
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue42837>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
I also agree with Raymond's opinion, and from the point that it didn't get much
attention I'd assume not many people need it. So count me as -1
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.
Batuhan Taskaya added the comment:
I've given this another shot, but even though I was able to create a patch that
preserved slices as (type(slice), start, stop, step) tuples in the
consts_cache, this final optimization prevented me to finalize it;
https://github.com/python/cpython/blob
Batuhan Taskaya added the comment:
We could possibly fold this at the AST optimizer, though I am not sure whether
this worths anything as an optimization since it is a real obscure pattern.
I've only found 2 occurrences (both from the test suite of black) on a
relatively ~big dataset
Change by Batuhan Taskaya :
--
Removed message: https://bugs.python.org/msg383911
___
Python tracker
<https://bugs.python.org/issue42754>
___
___
Python-bug
Batuhan Taskaya added the comment:
We could possibly fold this at the AST optimizer, though I am not sure whether
this worths anything as an optimization since it is a real obscure pattern.
I've only found 2 occurrences (both from a test set on a relatively ~big
dataset of source code
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue42754>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
I think we should still evaluate the targets (even though the sole purpose of
this is just having a hint, the yield example seems serious), will update my
patch accordingly.
--
___
Python tracker
<ht
Batuhan Taskaya added the comment:
> Do we still need to represent annotation as a subtree in AST? Or make it just
> a string?
Possibly, we will just represent them as Constant()s. See issue 41967
--
___
Python tracker
<https://bugs.p
Batuhan Taskaya added the comment:
One thing to note here, currently Pablo and I are trying to bring annotation
unparsing from the compiler to the parser in issue 41967. If we do so, the
annotations won't cause any side effects on the symbol table generation.
--
nosy: +pablogsal
Batuhan Taskaya added the comment:
New changeset 0b281f94b9e5f117d774a1e4e834e797b2b21438 by Dong-hee Na in branch
'master':
bpo-42748: test_asdl_parser now uses exec_module instead of load_module (#23954)
https://github.com/python/cpython/commit/0b281f94b9e5f117d774a1e4e834e797b2b21438
Batuhan Taskaya added the comment:
> It will still perform run-time check which was an initial intention.
Well, at least from my personal perspective, I'd expect all annotations to
behave like strings regardless of their targets.
--
___
Pyt
Change by Batuhan Taskaya :
--
keywords: +patch
pull_requests: +22799
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23952
___
Python tracker
<https://bugs.python.org/issu
New submission from Batuhan Taskaya :
Running test_asdl_parser raises a deprecation warning:
0:00:26 load avg: 1.05 [ 23/426] test_asdl_parser
:283: DeprecationWarning: the load_module() method
is deprecated and slated for removal in Python 3.12; use exec_module() instead
probably related
Batuhan Taskaya added the comment:
I concur with Terry.
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue42687>
___
___
Python-bugs-list m
Change by Batuhan Taskaya :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Batuhan Taskaya added the comment:
New changeset 586f3dbe15139cafb2a6ffb82cea146906561844 by Irit Katriel in
branch 'master':
bpo-28964: add line number of node (if available) to ast.literal_eval error
messages (GH-23677)
https://github.com/python/cpython/commit
Batuhan Taskaya added the comment:
I have a patch ready to go, but I'd prefer to block this issue until issue
42737 is resolved/decided.
--
___
Python tracker
<https://bugs.python.org/issue42
New submission from Batuhan Taskaya :
PEP 526 classifies everything but simple, unparenthesized names (a.b, (a),
a[b]) as complex targets. The way the we handle annotations for them right now
is, doing literally nothing but evaluating every part of it (just pushing the
name to the stack
Batuhan Taskaya added the comment:
Thank you for your patch though!
--
___
Python tracker
<https://bugs.python.org/issue42729>
___
___
Python-bugs-list mailin
Batuhan Taskaya added the comment:
> That's exactly the implementation in the patch now submitted against this
> issue. But that's the patch for CPython, the motive of the proposal here is
> to establish a standard API call for *Python*, which different implementation
> can i
Batuhan Taskaya added the comment:
> I propose to close that gap, and establish an API which would allow to parse
> token stream (iterable) into an AST. An initial implementation for CPython
> can (and likely should) be naive, making a loop thru surface program
> re
Change by Batuhan Taskaya :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Batuhan Taskaya added the comment:
New changeset eee1c7745ab4eb4f75153e71aaa2a62018b7625a by Batuhan Taskaya in
branch 'master':
bpo-41960: Add globalns and localns parameters to inspect.signature and
Signature.from_callable (GH-22583)
https://github.com/python/cpython/commit
Batuhan Taskaya added the comment:
> So I don't feel as strongly about that.
Just to note, since I believe the solution for all this might be the same (not
processing annotations at all, since they will be compiled to strings in the
later stage). If we go down on that ro
Batuhan Taskaya added the comment:
This is another side effect of processing annotations (at the symbol table
construction stage) (and I would assume there are a few more cases like this);
def foo():
outer_var = 1
def bar():
inner_var: outer_var = T
return bar
Batuhan Taskaya added the comment:
> It's been a while, I've lost context for this idea. What problem are you
> trying to solve here? Are there issues where people have reported problems
> that this would allow them to solve?
Context: https://github.com/python/cpython/p
New submission from Batuhan Taskaya :
Since the annotations are processed just like all other expressions in the
symbol table, the generated entries for functions etc. This would result with
def foo():
for number in range(5):
foo: (yield number)
return number
foo
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue42246>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue42693>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Batuhan Taskaya :
--
keywords: +patch -gsoc
___
Python tracker
<https://bugs.python.org/issue28964>
___
___
Python-bugs-list mailing list
Unsubscribe:
Batuhan Taskaya added the comment:
I'm +0 on this (even though we only had 2 users wanting this, the
implementation seems very trivial). @serhiy.storchaka, @pablogsal any opinions?
--
keywords: +gsoc -patch
nosy: +pablogsal
___
Python tracker
Batuhan Taskaya added the comment:
I don't have anything to add to this beside the name choice is safe and won't
clash with anything (but honestly I would prefer it to be discussed on the ML
before implementing something after 3 years). I checked a limited dataset to
search for aiter
Change by Batuhan Taskaya :
--
nosy: +BTaskaya
___
Python tracker
<https://bugs.python.org/issue42609>
___
___
Python-bugs-list mailing list
Unsubscribe:
101 - 200 of 656 matches
Mail list logo