[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-25 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> Was it mistake to make isinstance(list[int], type) returning True?

What was the motivation for this? At first glance returning True looks wrong.

--

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



[issue44659] Remove Ivan from list of typing experts

2021-07-18 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Thank you everyone! I hope our paths will cross someday.

--

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



[issue44659] Remove Ivan from list of typing experts

2021-07-17 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

You can remove me from both.

--

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



[issue44293] PEP 585 breaks inspect.isclass

2021-06-05 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Uploaded typing_inspect 0.7.0 to PyPI (it should work with Python 3.9 hopefully)

--

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



[issue44293] PEP 585 breaks inspect.isclass

2021-06-03 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Btw this reminds me I should make a PyPI release of typing_inspect (last 
release was May 2020), hopefully will make a release on this weekend.

--

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



[issue40979] typing module docs: keep text, add subsections

2020-07-22 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

FWIW I like Guido's suggestion in the PR, I would rather use "importance order" 
than alphabetical order.

--

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



[issue41249] TypedDict inheritance doesn't work with get_type_hints and postponed evaluation of annotations across modules

2020-07-16 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> I was thinking that similarly to __required_keys__ and __optional_keys__, the 
> TypedDict could preserve its original bases in a new dunder attribute, and 
> get_type_hints could work off of that instead of MRO when it is dealing with 
> a TypedDict. I would be willing to contribute the PRs to implement this if 
> the design is acceptable

TBH this is not very elegant, but I think you can go ahead with this (at least 
as a quick fix) since I don't see a better solution yet.

--

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



[issue40583] Runtime type annotation mutation leads to inconsistent behavior

2020-05-15 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

This is actually a specified behavior (motivated by memory savings for class 
objects, that are already pretty large). If you scroll down the link you posted 
it says:

> Note that if annotations are not found statically, then the 
> ``__annotations__`` dictionary is not created at all.


So what do you propose? Changing this behavior is not easy, because it would be 
a backwards incompatible change.

--
nosy: +levkivskyi

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



[issue40606] Copy property return annotations to __annotations__

2020-05-15 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue40632] AttributeError: type object 'Callable' has no attribute '_abc_registry'

2020-05-15 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I think a better question is why the `typing` in site packages is ever 
imported? I thought that an stdlib module always takes precedence over an 
installed one with the same name.

--
nosy: +levkivskyi

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



[issue40595] AttributeError from type annotation

2020-05-15 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Yes, this is as expected. A recommended workaround is to define a type alias 
like `Match = re.Match` before the class body. You can also suppress the 
exception with `from __future__ import annotations` (so that the annotations 
are not evaluated), but static type checkers like mypy will still force you to 
use the alias.

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

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



[issue40494] collections.abc.Callable and type variables

2020-05-04 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Here I think the behavior of typing.Callable is correct.

--

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



[issue40408] GenericAlias does not support nested type variables

2020-05-04 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> But this behavior is not specified and is not covered by tests.

FWIW, to be most close to the static type checkers behavior, both D[int][str] 
and D[int, str] should fail for D = Dict[T, List]. Not important however, since 
this is a really rare corner case I think.

--

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



[issue40398] get_args(Callable) fails

2020-04-26 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Oh my, this looks like another bug. I don't have Python 3.8 at hand so just 
tried `typing_inspect` on Python 3.6. I think this may be caused by the "double 
use" of _GenericAlias for which you opened your WIP PR.

--

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



[issue40398] get_args(Callable) fails

2020-04-26 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I think it should return empty tuple: First, for consistency with other things 
like get_args(Tuple) == () and get_args(List) == (). Second, although Callable 
is equivalent to Callable[..., Any] in the static world, authors of some 
runtime checkers might want to distinguish whether a user wrote one or another.

--

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



[issue39942] Making instance of `TypeVar` fails because of missing `__name__`

2020-04-20 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue39942] Making instance of `TypeVar` fails because of missing `__name__`

2020-04-20 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset a25a04fea5446b1712cde0cff556574be139285a by HongWeipeng in branch 
'master':
bpo-39942:Fix failure in `TypeVar` when missing `__name__` (GH-19616)
https://github.com/python/cpython/commit/a25a04fea5446b1712cde0cff556574be139285a


--
nosy: +levkivskyi

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



[issue40257] Improve the use of __doc__ in pydoc

2020-04-12 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

FWIW I like the idea. There are many objects in typing module that are not 
classes, it would be great to display docs for them.

--

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



[issue40086] test_etree is skipped in test_typing due to cElementTree removal

