[issue42422] Py_Decref on value crash the interpreter in Python/ceval.c:1104

2020-11-22 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

I'm sorry to interrupt but what is the exact reasoning behind adding a new, (I 
presume) redundant crasher? There are tons of different ways to crash the 
interpreter with malformed bytecode, how would adding only one of them bring 
any good?

--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue42422>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28002] ast.unparse can't roundtrip some f-strings

2020-11-20 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Thanks for your efforts Shantanu!

--

___
Python tracker 
<https://bugs.python.org/issue28002>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28002] ast.unparse can't roundtrip some f-strings

2020-11-20 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue28002>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28002] ast.unparse can't roundtrip some f-strings

2020-11-20 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset 3763cc1dbdb930f67b443ceed7c44e4feb883b42 by Miss Islington (bot) 
in branch '3.9':
bpo-28002: Roundtrip f-strings with ast.unparse better (GH-19612) (GH-23430)
https://github.com/python/cpython/commit/3763cc1dbdb930f67b443ceed7c44e4feb883b42


--

___
Python tracker 
<https://bugs.python.org/issue28002>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28002] ast.unparse can't roundtrip some f-strings

2020-11-20 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset a993e901ebe60c38d46ecb31f771d0b4a206828c by Shantanu in branch 
'master':
bpo-28002: Roundtrip f-strings with ast.unparse better (#19612)
https://github.com/python/cpython/commit/a993e901ebe60c38d46ecb31f771d0b4a206828c


--

___
Python tracker 
<https://bugs.python.org/issue28002>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39463] ast.Constant, bytes, and ast.unparse

2020-11-16 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

We added the warnings, and I believe we can close this safely (since there is 
no intend to change the behavior of ast.unparse)

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue39463>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42102] Make builtins.callable "generic"

2020-11-16 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> Sorry, but making builtins.callable generic looks wrong to me. It is a 
> predicate, not a constructor. If it would be called "iscallable" instead of 
> "callable" nobody would propose to make it generic, right? It's just a 
> coincidence that the name of this predicate equals to the name of 
> typing.Callable and collections.abc.Callable.

I concur with Serhiy on this.

--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue42102>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42115] Caching infrastructure for the evaluation loop: specialised opcodes

2020-11-15 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue42115>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16801] Preserve original representation for integers / floats in docstrings

2020-11-15 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +pablogsal

___
Python tracker 
<https://bugs.python.org/issue16801>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16801] Preserve original representation for integers / floats in docstrings

2020-11-15 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

I'm very late to join this thread, but since the Constant() node has now a kind 
field, we can possibly add this (though I'm not saying we should, depending on 
whether still this would be a nice addition to clinic docstrings.)

2 options that I can think off:
- Introduce a couple of new tokens (BIN_NUMBER, OCT_NUMBER, HEX_NUMBER). 
- Add a new field to the tok_state struct (like const char* number_type) and 
when constructing the Constant node in the _PyPegen_number_token, add that 
number_type as the kind field of the constant.

In case of anyone wondering, the latter would be a +20 lines addition (no 
changes on the grammar / tokens, just a couple of new lines into the tokenizer 
and the _PyPegen_number_token.)

--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue16801>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27119] `compile` doesn't compile into an AST object as specified

2020-11-15 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

We've added a reference to the compiler flags into the compile(), see issue 
40484 for details.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
versions: +Python 3.10 -Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 
3.8

___
Python tracker 
<https://bugs.python.org/issue27119>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39411] pyclbr rewrite using AST

2020-11-14 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue39411>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42354] Tuple unpacking with * causes SyntaxError in with ... as ...

2020-11-14 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Already fixed with GH-22612

--
nosy: +BTaskaya
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42354>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42355] symtable: get_namespace doesn't check whether if there are multiple namespaces or no namespaces at all

2020-11-14 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +22172
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23278

___
Python tracker 
<https://bugs.python.org/issue42355>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42355] symtable: get_namespace doesn't check whether if there are multiple namespaces or no namespaces at all

2020-11-14 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

>>> table = symtable.symtable("A = 1", "", "exec")
>>> table.lookup("A")