2020-03-28 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:


New changeset 34b0598295284e3ff6cedf5c05e159ce1fa54d60 by Furkan Önder in 
branch 'master':
bpo-40086: Update/fix test_etree test case in test_typing (GH-19189)
https://github.com/python/cpython/commit/34b0598295284e3ff6cedf5c05e159ce1fa54d60


--
nosy: +levkivskyi

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



[issue39810] Generic script for finding bugs in get_source_segment

2020-03-06 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue39019] Missing class getitems in standard library classes

2020-02-23 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> Once PEP 585 is implemented these should be rolled back and replaced with 
> that, right?

I would say that ideally yes.

--

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



[issue39204] Automate adding Type Annotations to Documentation

2020-01-10 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue39168] Generic type subscription is a huge toll on Python performance

2019-12-31 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

OK, here is the original issue https://github.com/python/typing/issues/681. I 
asked the author to open an issue here instead, but likely they didn't open one.

--

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



[issue39168] Generic type subscription is a huge toll on Python performance

2019-12-31 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

This issue came up few times before (although I can't find an issue here on 
b.p.o., maybe it was on typing-sig list). Although in micro-benchmarks the 
impact may seem big, in vast majority of applications it is rarely more that a 
percent or so.

On the other hand, IIRC the only reason `Generic.__new__()` exists is so that 
one can't write `Generic()` (i.e. instantiate a plain `Generic`). I would be 
totally fine if we just remove it in 3.9. Hopefully, people already learned 
what typing is for and don't need so much "protection" against not very 
meaningful things. Also, the error can be given by static type checkers, there 
is probably no need for a runtime error.

--

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



[issue39019] Missing class getitems in standard library classes

2019-12-30 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:


New changeset 09c482fad11c769be38b2449f1056e264b701bb7 by Ivan Levkivskyi 
(Batuhan Taşkaya) in branch 'master':
bpo-39019: Implement missing __class_getitem__ for SpooledTemporaryFile 
(GH-17560)
https://github.com/python/cpython/commit/09c482fad11c769be38b2449f1056e264b701bb7


--

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



[issue39019] Missing class getitems in standard library classes

2019-12-30 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:


New changeset 4dc5a9df59837446ec1dc5b7a0e6ce95ae5b5cec by Ivan Levkivskyi 
(Batuhan Taşkaya) in branch 'master':
bpo-39019: Implement missing __class_getitem__ for subprocess classes (GH-17558)
https://github.com/python/cpython/commit/4dc5a9df59837446ec1dc5b7a0e6ce95ae5b5cec


--

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 59d06b987db34cde8783e265709366d244c9e35b by Ivan Levkivskyi (Bar 
Harel) in branch '3.7':
[3.7] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17685)
https://github.com/python/cpython/commit/59d06b987db34cde8783e265709366d244c9e35b


--

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 0846e5d4603434c2bbf8a528677cf1ff3fe29b95 by Ivan Levkivskyi (Bar 
Harel) in branch '3.8':
[3.8] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17684)
https://github.com/python/cpython/commit/0846e5d4603434c2bbf8a528677cf1ff3fe29b95


--

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-22 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset eae87e3e4e0cb9a0ce10c2e101acb6995d79e09c by Ivan Levkivskyi (Bar 
Harel) in branch 'master':
bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336)
https://github.com/python/cpython/commit/eae87e3e4e0cb9a0ce10c2e101acb6995d79e09c


--

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



[issue39102] Increase Enum performance

2019-12-20 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue39046] collections.abc.Reversible should not be a subclass of Hashable

2019-12-20 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue38947] dataclass defaults behave inconsistently for init=True/init=False when default is a descriptor

2019-12-06 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-05 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
keywords: +easy (C)

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



[issue38978] Implement __class_getitem__ for Future, Task, Queue

2019-12-05 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I see the point in using ``__class_getitem__`` in Python classes too, we can 
probably start using a dummy method returning class object itself now. Also PEP 
585 already has a long list of candidates for "proper" ``__class_getitem__`` 
support. Maybe we can add these classes to that list? Maybe it would make sense 
to also have ``PathLike`` there?

--
nosy: +lukasz.langa

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



[issue27501] Add typing.py class describing a PEP 3118 buffer object

2019-11-26 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Cross-ref to the typing issue https://github.com/python/typing/issues/593. It 
looks like there is some interest in this feature.

--

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



[issue38908] Troubles with @runtime_checkable protocols

2019-11-24 Thread Ivan Levkivskyi