>>> table.lookup("A").get_namespace()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.10/symtable.py", line 312, in get_namespace
raise ValueError("name is bound to multiple namespaces")
ValueError: name is bound to multiple namespaces
>>> table.lookup("A").get_namespaces()
()

--
assignee: BTaskaya
components: Library (Lib)
messages: 380969
nosy: BTaskaya, benjamin.peterson
priority: normal
severity: normal
status: open
title: symtable: get_namespace doesn't check whether if there are multiple 
namespaces or no namespaces at all
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue42355>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42348] Language Reference: Set items

2020-11-13 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

The data types section of the language reference 
(https://docs.python.org/3.10/reference/datamodel.html#the-standard-type-hierarchy)
 has this description directly under the Set type (which has 2 childs, set and 
frozenset). 

> These represent unordered, finite sets of unique, immutable objects.

I feel like this wording is a bit confusing, considering the items doesn't have 
to be immutable at all. Can we replace this with hashable?

--
messages: 380901
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: Language Reference: Set items

___
Python tracker 
<https://bugs.python.org/issue42348>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42348] Language Reference: Set items

2020-11-13 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, rhettinger

___
Python tracker 
<https://bugs.python.org/issue42348>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42086] AST: Document / re-design? the simple constructor nodes from sums

2020-11-13 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42086>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39411] pyclbr rewrite using AST

2020-11-10 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset fa476fe13255d0360f18528e864540d927560f66 by Batuhan Taskaya in 
branch 'master':
bpo-39411: pyclbr rewrite on AST (#18103)
https://github.com/python/cpython/commit/fa476fe13255d0360f18528e864540d927560f66


--

___
Python tracker 
<https://bugs.python.org/issue39411>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42313] rstrip removes the trailing `e`s.

2020-11-10 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

For 3.9+, you could do exactly what you want with .removesuffix 
(/.removeprefix) methods;
>>> test = "external_e_object"
>>> test.removesuffix("_object")
'external_e'

--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue42313>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2020-11-09 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.7

___
Python tracker 
<https://bugs.python.org/issue36310>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36310] pygettext3.7 Does Not Recognize gettext Calls Within fstrings

2020-11-09 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset bfc6b63102d37ccb58a71711e2342143cd9f4d86 by jack1142 in branch 
'master':
bpo-36310: Allow pygettext.py to detect calls to gettext in f-strings. 
(GH-19875)
https://github.com/python/cpython/commit/bfc6b63102d37ccb58a71711e2342143cd9f4d86


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue36310>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42295] Error should be flagged if Walrus operator is used for multiple assigment

2020-11-09 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42295>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42295] Error should be flagged if Walrus operator is used for multiple assigment

2020-11-09 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Due to the precedence of the walrus operator, it is not actually a multiple 
assignment but rather a tuple of 3 elements with one being the value of the 
assignment expression.

 $ python -m ast  
(a, b := 3, 4)
Module(
   body=[
  Expr(
 value=Tuple(
elts=[
   Name(id='a', ctx=Load()),
   NamedExpr(
  target=Name(id='b', ctx=Store()),
  value=Constant(value=3)),
   Constant(value=4)],
ctx=Load()))],
   type_ignores=[])

In this case, it creates a tuple with loading the name `a` from the current 
scope, using the value of the 3 and also assigning 3 to the b, and loading 
constant 4.

So basically (a, b := 3, 4) is actually (a, (b := 3), 4)

--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue42295>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26584] pyclbr module needs to be more flexible on loader support

2020-11-04 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya, terry.reedy

___
Python tracker 
<https://bugs.python.org/issue26584>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41796] _ast module state should be made per interpreter

2020-11-03 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue41796>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21977
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23058

___
Python tracker 
<https://bugs.python.org/issue42218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42218] SystemError in compile builtin function

2020-10-31 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue42218>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42206] Pegen: Raise errors occurred by the AST validator

2020-10-30 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42206>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39715] Implement __repr__ methods for AST classes

2020-10-30 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> I suggest to reject this feature request

+1

--

___
Python tracker 
<https://bugs.python.org/issue39715>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42206] Pegen: Raise errors occurred by the AST validator