New submission from Ivan Levkivskyi :

The PEP 544 specifies that:

A protocol can be used as a second argument in isinstance() and issubclass() 
only if it is explicitly opt-in by @runtime_checkable decorator.

It is not specified exactly whether this should be enforced by static type 
checkers or at runtime. Currently it is enforced in both cases: mypy flags this 
as error, and a TypeError is raised at runtime.

There is however a problem with current runtime implementation: abc and 
functools modules may call issubclass() on non-runtime checkable protocols if 
they appear as explicit superclasses. This is currently solved by a 
sys._getframe() hack in  typing module.

The problem is that current solution is incomplete. For example, the TypeError 
is not raised in the case of non-method protocols:

>>> class P(Protocol):
... x: int
... 
>>> 
>>> class C: ...
... 
>>> isinstance(C(), P)
False  # should be TypeError

I tried to fix it this morning but after an hour of attempts to tweak the 
existing hack I gave up. It looks like there are only two reasonable solutions:

* Don't enforce @typing.runtime_checkable at runtime, make it a 
type-checker-only feature (like @typing.final).
* Add a little helper to abc module that would skip classes in MRO for which 
C._is_protocol is True but C._is_runtime_protocol is False.

Any thoughts/preferences?

--
components: Library (Lib)
messages: 357400
nosy: gvanrossum, levkivskyi
priority: normal
severity: normal
status: open
title: Troubles with @runtime_checkable protocols
type: behavior
versions: Python 3.8, Python 3.9

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



[issue38834] TypedDict: no way to tell which (if any) keys are optional at runtime

2019-11-24 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-22 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> So why is it bad that in the example class B is considered a "subclass" of 
> os.PathLike by implementing the protocol?

This is not bad, my understanding of the problem is that currently B is 
considered a subclass of A, while the latter should not be structural.

To give an analogy with PEP 544 (sorry, this is my favourite one :-)) consider 
this:

class P(Protocol):
def some(self): ...

class C:
def some(self): ...

Here C is obviously a "subclass" of P, but:

class Bad(P):  # <- this is _no_ a protocol, just a nominal class
pass   # explicitly subclassing P

class Good(P, Protocol):  # <- this is a subprotocol that
pass  # happened to be identical to P

So here C is a "subclass" of Good, but not a "subclass" of Bad.

--

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-11-21 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-11-21 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 0aca3a3a1e68b4ca2d334ab5255dfc267719096e by Ivan Levkivskyi 
(benedwards14) in branch 'master':
bpo-37838: get_type_hints for wrapped functions with forward reference 
(GH-17126)
https://github.com/python/cpython/commit/0aca3a3a1e68b4ca2d334ab5255dfc267719096e


--

___
Python tracker 
<https://bugs.python.org/issue37838>
___
___
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

2019-11-20 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
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



[issue36287] Make ast.dump() not output optional default fields

2019-11-19 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

No objections from me assuming you are going forward along the way proposed by 
Serhiy (i.e. only skip values for certain fields if value is the default, not a 
blanket skip for all Nones and empty lists).

--

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



[issue37948] get_type_hints fails if there are un-annotated fields in a dataclass

2019-11-17 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> I'm not sure what can be done with this. The problem is that the decorator 
> doesn't know what's in the caller's namespace. The type being added is 
> "typing.Any". If the caller doesn't import typing, then get_type_hints will 
> fail (as demonstrated here).

IIUC the main problem is that get_type_hints() fails even if typing is 
imported. I would expect this to work (just repeating the original example in a 
more compact form):

import dataclasses
import typing
A = dataclasses.make_dataclass('A', ['a_var'])
typing.get_type_hints(A)  # This currently crashes

Interestingly, if I use a very similar call that it works:

>>> typing.get_type_hints(A, globalns=globals())
{'a_var': typing.Any}

So the core of the issue is that the globals are identified incorrectly, and 
indeed if I look at the generated class it looks wrong:

>>> A.__module__
'types'  # Should be '__main__'

I think we should fix the ``__module__`` attribute of the dynamically generated 
dataclasses (for example the way it is done for named tuples).

Btw, https://github.com/python/cpython/pull/14166 may potentially fix the 
``__module__`` attribute here too.

--

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



[issue38782] Convert importlib.abc to use typing.Protocol

2019-11-15 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-11-11 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

The PR was linked by mistake (it is for a different issue), so I unlinked it.

--

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-11-11 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
keywords:  -patch
stage: patch review -> needs patch

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-11-11 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
pull_requests:  -16560

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