2020-10-30 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21954
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23035

___
Python tracker 
<https://bugs.python.org/issue42206>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42206] Pegen: Raise errors occurred by the AST validator

2020-10-30 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

When working on the AST validator, it is unclear that which of the changes 
caused parser to fail on valid input. I propose to propagate the error and 
raise it.

Current:
$ ./python t.py
python: Parser/pegen.c:1146: _PyPegen_run_parser: Assertion 
`PyAST_Validate(res)' failed.

Proposed:
$ ./python t.py
ValueError: Test AST error raised by the Python/ast.c

--
components: Interpreter Core
messages: 379941
nosy: BTaskaya, gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Pegen: Raise errors occurred by the AST validator

___
Python tracker 
<https://bugs.python.org/issue42206>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42187] Deprecating / removing token.ISTERMINAL/ISNONTERMINAL

2020-10-28 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> Since there are so few projects, maybe you can just contact them?

For NT_OFFSET?

--

___
Python tracker 
<https://bugs.python.org/issue42187>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42187] Deprecating / removing token.ISTERMINAL/ISNONTERMINAL

2020-10-28 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords:  -3.4regression

___
Python tracker 
<https://bugs.python.org/issue42187>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42187] Deprecating / removing token.ISTERMINAL/ISNONTERMINAL

2020-10-28 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

Since the parser & symbol modules are removed, there is no real use case for 
ISTERMINAL/ISNONTERMINAL since the only input that contains grammar symbols is 
the input of the tokenize, which all its outputs are terminals. Which restricts 
the practicality of token.ISTERMINAL/ISNONTERMINAL. I'd propose we either 
deprecate them or remove them completely.

Search over the most populer PyPI packages (a set of 4k) showed there are only 
2 projects that uses these functions, which all cases coupled with the parser 
module.
pyglet-1.5.7/pyglet/text/formats/attributed.py
133:if token.ISNONTERMINAL(node[0]):
gdata-2.0.18/tests/coverage.py
328:if token.ISNONTERMINAL(tree[0]):

If we are going through a deprecation period, I will also propose to remove 
ISEOF, since it can be easily replaced and very under used. The only project 
that uses token.ISEOF in my dataset is asttokens, which I would say all cases 
there can be easily replaced tok.type == token.EOF

asttokens-2.0.4/asttokens/mark_tokens.py
105:   not token.ISEOF(t.type)):

Also, these functions are originally reflections of C macros used in the past, 
and since they are not used right now, we can also remove those macros.

I have no opinions about the token.NT_OFFSET though, but there are a couple of 
occurrences so we might keep that? 
Paste-3.4.4/paste/util/PySourceColor.py
205:ARGS = token.NT_OFFSET + 1
206:DOUBLECOMMENT = token.NT_OFFSET + 2

ipython-7.18.1/IPython/utils/PyColorize.py
54:_KEYWORD = token.NT_OFFSET + 1
55:_TEXT= token.NT_OFFSET + 2

--
keywords: 3.4regression
messages: 379844
nosy: BTaskaya, gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Deprecating / removing token.ISTERMINAL/ISNONTERMINAL

___
Python tracker 
<https://bugs.python.org/issue42187>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42173] Drop Solaris support

2020-10-27 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue42173>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38870] Expose ast.unparse in the ast module

2020-10-23 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue38870>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38870] Expose ast.unparse in the ast module

2020-10-23 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Well, I'm happy to say that 3.9.0 is finally released with the ast.unparse 
interface. After tens of PRs, I think it is time for us to move on. For all 
future bugs, please create a new issue and nosy me. Thanks everyone who has 
participated this journey!

--

___
Python tracker 
<https://bugs.python.org/issue38870>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42086] AST: Document / re-design? the simple constructor nodes from sums

2020-10-22 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21828
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22896

___
Python tracker 
<https://bugs.python.org/issue42086>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42086] AST: Document / re-design? the simple constructor nodes from sums

2020-10-22 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

After doing experiments with annotating the operator nodes with position 
information, it is concluded that it doesn't worth the efforts of changing all 
occurrences of operators from enum to a struct. Other than that, it was 
designated that we'll keep this behavior and document it.

--

___
Python tracker 
<https://bugs.python.org/issue42086>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42087] Remove pre-AIX 6.1 dead code paths

2020-10-19 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue42087>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42086] AST: Document / re-design? the simple constructor nodes from sums

2020-10-19 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

Simple constructors (basically constructors with no fields) are currently 
'cached' / pre-created and dispatched. What I mean by that is, when a user 
parses some code with `ast.parse()` and gets a tree object, all simple 
constructors with the same value would point to the same object.

>>> mod1 = ast.parse("a + b", mode="eval")
>>> mod1.body.left.ctx

>>> mod1.body.right.ctx

>>> mod1.body.left.ctx is mod1.body.right.ctx
True
>>> mod1.body.left.ctx.some_annotation_that_my_extra_process_tool_puts = 1
>>> mod1.body.right.ctx.some_annotation_that_my_extra_process_tool_puts
1

Even though I have no real evidence that, this was done on purpose, I believe 
this is some sort of 'enum' replication (caching singletons but not really, 
since this is only valid for the results of ast.parse)
>>> mod1.body.right.ctx is ast.Load()
False
>>> ast.parse("a + b", mode="eval").body.left.ctx is ast.parse("c + d", 
>>> mode="eval").body.right.ctx
True



Obviously, we can not change these into enums like (ast.expr_ctx.Load / LOAD) 
since it would break theoretically most of the code that works with ast. So 
here is a tl;dr:

- Even though all ast objects are mutable (by default), we use the same objects 
when converting C AST into Python AST. So that mutations on one object is 
affecting the rest of the tree. 

- We can either;
  - Document this behavior and keep it
  - Return freshly constructed objects when converting C AST into Python AST
This has a very slight (that I suspect no body uses) risk of breaking code, 
but as I implied, very slight. Which would occur in such a case

import ast
from collections import defaultdict

def collect_contexts(tree):
contexts = defaultdict(list)
for node in ast.walk(tree):
if isinstance(node, ast.Name):
contexts[node.ctx].append(node.id)
return contexts

print(collect_contexts(ast.parse("a, b = c, d")))

This code can easily (and it makes it more reliable/robust) refactored into 
- contexts[node.ctx].append(node.id)
- contexts[type(node.ctx)].append(node.id)
but just mentioning in case of any question appears about backwards 
incompatability.

--
components: Library (Lib)
messages: 379004
nosy: BTaskaya, lys.nikolaou, pablogsal, serhiy.storchaka
priority: normal
severity: normal
status: open
title: AST: Document / re-design? the simple constructor nodes from sums
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue42086>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40680] thread_cputime isn't supported by AIX5

2020-10-19 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> Also, I can submit changes to remove pre-AIX 6 dead code paths. Should I open 
> a separate issue for that or reference this one?

Yes, please do so.

--

___
Python tracker 
<https://bugs.python.org/issue40680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42030] Drop support for dynload_aix

2020-10-16 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya, pablogsal

___
Python tracker 
<https://bugs.python.org/issue42030>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42000] Small cleanups to AST-related code

2020-10-10 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42000>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42000] Small cleanups to AST-related code

2020-10-10 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21614
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22641

___
Python tracker 
<https://bugs.python.org/issue42000>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42000] Small cleanups to AST-related code

2020-10-10 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
components: Interpreter Core
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: Small cleanups to AST-related code
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue42000>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.10

2020-10-10 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
pull_requests: +21607
pull_request: https://github.com/python/cpython/pull/22630

___
Python tracker 
<https://bugs.python.org/issue38605>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41987] singledispatchmethod raises an error when relying on a forward declaration

2020-10-09 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

AFAIK the normal way of registering types (dispatcher.register()) also 
requires that registered type be defined at the execution type. I guess, if we 
are going to support such a thing, we might end up with supporting passing 
strings into the .register() as the initial argument of matching type to be 
consistent. Anyways, this would be a feature request for 3.10+, so changing the 
version info.

--
nosy: +gvanrossum
versions: +Python 3.10 -Python 3.8

___
Python tracker 
<https://bugs.python.org/issue41987>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41987] singledispatchmethod raises an error when relying on a forward declaration

2020-10-09 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue41987>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41979] PEG parser doesn't accept extended unpacking in with statement

2020-10-09 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
pull_requests: +21595
pull_request: https://github.com/python/cpython/pull/22612

___
Python tracker 
<https://bugs.python.org/issue41979>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41979] PEG parser doesn't accept extended unpacking in with statement

2020-10-09 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21594
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22611

___
Python tracker 
<https://bugs.python.org/issue41979>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41979] PEG parser doesn't accept extended unpacking in with statement

2020-10-09 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue41979>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41967] Handle annotations in the parser to avoid the need for roundtrip

2020-10-07 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

It is not actually much of a difference;
 $ cat t.py
def func(
arg: typing.Callable[
[int, str],
str # test
]
):
pass

import typing
print("Annotations: ", func.__annotations__)
print("get_type_hints: ", typing.get_type_hints(func))
$ ./python t.py
Annotations:  {'arg': 'typing.Callable[[int,str],str]'}
get_type_hints:  {'arg': typing.Callable[[int, str], str]}

$ ./python
>>> foo: (List[List[List[int, str, bytes]], List[(int, str)]])
>>> __annotations__
{'foo': 'List[List[List[int,str,bytes]],List[(int,str)]]'}

--

___
Python tracker 
<https://bugs.python.org/issue41967>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41967] Handle annotations in the parser to avoid the need for roundtrip

2020-10-07 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

s/For 516389 annotated arguments/For 516389 arguments/.

Example usages;
https://search.tree.science/?query=AnnAssign(annotation%20=%20expr(lineno%20=%20not%20~end_lineno))

https://search.tree.science/?query=arg(annotation=expr(lineno%20=%20not%20~end_lineno))

--

___
Python tracker 
<https://bugs.python.org/issue41967>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41967] Handle annotations in the parser to avoid the need for roundtrip

2020-10-07 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

After scanning 1552 annotated assignments in over 25k python modules (from most 
populer packages in PyPI) there are only 6 AnnAssign nodes where the 
annotations are multiline. For 516389 annotated arguments, only 20 of them are 
multiline annotations.

--

___
Python tracker 
<https://bugs.python.org/issue41967>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41960] Add globalns and localns to the inspect.signature and inspect.Signature.from_callable

2020-10-06 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21576
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22583

___
Python tracker 
<https://bugs.python.org/issue41960>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41960] Add globalns and localns to the inspect.signature and inspect.Signature.from_callable

2020-10-06 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

To resolve annotations in local namespaces (and possibly in different 
contexts), inspect.signature can take globalns and localns parameters.

I'm not inclined to add these into the getfullargspec, but I'd appreciate any 
comments about whether it is a good idea or not!

--
components: Library (Lib)
messages: 378137
nosy: BTaskaya, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: Add globalns and localns to the inspect.signature and 
inspect.Signature.from_callable
type: enhancement
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue41960>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38605] [typing] PEP 563: Postponed evaluation of annotations: enable it by default in Python 3.10

2020-10-06 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

@gvanrossum should I draft a patch to convert this
inspect.signature(callable, *, follow_wrapped=True) (and also things like 
inspect.Signature.from_callable) into inspect.signature(callable, *, 
follow_wrapped=True, globalns=None, localns=None) in order to pass them to 
get_type_hints (for resolving in different namespaces)?

--

___
Python tracker 
<https://bugs.python.org/issue38605>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41613] get_type_hints regression for 3.9 and 3.10

2020-10-01 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Commit 3ff51d425ecd98b7ba5a12ca9f77eda73fbf9f53 set the __builtins__ to None in 
namedtuple's creation, but the problem is that it is causing harm when the 
point came to the point of getting type hints on typing.NamedTuple.__new__ (we 
had a test about it), I'm changing that test (in the PR 20434) to work directly 
with the namedtuple itself instead of __new__ (since the annotations get 
proxied).

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41613>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17490] Improve ast.literal_eval test suite coverage

2020-10-01 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21504
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22469

___
Python tracker 
<https://bugs.python.org/issue17490>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41887] ast.literal_eval does not accept strings with leading whitespaces

2020-09-30 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21492
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22469

___
Python tracker 
<https://bugs.python.org/issue41887>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41887] ast.literal_eval does not accept strings with leading whitespaces

2020-09-30 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Looks like skipping the leading whitespace is an undocumented behavior for 
eval() introduced back in 1992 (f08ab0ad158f88f05dd923b129d2397e1882be14). I 
don't think that bringing it to the literal_eval is a good idea, at least after 
this much of a time. If so, both of them should be explicitly documented or at 
least mentioned in the source code (to avoid confusion).

--
nosy: +pablogsal

___
Python tracker 
<https://bugs.python.org/issue41887>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41887] ast.literal_eval does not accept strings with leading whitespaces

2020-09-30 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue41887>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41848] PEG parser doesn't allow lambda in for_if_clause

2020-09-24 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
nosy: +BTaskaya
nosy_count: 6.0 -> 7.0
pull_requests: +21434
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22394

___
Python tracker 
<https://bugs.python.org/issue41848>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41780] Generic Alias attributes nor in dir()

2020-09-15 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21318
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22262

___
Python tracker 
<https://bugs.python.org/issue41780>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41780] Generic Alias attributes nor in dir()

2020-09-15 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Okay, so IIRC if we stop forwarding __class__ (add it as an exception to 
attr_exceptions) it would return us the original dir(), and also solve the 
inconsistency of the example you gave;

> >>> list.__class__
> 
> >>> list[int].__class__
> 
>
> >>> type(list)
> 
> >>> type(list[int])
> 

but the problem is that, it is not 'exactly' complying with the specs at PEP 
585. I am aware that we already added some extras to this list 
(https://www.python.org/dev/peps/pep-0585/#parameters-to-generics-are-available-at-runtime)
 like __mro_entries__ etc, but __class__ looks like a tricky problem. 
@gvanrossum any comments?

--

___
Python tracker 
<https://bugs.python.org/issue41780>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41780] Generic Alias attributes nor in dir()

2020-09-14 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> @Batuhan, do you want to look into this?

Sure, will check it out!

--

___
Python tracker 
<https://bugs.python.org/issue41780>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41746] Add optional type information to asdl_seq objects

2020-09-08 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> That's a possibility, but that would incur in a lot of new extra code, and 
> some asdl_seq items in the parser contain non-standard types that only PEG 
> uses, so is not possible to auto-generate them.

Well, since the extra code will be autogenerated, guess it wouldn't be much 
problematic. But I see about the PEG thing.

--

___
Python tracker 
<https://bugs.python.org/issue41746>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41746] Add optional type information to asdl_seq objects

2020-09-08 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

The problem with asdl_seq_int was that it was hard-coded since there was no 
entity that transpods data between different traversers / node visitors. PR 
20193 tries to implement a general-purpose metadata system to eliminate that 
issue, and can be easily extended for this too!

--

___
Python tracker 
<https://bugs.python.org/issue41746>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41746] Add optional type information to asdl_seq objects

2020-09-08 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

We already have a specialized type for int (actually an enumeration);
typedef struct {
Py_ssize_t size;
void *elements[1];
} asdl_seq;

typedef struct {
Py_ssize_t size;
int elements[1];
} asdl_int_seq;

Why not just include these in the Python-ast.h and auto-generate them in the 
asdl_c.py

--

___
Python tracker 
<https://bugs.python.org/issue41746>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41746] Add optional type information to asdl_seq objects

2020-09-08 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue41746>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41747] dataclasses: generated method's using the wrong qualname

2020-09-08 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +21234
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22155

___
Python tracker 
<https://bugs.python.org/issue41747>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41747] dataclasses: generated method's using the wrong qualname

2020-09-08 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

$ cat t.py
from dataclasses import dataclass

@dataclass
class Foo:
bar: int

Foo()
$ python t.py
Traceback (most recent call last):
  File "/home/isidentical/cpython/cpython/t.py", line 7, in 
Foo()
TypeError: __create_fn__..__init__() missing 1 required positional 
argument: 'bar'

--
components: Library (Lib)
messages: 376594
nosy: BTaskaya, eric.smith
priority: normal
severity: normal
status: open
title: dataclasses: generated method's using the wrong qualname
type: behavior
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue41747>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33337] Provide a supported Concrete Syntax Tree implementation in the standard library

2020-09-07 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue7>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41687] sendfile implementation is not compatible with Solaris

2020-09-01 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue41687>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import

2020-08-25 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue41631>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41613] get_type_hints regression for 3.9 and 3.10

2020-08-22 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

This looks like a problem with the __globals__ of the NamedTuple.__new__

--

___
Python tracker 
<https://bugs.python.org/issue41613>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41613] get_type_hints regression for 3.9 and 3.10

2020-08-22 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
components: +Library (Lib)
versions: +Python 3.10, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue41613>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41613] get_type_hints regression for 3.9 and 3.10

2020-08-22 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

The attached script works perfectly fine under Python 3.8, but it crashes in 
3.9/3.10.

$ ./py38/python typing_fail.py (3.8.5+)
{'a': , 'b': }
$ ./py39/python typing_fail.py (3.9.0rc1+)
[SNIP]
TypeError: 'NoneType' object is not subscriptable
$ ./cpython/python typing_fail.py (3.10.0a0)
[SNIP]
TypeError: 'NoneType' object is not subscriptable

--
files: typing_fail.py
messages: 375791
nosy: BTaskaya, gvanrossum, levkivskyi, lukasz.langa
priority: normal
severity: normal
status: open
title: get_type_hints regression for 3.9 and 3.10
Added file: https://bugs.python.org/file49421/typing_fail.py

___
Python tracker 
<https://bugs.python.org/issue41613>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10399] AST Optimization: inlining of function calls

2020-08-20 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue10399>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40726] ast.Call end_lineno is defined and returns None

2020-08-05 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
pull_requests: +20889
pull_request: https://github.com/python/cpython/pull/21745

___
Python tracker 
<https://bugs.python.org/issue40726>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38628] Issue with ctypes in AIX

2020-07-24 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue38628>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17490] Improve ast.literal_eval test suite coverage

2020-07-10 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue17490>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41261] 3.9-dev SEGV in object_recursive_isinstance in ast.literal_eval

2020-07-10 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue41261>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39981] Default values for AST Nodes

2020-07-09 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
pull_requests: +20566
pull_request: https://github.com/python/cpython/pull/21417

___
Python tracker 
<https://bugs.python.org/issue39981>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11105] Compiling evil ast crashes interpreter

2020-07-06 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> With 3.9 on Windows, using Benjamin's example, I do not get the Windows 
> equivalent of a seg fault.  However, execution stops at compile with no 
> exception, including SystemExit.

I can still reproduce on Linux,

 $ python
Python 3.10.0a0 (heads/bpo-x:f2947e354c, May 21 2020, 18:54:57) 
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> e = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
>>> e.operand = e
>>> compile(ast.Expression(e), "", "eval")
[1]15320 segmentation fault (core dumped)  python


> These examples amount to limited fuzz testing of compile().  I think it 
> should raise something like "SyntaxError: recursive ast" or even 'bad ast' if 
> malformed non-recursive asts have the same issue.

I dont think it would be easy to locate such errors before they happen, instead 
I propose (actually already proposed in PR 20594) to add recursion guards to 
places where this might happen. This can prevent crashes on both direct and 
indirect cycles

>>> import ast
>>> e = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
>>> e.operand = e
>>> compile(ast.Expression(e), "", "eval")
Traceback (most recent call last):
  File "", line 1, in 
RecursionError: maximum recursion depth exceeded while traversing 'expr' node
>>> e = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
>>> f = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
>>> e.operand = f
>>> f.operand = e
>>> compile(ast.Expression(e), "", "eval")
Traceback (most recent call last):
  File "", line 1, in 
RecursionError: maximum recursion depth exceeded while traversing 'expr' node

--

___
Python tracker 
<https://bugs.python.org/issue11105>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41204] Use of unitialized variable `fields` along error path in code generated from asdl_c.py

2020-07-04 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue41204>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37458] ast: Different FormattedValue expressions have same col_offset information

2020-07-04 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue37458>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41194] SIGSEGV in Python 3.9.0b3 in Python-ast.c:1412

2020-07-03 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
Removed message: https://bugs.python.org/msg372915

___
Python tracker 
<https://bugs.python.org/issue41194>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41194] SIGSEGV in Python 3.9.0b3 in Python-ast.c:1412

2020-07-02 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

If I'm not wrong, this is the commit that introduced the regression.

commit ac46eb4ad6662cf6d771b20d8963658b2186c48c (HEAD -> bpo-x)
Author: Dino Viehland 
Date:   Wed Sep 11 10:16:34 2019 -0700

bpo-38113: Update the Python-ast.c generator to PEP384 (gh-15957)

Summary: This mostly migrates Python-ast.c to PEP384 and removes all 
statics from the whole file. This modifies the generator itself that generates 
the Python-ast.c. It leaves in the usage of _PyObject_LookupAttr even though 
it's not fully PEP384 compatible (this could always be shimmed in by anyone who 
needs it).

--
nosy: +dino.viehland

___
Python tracker 
<https://bugs.python.org/issue41194>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41194] SIGSEGV in Python 3.9.0b3 in Python-ast.c:1412

2020-07-02 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +pablogsal

___
Python tracker 
<https://bugs.python.org/issue41194>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41194] SIGSEGV in Python 3.9.0b3 in Python-ast.c:1412

2020-07-02 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

A shorter reproducer;

>>> import sys
>>> sys.modules.clear()
Traceback (most recent call last):
  File "", line 1, in 
RuntimeError: lost builtins module
>>> import _ast
>>> import gc
>>> gc.collect()
Modules/gcmodule.c:114: gc_decref: Assertion "gc_get_refs(g) > 0" failed: 
refcount is too small
Enable tracemalloc to get the memory block allocation traceback

object address  : 0x7f4c22f843b0
object refcount : 2
object type : 0x5605f3385660
object type name: module
object repr : 

Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: initialized

Current thread 0x7f4c23a5d280 (most recent call first):
  File "", line 1 in 
[1]21945 abort (core dumped)  ./python

--

___
Python tracker 
<https://bugs.python.org/issue41194>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41194] SIGSEGV in Python 3.9.0b3 in Python-ast.c:1412

2020-07-02 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

If you aren't able to share some reproducer snippets, would you try a bisect? 
An interesting commit would be this ac46eb4ad66 to try and check if this crash 
happens before and after it?

--

___
Python tracker 
<https://bugs.python.org/issue41194>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41194] SIGSEGV in Python 3.9.0b3 in Python-ast.c:1412

2020-07-02 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

@arcivanov what kind of input do you pass to the compile function which leads 
this crash?

--

___
Python tracker 
<https://bugs.python.org/issue41194>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41194] SIGSEGV in Python 3.9.0b3 in Python-ast.c:1412

2020-07-02 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 
<https://bugs.python.org/issue41194>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41022] AST sum types is unidentifiable after ast.Constant became a base class

2020-06-26 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> Where they were identifable in such way? It is incorrect way, because user 
> can create a subclass of every AST class.

You are right, I didn't consider that while I was opening the issue. Also from 
3.9>= can be searched "|" in the ASDL signature to identify these types.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41022>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41088] Extend the AST Validator to validate all identifiers

2020-06-23 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +pablogsal, serhiy.storchaka

___
Python tracker 
<https://bugs.python.org/issue41088>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41088] Extend the AST Validator to validate all identifiers

2020-06-23 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
keywords: +patch
pull_requests: +20238
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21069

___
Python tracker 
<https://bugs.python.org/issue41088>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41088] Extend the AST Validator to validate all identifiers

2020-06-23 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

These identifiers include;
- 'name' of FunctionDef/ClassDef/AsyncFunctionDef/ExceptHandler
- 'name' and 'asname' of import aliases within ImportFrom and Import nodes.

Any of these cases will crash the interpreter (abort) when used with a constant 
(such as True). This is a follow-up issue on 40870

--
messages: 372154
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: Extend the AST Validator to validate all identifiers

___
Python tracker 
<https://bugs.python.org/issue41088>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   >