[issue38756] Add generic versions of weakref types to typing module

2019-11-10 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

We already have https://github.com/python/typing/issues/508 for "smart" 
`get_type_hints()` that would use LBYL. Also we had a similar discussion about 
PathLike, and ultimately decided not to make `typing` a place for generic 
versions of everything.

Finally, in view of PEP 585 some of these things may actually become 
subscriptable at runtime. So I propose to just close this issue.

--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue38756>
___
___
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 before Python 4.0

2019-10-27 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

IMO 3.10 would be better, since 3.9 would be too soon (it would be like a 
schedule for a normal deprecation).

Also if we are really doing this, I think it is better to announce this soon.

Also we should try to fix relevant issues related to string annotations (in 
typing and dataclasses), like https://github.com/python/typing/issues/508, 
https://github.com/python/typing/issues/574, 
https://bugs.python.org/issue37838, https://bugs.python.org/issue34776 and 
https://bugs.python.org/issue37948.

--
nosy: +gvanrossum

___
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



[issue38467] Misspelled argument names for typing.get_origin and get_args

2019-10-13 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue38467] Misspelled argument names for typing.get_origin and get_args

2019-10-13 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset fdfe2833ace93021278fe4c41c40e1d08d70abf9 by Ivan Levkivskyi 
(Sebastian Rittau) in branch 'master':
bpo-38467: Fix argument name of typing functions (GH-16753)
https://github.com/python/cpython/commit/fdfe2833ace93021278fe4c41c40e1d08d70abf9


--

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



[issue38467] Misspelled argument names for typing.get_origin and get_args

2019-10-13 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I think adjusting the docs would be less disruptive than changing 
implementation. Would you like to make a PR?

--

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



[issue38459] typing: Classes that inherit `Generic[...]` indirectly aren't considered generic.

2019-10-13 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

The docs for typing module are clear about this:
```
Using a generic class without specifying type parameters assumes Any for each 
position.
```
There is also an example involving a base class.

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

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



[issue28556] typing.py upgrades

2019-10-13 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
pull_requests: +16320
pull_request: https://github.com/python/cpython/pull/16743

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



[issue38424] typing.Generator shorthand

2019-10-11 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Actually Serhiy is right, I just checked and found this sentence:
```
Alternatively, annotate your generator as having a return type of either 
Iterable[YieldType] or Iterator[YieldType]
```

--
resolution:  -> works for me
stage:  -> resolved
status: open -> closed

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



[issue38424] typing.Generator shorthand

2019-10-11 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python

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



[issue38424] typing.Generator shorthand

2019-10-11 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

If you would like to propose a doc fix, then please go ahead and make a PR.

--

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



[issue38446] Ambiguous signature for builtins.__build_class__

2019-10-11 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue38431] dataclasses.InitVar breaks with typing.Optional

2019-10-11 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue38424] typing.Generator shorthand

2019-10-11 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue38348] Make python -m ast more configurable

2019-10-10 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I don't have any strong opinion either way, so it looks like we need to wait 
until someone else will ask for this.

--

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



[issue32996] Improve What's New in 3.7

2019-10-10 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset d47f0dd2e85ce032aebfedbde18cdb2e728fa79f by Ivan Levkivskyi (M. 
Eric Irrgang) in branch 'master':
bpo-32996: Documentation fix-up. (GH-16646)
https://github.com/python/cpython/commit/d47f0dd2e85ce032aebfedbde18cdb2e728fa79f


--
nosy: +levkivskyi

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



[issue38396] ast.literal_eval doesn't give information about node except the type of it

2019-10-07 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

The downside however is that exception messages can become very long. So I am 
not sure we should change this.

--
nosy: +serhiy.storchaka

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



[issue38348] Make python -m ast more configurable

2019-10-04 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue38352] In typing docs, note explicit import needed for IO and Pattern/Match

2019-10-04 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> So, my request is: In the sections for the IO/TextIO/BinaryIO and 
> Pattern/Match classes, include text warning the user that these types are not 
> imported when you do `from typing import *`.

I don't think this should really be a warning, probably just a note, but 
otherwise I totally agree. Would you like to make a PR?

--

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



[issue38298] Base class of generic type has wrong `cls` argument in classmethods

2019-09-28 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Yes, it is unfortunately hard to support with the new design. Also note that 
this was previously discussed at https://github.com/python/typing/issues/629. I 
think we can close this, since the other issue has more context.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

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



[issue38291] Unclear status of the typing.io and typing.re pseudo-modules in docs and runtime

2019-09-27 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Guido, what is your final opinion on this?

--
nosy: +gvanrossum, levkivskyi

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



[issue38290] cleanup ababstractproperty in typing.py

2019-09-27 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue38166] ast identifies incorrect column for compound attribute lookups

2019-09-21 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

As Serhiy explained, there is no bug here, _potentially_ we could change AST so 
that attribute name (i.e. "b" in "a.b") is wrapped in a special node holding 
the position info (similar to ``ast.arg``), but it is a breaking change and is 
not worth it. You can re-open your issue on PyLint tracker.

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

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



[issue28556] typing.py upgrades

2019-09-16 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 81528ba2e81c39f4d6bca5b785e818c7d08b8501 by Ivan Levkivskyi in 
branch 'master':
bpo-28556: Update the opening note in typing docs (GH-16204)
https://github.com/python/cpython/commit/81528ba2e81c39f4d6bca5b785e818c7d08b8501


--

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



[issue28556] typing.py upgrades

2019-09-16 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
pull_requests: +15808
pull_request: https://github.com/python/cpython/pull/16204

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



[issue37953] Fix ForwardRef equality checks

2019-09-13 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue37953] Fix ForwardRef equality checks

2019-09-13 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset e082e7cbe4a934b86f7a07354d97d4e14a9dd46a by Ivan Levkivskyi 
(plokmijnuhby) in branch 'master':
bpo-37953: Fix ForwardRef hash and equality checks (GH-15400)
https://github.com/python/cpython/commit/e082e7cbe4a934b86f7a07354d97d4e14a9dd46a


--

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



[issue38008] ContextManager and AsyncContextManager protocols can't be subclassed

2019-09-12 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
components: +Library (Lib)
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 2.7, Python 3.5, Python 3.6, Python 3.7

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



[issue38008] ContextManager and AsyncContextManager protocols can't be subclassed

2019-09-12 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 692a0dc91597b7fb350383b633dc4d044cbd360e by Ivan Levkivskyi 
(Divij Rajkumar) in branch 'master':
bpo-38008: Move builtin protocol whitelist to mapping instead of list (GH-15647)
https://github.com/python/cpython/commit/692a0dc91597b7fb350383b633dc4d044cbd360e


--

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



[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-09-09 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> I anyway always wonder, why functions, which are methods, do not hold a 
> reference to the class, which they belong to.

This may indeed be a useful feature on its own, but it will also require a much 
more wider discussion.

--

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



[issue38008] ContextManager and AsyncContextManager protocols can't be subclassed

2019-09-02 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> I'd like to take a stab at putting up a patch for this

Great, thanks! Go ahead and try it.

--
nosy: +levkivskyi

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



[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-09-02 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

(Sorry for typos, fixed now.)

> Maybe any upcoming python version could store this information in __local__ ? 
> So maybe we could clone this ticket to the python core in order to address 
> this?

I would say it is a too big change, and it is unlikely to happen only for the 
reason like this issue.

> Why is the own class not always inside the __globals__ list of the methods? 
> Is there a reason? Or is this just a missing feature of the python-core?

Because this is a reference to the actual module global namespace. If the class 
is defined inside another function, it is not in the module namespace.

You can probably use the metaclass workaround, but note that it will actually 
modify the module globals (since __globals__ is not a copy).

--

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



[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-09-02 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-09-02 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> Maybe any upcoming python version could store this information in __local__ ? 
> So maybe we could clone this ticket to the python core in order to address 
> this?

I would say it is a too big change, and it is unlikely to happen only for the 
reason like this issue.

> Why is the own class not always inside the __globals__ list of the methods? 
> Is there a reason? Or is this just a missing feature of the python-core?

Because this is a reference to the actual module global namespace. If the class 
defined inside another function, it is not the module namespace.

You can probably use the metaclass workaround, but note that it will actually 
modify the module globals (since __globals__ is not a copy).

--

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



[issue37948] get_type_hints fails if there are un-annotated fields in a dataclass

2019-09-02 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

It looks like https://github.com/python/cpython/pull/9518 will fix also this 
one.

--
nosy: +levkivskyi

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



[issue37923] Combining typing.get_type_hints and inspect.signature

2019-08-23 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Somewhat related to https://bugs.python.org/issue37496

--
nosy: +eric.snow, yselivanov

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



[issue37920] Support subscripting os.PathLike and make it valid at runtime

2019-08-22 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

There is an (old) similar proposal https://github.com/python/typing/issues/402 
btw.

Taking into account that this can be made only in 3.9, what is the benefit over 
``from __future__ import annotations`` (that one can use already) do you see?

IMO there are only rare cases of type aliases and base classes, so I don't see 
much benefit. Also making it generic will require importing ``typing`` from 
``os`` which may make it slower to import (``typing`` is a really heavy module, 
in particular because it imports many other modules).

--

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



[issue28556] typing.py upgrades

2019-08-22 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
pull_requests: +15104
pull_request: https://github.com/python/cpython/pull/15396

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



[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-08-19 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Thanks for reporting!

I spent some time thinking about this and I can't find any reasonable way of 
doing this, sorry. Anyway, let's keep this open, maybe someone will come up 
with a proposal.

--

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



[issue37835] typing.get_type_hints wrong namespace for forward-declaration of inner class

2019-08-16 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-08-14 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
keywords: +newcomer friendly

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-08-13 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> Using `__wrapped__` if present sounds like a good idea.

Yeah, I like this idea, this will likely cover most use cases (since most 
people actually do use @wraps).

--

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



[issue37806] Infinite recursion with typing.get_type_hints

2019-08-10 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
assignee:  -> levkivskyi

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



[issue37809] Alias typing.NamedTuple to collections

2019-08-10 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> FWIW, I had updated the docs for namedtuple() to link to typing.NamedTuple.  
> I think that should suffice.

Thank you!  I looked at the docs everything looks good.  I think this can be 
closed now.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

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



[issue15987] Provide a way to compare AST nodes for equality recursively

2019-08-07 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> If consensus has been reached on this, I am willing to do the work.

It looks like there is already an active PR 
https://github.com/python/cpython/pull/14970, there are some non-implemented 
comments from a core review.

--

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



[issue37496] Support annotations in signature strings.

2019-08-07 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> I have a couple of questions about how to use `ast_unparse.c`'s 
> `expr_as_unicode` function:

> 1. Should I create a new function in the `ast` module that exposes that C 
> function in Python in order to use it in `Lib/inspect.py`?
> 2. Would it be better to just re-use the _AST to string_ implementation in 
> `Tools/unparse.py`?

Hm, TBH I am not sure which one is better, I am leaning towards option 1, but I 
add more people to get some opinions.

--
nosy: +gvanrossum, lukasz.langa

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



[issue28869] __module__ attribute is not set correctly for a class created by direct metaclass call

2019-07-21 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

FWIW I like Serhiy's approach more. I have never seen a single metaclass 
overriding type.__call__, while overriding type.__new__ is a common practice.

--

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



[issue37496] Support annotations in signature strings.

2019-07-19 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

You might want to look into how PEP 563 is implemented, it has a utility to 
turn an AST back into a string (I assume this is what you want).

--

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



[issue18374] ast.parse gives wrong position (col_offset) for some BinOp-s

2019-07-09 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8, Python 3.9 -Python 3.5

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



[issue18374] ast.parse gives wrong position (col_offset) for some BinOp-s

2019-07-09 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 68bd9c5691c4899d21cc7fe6cce7cd22b2f5ccb0 by Ivan Levkivskyi (Miss 
Islington (bot)) in branch '3.8':
bpo-18374: fix tests to check the correct thing about line numbers (GH-14659) 
(GH-14672)
https://github.com/python/cpython/commit/68bd9c5691c4899d21cc7fe6cce7cd22b2f5ccb0


--

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



[issue18374] ast.parse gives wrong position (col_offset) for some BinOp-s

2019-07-09 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 430a9f44fe22f029ae8cfeecb46621d7e199414b by Ivan Levkivskyi (Carl 
Friedrich Bolz-Tereick) in branch 'master':
bpo-18374: fix tests to check the correct thing about line numbers (GH-14659)
https://github.com/python/cpython/commit/430a9f44fe22f029ae8cfeecb46621d7e199414b


--

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



[issue18374] ast.parse gives wrong position (col_offset) for some BinOp-s

2019-07-08 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 110a47c4f42cf4db88edc1876899fff8f05190fb by Ivan Levkivskyi (Carl 
Friedrich Bolz-Tereick) in branch 'master':
bpo-18374: fix wrong col_offset of some ast.BinOp instances (GH-14607)
https://github.com/python/cpython/commit/110a47c4f42cf4db88edc1876899fff8f05190fb


--

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



[issue37496] Support annotations in signature strings.

2019-07-05 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



  1   2   3   4   5   6   7   >