[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-07 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

Serhiy, for example `issubclass(typing.MutableMapping, typing.Mapping)` returns 
`True` while neither of those two are actual class objects. These relationships 
are kept mostly so that `typing.*` can be used as a drop-in replacement for 
`collections.abc.*` (plus backwards compatibility).

--

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



[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

2018-03-15 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

Yes, this is because subclassing `typing.NamedTuple` is not an actual 
subclassing, but is just a syntactic sugar for calling 
`collections.namedtuple`. A discussion about allowing subclassing/extending 
named tuples previously appeared in https://github.com/python/typing/issues/427 
but was subsequently closed as wontfix. In short, the argument was that we 
should keep feature set and implementation of named tuples simple/minimalistic, 
and instead recommend dataclasses for all more complex use cases. Note however, 
that this decision was never added to the `typing.NamedTuple` documentation. I 
think it totally makes sense to clarify this in the docs.

--

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



[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

2018-03-15 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

I would say it is too late. `typing.NamedTuple` is out there for more than a 
year and is quite actively used. A search on GitHub shows thousands of files 
that import `typing.NamedTuple` and a macroscopic fraction of those use it with 
the class syntax. I think the damage from breaking working code outweighs the 
potential bugs here. A clear example in the docs that explains how it works 
would be sufficient I think.

(Also a camel case decorator would look weird.)

--

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



[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

2018-03-16 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

> Apart from the fact that it's too late, if you had to do it over again,
could it be done as a class decorator?

Yes, this could be done as a decorator which would replace the original class 
with a named tuple after inspecting `__annotations__` and `__dict__`. (But 
again, the name would be different, since `@NamedTuple` looks weird to me.)

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
stage:  -> needs patch

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



[issue33018] Improve issubclass() error checking and message

2018-03-09 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

To be honest I am still undecided on this. In principle, I am OK with status 
quo, but I am also OK, with the PR that will prohibit non-classes. I am a bit 
worried that it may break some existing code, so it is probably not for 3.7.

--

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



[issue33075] typing.NamedTuple does not deduce Optional[] from using None as default field value

2018-03-14 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

This is actually an intended behaviour. Moreover, the implicit optionality of 
arguments that default to `None` is deprecated and will be removed in one of 
the future versions. (Note that since typing module is still provisional, this 
will likely happen without any additional notice.)

--

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



[issue33075] typing.NamedTuple does not deduce Optional[] from using None as default field value

2018-03-14 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


--
resolution:  -> not a bug
stage:  -> resolved

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



[issue33075] typing.NamedTuple does not deduce Optional[] from using None as default field value

2018-03-14 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


--
status: open -> closed

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



[issue32873] Pickling of typing types

2018-04-04 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

Apparently there is another type with a similar problem -- DefaultDict.

Will fix this now.

--

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



[issue32873] Pickling of typing types

2018-04-04 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:


New changeset 2a363d2930e29ec6d8a774973ed5a4965f881f5f by Ivan Levkivskyi in 
branch 'master':
bpo-32873: Remove a name hack for generic aliases in typing module (GH-6376)
https://github.com/python/cpython/commit/2a363d2930e29ec6d8a774973ed5a4965f881f5f


--

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



[issue32873] Pickling of typing types

2018-04-04 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


--
pull_requests: +6088

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



[issue33188] dataclass MRO entry resolution for type variable metaclasses: TypeError

2018-04-06 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


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

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



[issue33211] lineno and col_offset are wrong on function definitions with decorators

2018-04-06 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

> I was hoping to see if this was seen as a reasonable patch that might be 
> accepted.

I didn't look carefully but superficially it looks reasonable, so it is worth 
trying.

> Also, while I think it would be nice, I take it a patch for this would be 
> unlikely to be backported, right?

I think this is unlikely because it affects some public APIs.

--

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



[issue33211] lineno and col_offset are wrong on function definitions with decorators

2018-04-05 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


--
nosy: +levkivskyi

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



[issue33207] typing.Generic does not correctly call super().__init_subclass__

2018-04-04 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


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

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



[issue33315] Allow queue.Queue to be used in type annotations

2018-04-22 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

I think this issue appeared previously on typing tracker. The current 
recommendation is to escape problematic annotations with quotes:

q: 'Queue[int]'

I don't think it will be added to typing, because following this way typing 
will grow infinitely to include all generics in stdlib.

Another solution may be to add a simple `__class_getitem__` to `Queue` that 
will just return `cls` (so that we don't import `typing`). Although it will 
skip all the normal typing checks (so that `Queue[42]` will not raise at 
runtime), static type checkers like mypy will flag such errors. Guido, what do 
you think about such experiment?

--
nosy: +gvanrossum, levkivskyi

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



[issue33188] dataclass MRO entry resolution for type variable metaclasses: TypeError

2018-03-30 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

This is not a bug but an explicit design decision. Generic classes are _static_ 
typing concept and therefore are not supposed to work freely with _dynamic_ 
class creation. During discussion of PEP 560 it was decided that there should 
be at least one way to dynamically create generic classes, `types.new_class` 
was chosen for this, see 
https://www.python.org/dev/peps/pep-0560/#dynamic-class-creation-and-types-resolve-bases

Also the exception message is quite clear about this. Unfortunately, PEPs 560 
and 557 were discussed in parallel so not every possible interactions where 
thought out. But is it critical for dataclasses to call `type`? I believe there 
should be no other differences with `types.new_class`. I would say the latter 
is even better than `type` because it correctly treats `__prepare__` on the 
metaclass IIRC. So I would propose to switch from `type()` to 
`types.new_class()` for dynamic creation of dataclasses.

--

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



[issue33190] problem with ABCMeta.__prepare__ when called after types.new_class

2018-03-30 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

https://devguide.python.org/ will help you.

--

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



[issue33188] dataclass MRO entry resolution for type variable metaclasses: TypeError

2018-03-30 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

> If we're going to call new_class in make_dataclass, then we should change the 
> signature of make_dataclass to have the new_class parameters.

Why? I think we should care about what API/signature is reasonable/typical for 
dataclasses use cases, while new_class is really just an implementation detail. 
IMO passing keyword arguments to metaclass will be much more rare for 
dataclasses than passing a ready namespace.

--

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



[issue33133] Don't return implicit optional types by get_type_hints

2018-03-24 Thread Ivan Levkivskyi

New submission from Ivan Levkivskyi <levkivs...@gmail.com>:

Currently this code

def f(x: int = None):
pass

get_type_hints(f)

returns {'x': Optional[int]}. I propose to abandon this behaviour. Although 
there is not yet a definitive decision about this aspect of PEP 484, see 
https://github.com/python/typing/issues/275, I think at least at runtime we 
should not do this.

--
components: Library (Lib)
messages: 314378
nosy: gvanrossum, levkivskyi
priority: normal
severity: normal
status: open
title: Don't return implicit optional types by get_type_hints
type: behavior
versions: Python 3.7, Python 3.8

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



[issue32873] Pickling of typing types

2018-03-24 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


--
keywords: +patch
pull_requests: +5961
stage:  -> patch review

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



[issue33133] Don't return implicit optional types by get_type_hints

2018-03-25 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

OK, let us then keep this issue as a remainder that we need to update the 
runtime behaviour when the static one changes.

--

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



[issue32162] typing.Generic breaks __init_subclass__

2018-04-02 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

Thanks Will!

I think this is actually a different (although very similar issue). It looks 
like it is easy to fix. Could you please open a separate issue (and mention it 
here)? Also could you please provide a typical example when this breaks so that 
I can add an appropriate test with the fix?

--

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



[issue33207] typing.Generic does not correctly call super().__init_subclass__

2018-04-02 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


--
keywords: +patch
pull_requests: +6066
stage:  -> patch review

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



[issue33190] problem with ABCMeta.__prepare__ when called after types.new_class

2018-03-30 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

This is not a bug, but a misunderstanding:

* First, ABCMeta doesn't have `__prepare__`, it is just `type.__prepare__`
* Second, the third argument to `types.new_class` is called `kwds` for a 
reason. It is not a namespace like in `type` but the set of keywords in the 
equivalent class definition. For example:

types.new_class('Test', (A, B), {'metaclass': Meta, 'foo': 42})

id equivalent to

class Test(A, B, metaclass=Meta, foo=42):
pass

If you want to populate the namespace, then you should use the fourth argument 
`exec_body` which should be a callable that takes newly created dictionary and 
populates it with items. For your case it should be:

C = new_class("C", (MyABC,), {}, exec_body=lambda ns: ns.update(namespace))

If you want to clarify the corresponding docstring, then please open a PR. 
Otherwise you can close the issue.

--

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



[issue33188] dataclass MRO entry resolution for type variable metaclasses: TypeError

2018-03-31 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


--
keywords: +patch
pull_requests: +6035
stage:  -> patch review

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



[issue32873] Pickling of typing types

2018-03-26 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


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

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



[issue32873] Pickling of typing types

2018-03-26 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:


New changeset 834940375ae88bc95794226dd8eff1f25fba1cf9 by Ivan Levkivskyi in 
branch 'master':
bpo-32873: Treat type variables and special typing forms as immutable by copy 
and pickle (GH-6216)
https://github.com/python/cpython/commit/834940375ae88bc95794226dd8eff1f25fba1cf9


--

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



[issue33061] NoReturn missing from __all__ in typing.py

2018-03-16 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


--
nosy: +gvanrossum

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



[issue33061] NoReturn missing from __all__ in typing.py

2018-03-16 Thread Ivan Levkivskyi

New submission from Ivan Levkivskyi <levkivs...@gmail.com>:

This is clearly a bug. Would you like to make a PR?

--
nosy: +levkivskyi

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



[issue33061] NoReturn missing from __all__ in typing.py

2018-03-20 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

I think it makes sense to also fix this in 3.7. I will prepare a backport now.

--

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



[issue33061] NoReturn missing from __all__ in typing.py

2018-03-20 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi <levkivs...@gmail.com>:


--
pull_requests: +5918

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



[issue33018] Improve issubclass() error checking and message

2018-03-20 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

I am still -1 on changing this in Python 3.7, unless Guido wants this in 3.7, 
if yes, then we can go ahead. Otherwise, I think we can consider just merging 
this into master, in this case I would switch to the PR to discuss the details.

--
nosy: +gvanrossum

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



[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

2018-03-20 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

> Would it be worthwhile to show an example of a subclass that overrides or 
> extends  __new__?

I think yes. I would actually add few examples what could (and maybe also 
couldn't) be done with named tuples.

--

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:


New changeset 40472dd42de4f7265d456458cd13ad6894d736db by Ivan Levkivskyi (jab) 
in branch 'master':
bpo-33018: Improve issubclass() error checking and message. (GH-5944)
https://github.com/python/cpython/commit/40472dd42de4f7265d456458cd13ad6894d736db


--

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:


New changeset 5d8bb5d07be2a9205e7059090f0ac5360d36b217 by Ivan Levkivskyi (Miss 
Islington (bot)) in branch '3.7':
bpo-32999: Revert GH-6002 (fc7df0e6) (GH-6189) (GH-6190)
https://github.com/python/cpython/commit/5d8bb5d07be2a9205e7059090f0ac5360d36b217


--

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

I am closing this for now. We can re-open it later if problems will appear in 
3.7.

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

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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

> you'll notice that's an error?

Yes, but there are other scenarios, like using `init=False` or updating 
existing class definition and forgetting to update call sites (which will still 
work), etc.

What would we lose by not flagging this as an error? I think there are no 
legitimate use cases for such code, and implementation is straightforward. If 
you don't have time I can do this myself.

--

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:


New changeset 5d8bb5d07be2a9205e7059090f0ac5360d36b217 by Ivan Levkivskyi (Miss 
Islington (bot)) in branch '3.7':
bpo-32999: Revert GH-6002 (fc7df0e6) (GH-6189) (GH-6190)
https://github.com/python/cpython/commit/5d8bb5d07be2a9205e7059090f0ac5360d36b217


--

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



[issue33061] NoReturn missing from __all__ in typing.py

2018-03-19 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:


New changeset 4573820d2a9156346392838d455e89f33067e9dd by Ivan Levkivskyi 
(aetracht) in branch 'master':
bpo-33061: Add missing 'NoReturn' to __all__ in typing.py (GH-6127)
https://github.com/python/cpython/commit/4573820d2a9156346392838d455e89f33067e9dd


--

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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-21 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

Some part of the discussion is in https://bugs.python.org/issue32428

I still think it is important to flag things like this as an error:

@dataclass
class C:
x = field()

This is a big bug magnet. Especially taking into account that attrs behave in 
the opposite way in this case.

--

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



[issue33018] Improve issubclass() error checking and message

2018-03-21 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

> Would you merge this into master?

OK, I played with this a bit and it looks good. There is however a merge 
conflict now, and a NEWS item is missing. I will leave a comment in the PR.

--

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



[issue33061] NoReturn missing from __all__ in typing.py

2018-03-23 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

The typing repo PR is not merged yet, but I am closing this here, the remainder 
is tracked in typing repo.

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

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



[issue33061] NoReturn missing from __all__ in typing.py

2018-03-23 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:


New changeset ac5602746ed39ca6591e98e062e587121ac71371 by Ivan Levkivskyi in 
branch '3.7':
bpo-33061: Add missing 'NoReturn' to __all__ in typing.py (GH-6127) (#6162)
https://github.com/python/cpython/commit/ac5602746ed39ca6591e98e062e587121ac71371


--

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread Ivan Levkivskyi

Ivan Levkivskyi <levkivs...@gmail.com> added the comment:

Actually, the behaviour when __suclasscheck__ returns True for non-class 
objects may be used by some code. Even typing module did this, I tried to 
remove as much as possible of this, but I think there may be few such 
situations left.

Therefore, the patch by Inada-san (that makes C behaviour follow Python 
behaviour) looks reasonable to me.

--

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



[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-11 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I think we can just go ahead and allow this. If there is a volunteer, please go 
ahead, otherwise I will try to find time for this myself.

--

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



[issue34963] String representation for types created with typing.NewType(…) are opaque and unappealing

2018-10-21 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

OK, so now we have two "competing" PRs. I think I like Serhiy's PR a bit more, 
since it is simpler. I would propose to look at benchmarks and then decide. Are 
there any other factors I am missing for choosing one or other approach?

--

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



[issue35089] Remove typing.io and typing.re from documentation

2018-10-28 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue35089] Remove typing.io and typing.re from documentation

2018-10-28 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset c8a8d6b347d5a6899feb7c810d28f22f3cb151b8 by Ivan Levkivskyi 
(Sebastian Rittau) in branch 'master':
bpo-35089: Don't mention typing.io and typing.re (GH-10173)
https://github.com/python/cpython/commit/c8a8d6b347d5a6899feb7c810d28f22f3cb151b8


--

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



[issue34963] String representation for types created with typing.NewType(…) are opaque and unappealing

2018-10-28 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Serhiy, thanks for benchmarks and good suggestions!

> If make NewType a class, I would make the repr looking like a call

This is a nice idea, it indeed looks better. We can probably also use 
`_type_repr()` helper for the argument (for consistency).

> Should the NewType() result be pickleable?

This is not required by PEP 484, but I could imagine this may be useful.

> If it should be pickleable, should it be pickled by name (resulting in 
> restoring the same instance on unpickling, but failing if it is not 
> accessible by name) or by its arguments (resulting in creating a new instance 
> when unpickled)?

Logically, they should behave like class objects, so if we are going to make 
them pickleable, they should be pickled by full name.

> Should it support comparison and what values should be treated as equal?

Again, since they should behave like class objects, I think we don't need any 
dedicated `__eq__`, they should be just compared by identity.

>From performance point of view, both PRs look good. Maybe we can even combine 
>both, so that we have both fine-tuned repr and pickleability. I understand 
>this means we will get slower benchmarks for both creation and instantiation, 
>but I think it is still OK, since it is still much faster than creating a new 
>class.

--

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



[issue35119] Customizing module attribute access example raises RecursionError

2018-10-31 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Yes, this is expected, you should use ``super().__setattr__()``.

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

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



[issue35119] Customizing module attribute access example raises RecursionError

2018-11-04 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Ah, sorry, I didn't understand this was a documentation issue. Please feel free 
to submit a PR that fixes the example to use `super().__setattr__()`.

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

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



[issue35143] Annotations future requires unparse, but not accessible from Python

2018-11-02 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue35190] collections.abc.Sequence cannot be used to test whether a class provides a particular interface

2018-11-10 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

The separation may look arbitrary, but the idea is quite simple. Only those 
classes with few methods support structural checks. Those classes have few 
independent abstract methods (or even just one method), while in classes with 
large APIs like `Sequence`, the methods are not logically independent, so you 
can't say a class is 100% a `Sequence` even if types/signatures of all methods 
are correct, because e.g. `__contains__()` and `index()` should behave in 
agreement with `__getitem__()`.

We might explicitly document which ABCs support structural checks, and which 
require explicit subclassing. Also we might clarify what "abstract methods" and 
"mixin methods" mean in the table at the top. In the case of `Sequence` one can 
just implement two abstract methods and the other will behave in a "coordinated 
way". Then, simple purely abstract classes (called "One-trick ponies" in the 
source code) support structural checks.

> The collections.abc — Abstract Base Classes for Containers documentation says:

>> This module provides abstract base classes that can be used to test whether 
>> a class provides a particular interface; for example, whether it is hashable 
>> or whether it is a mapping.

Btw, Mapping also doesn't support structural checks, so the docs are quite 
outdated.

--
nosy: +levkivskyi

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



[issue35119] Customizing module attribute access example raises RecursionError

2018-11-05 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 0bee3c36d406e47fa9f99cfc1e07b701512c4f3f by Ivan Levkivskyi 
(Denis Osipov) in branch 'master':
bpo-35119: Fix RecursionError in example of customizing module attribute 
access. (GH-10323)
https://github.com/python/cpython/commit/0bee3c36d406e47fa9f99cfc1e07b701512c4f3f


--

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



[issue35119] Customizing module attribute access example raises RecursionError

2018-11-05 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-09 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Hm, I think this should be allowed. The formulation in the docs is not very 
clear, but the wording in the PEP clarifies the intention. Indeed, only 
annotations at the same scope with global declarations should be prohibited.

So I think this is a bug.

--

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



[issue34921] NoReturn not allowed by get_type_hints when future import annotations is used

2018-10-08 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue34921] NoReturn not allowed by get_type_hints when future import annotations is used

2018-10-08 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 5eea0ad50c32d38909ff4e29309e2cc3c6ccb2c0 by Ivan Levkivskyi (Noah 
Wood) in branch 'master':
bpo-34921: Allow escaped NoReturn in get_type_hints (GH-9750)
https://github.com/python/cpython/commit/5eea0ad50c32d38909ff4e29309e2cc3c6ccb2c0


--
nosy: +levkivskyi

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



[issue34760] Regression in abc in combination with passing a function to issubclass

2018-09-21 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

This was a conscious decision (i.e we decided that the old inconsistency is a 
bug). See https://bugs.python.org/issue33018 for previous discussion. What is 
your use case? If it is critical, we can reconsider this.

--

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



[issue34700] typing.get_type_hints doesn't know about typeshed

2018-09-21 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I think there is also a fourth option: add a flag to `get_type_hints()` that 
will guard evaluation of forward references, as proposed in 
https://github.com/python/typing/issues/508. If the evaluation of a "forward 
reference" raises an error, then we keep it unevaluated (i.e. a string).

--
nosy: +gvanrossum, levkivskyi

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



[issue34760] Regression in abc in combination with passing a function to issubclass

2018-09-21 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

OK, lets close this for now. We will see if there are any other situations.

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

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



[issue34700] typing.get_type_hints doesn't know about typeshed

2018-09-27 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
assignee:  -> levkivskyi

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



[issue34776] Postponed annotations break inspection of dataclasses

2018-09-27 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue35232] Add `module`/`qualname` arguments to make_dataclass for picklability

2018-11-16 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue33416] Add endline and endcolumn to every AST node

2019-01-18 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
keywords: +patch, patch
pull_requests: +11329, 11330
stage:  -> patch review

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



[issue33416] Add endline and endcolumn to every AST node

2019-01-18 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
keywords: +patch
pull_requests: +11329
stage:  -> patch review

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



[issue33416] Add endline and endcolumn to every AST node

2019-01-18 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
keywords: +patch, patch, patch
pull_requests: +11329, 11330, 11331
stage:  -> patch review

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



[issue35766] Merge typed_ast back into CPython

2019-01-19 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue33416] Add endline and endcolumn to every AST node

2019-01-22 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 9932a22897ef9905161dac7476e6976370e13515 by Ivan Levkivskyi in 
branch 'master':
bpo-33416: Add end positions to Python AST (GH-11605)
https://github.com/python/cpython/commit/9932a22897ef9905161dac7476e6976370e13515


--

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



[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-22 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue35190] collections.abc.Sequence cannot be used to test whether a class provides a particular interface (doc issue)

2018-11-29 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I would propose to keep this one open as a superseding 
https://bugs.python.org/issue23864 and close the latter (assuming we are not 
going to make all classes protocols, we I think we really shouldn't, and 
instead we should improve the docs).

--

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



[issue35341] Add generic version of OrderedDict to typing module

2018-12-02 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 68b56d02ef20479b87c65e523cf3dec1b7b77d40 by Ivan Levkivskyi (Ismo 
Toijala) in branch 'master':
bpo-35341: Add generic version of OrderedDict to typing (GH-10850)
https://github.com/python/cpython/commit/68b56d02ef20479b87c65e523cf3dec1b7b77d40


--

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



[issue35341] Add generic version of OrderedDict to typing module

2018-12-02 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue35341] Add generic version of OrderedDict to typing module

2018-11-29 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Yes, since we already have `DefaultDict`, `Counter`, and `ChainMap` from 
collections, we can also add `OrderedDict`.

--

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



[issue35341] Add generic version of OrderedDict to typing module

2018-11-29 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Also typing is technically still provisional, we can backport this to previous 
versions (at least to 3.7).

--

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



[issue33416] Add endline and endcolumn to every AST node

2018-11-22 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

issue22616 is a bit different (proposing line/column ranges instead of just 
endline/endcolumn). I am happy to close this one in favor of issue22616 if we 
agree that we will go with endline/endcolumn.

I can't guarantee, but likely I will work on this during winter holidays, 
unless there are some objections, or unless someone will do this before :-)

--

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



[issue33211] lineno and col_offset are wrong on function definitions with decorators

2018-11-22 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

2018-11-20 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I am with Inada-san actually. I would go as far as saying that

@cached_property
@abstractmethod
def something(): ...

should unconditionally raise on definition. Mostly because this is just 
misleading. This declaration doesn't guarantee that the implementation will use 
caching (neither Python nor mypy can enforce this). Caching is an 
_implementation_ detail, while ABCs are used to specify _interface_.

--

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



[issue34921] NoReturn not allowed by get_type_hints when future import annotations is used

2018-11-28 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset f71a5922916abd6cc7bf7d99ed4715b6e96e5981 by Ivan Levkivskyi (Ismo 
Toijala) in branch '3.7':
bpo-34921: Allow escaped NoReturn in get_type_hints (GH-9750) (GH-10772)
https://github.com/python/cpython/commit/f71a5922916abd6cc7bf7d99ed4715b6e96e5981


--

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



[issue35631] Improve typing docs wrt abstract/concrete collection types

2019-01-04 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I think this can be closed now. Whether to merge doc-fix backport to now 
security-only 3.6 branch is up to Ned.

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

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



[issue35631] Improve typing docs wrt abstract/concrete collection types

2019-01-04 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:


New changeset 31ec52a9afedd77e36a3ddc31c4c45664b8ac410 by Ivan Levkivskyi 
(Ville Skyttä) in branch 'master':
bpo-35631: Improve typing docs wrt abstract/concrete collection types (GH-11396)
https://github.com/python/cpython/commit/31ec52a9afedd77e36a3ddc31c4c45664b8ac410


--

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue33416] Add endline and endcolumn to every AST node

2019-01-13 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

FYI, I started working on this. I will have PR ready end of next week.

Serhiy, I don't think we should keep both this and issue22616 open. Which one 
would you prefer to close?

--

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



[issue35631] Improve typing docs wrt abstract/concrete collection types

2019-01-02 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue22616] Allow connecting AST nodes with corresponding source ranges

2019-01-14 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Closed as superseded by https://bugs.python.org/issue33416

--
superseder:  -> Add endline and endcolumn to every AST node

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



[issue22616] Allow connecting AST nodes with corresponding source ranges

2019-01-14 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi
stage:  -> resolved
status: open -> closed

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



[issue33416] Add endline and endcolumn to every AST node

2019-01-14 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> I'm sure we will find use cases though I doubt that many compiler syntax 
> errors would benefit (since a syntax error means that we don't have a 
> completely matched grammar rule).

This is mostly useful for code analysis tools and IDEs.

> BTW, does this information have to be added by the parser or could there be 
> am AST module function that deduces the end locations from the start location 
> of next sibling node or from the parent node?

There may be some other ways to do it, but currently I am adding both 
`end_lineno` and `end_col_offset` to AST, and `n_end_lineno` and 
`n_end_col_offset` in CST. The latter are needed to easily take care of 
situations like `a + (b )`, and other corner cases. I could imagine it is 
possible to live with only end position information in AST to save some memory, 
but then the code will be much harder to maintain. We can discuss details in 
the PR.

> Do we know what other languages do (carry the full span info in the AST or 
> deduce the span after the fact)?

I didn't do real research, but quick browsing shows carrying the end position 
info is quite common. But more importantly as Serhiy noted, deducing might be 
just not possible in some situations.

> It is up to you Ivan.

OK, I will close the other one as superseded by this issue.

--

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



[issue34363] dataclasses.asdict() mishandles dataclass instance attributes that are instances of subclassed typing.NamedTuple

2018-09-16 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

> [..] but I think it's the best we can do. It's consistent with any other 
> class derived from tuple or list: [...]

I agree with this argument. Sorry for delay with my response and thank you Eric 
for taking care about this issue!

--

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



[issue35814] Syntax quirk with variable annotations

2019-01-24 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 62c35a8a8ff5854ed470b1c16a7a14f3bb80368c by Ivan Levkivskyi in 
branch 'master':
bpo-35814: Allow same r.h.s. in annotated assignments as in normal ones 
(GH-11667)
https://github.com/python/cpython/commit/62c35a8a8ff5854ed470b1c16a7a14f3bb80368c


--

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



[issue35814] Syntax quirk with variable annotations

2019-01-24 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue33416] Add endline and endcolumn to every AST node

2019-01-22 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Buildbots are green, this can be now closed.

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

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



[issue35834] get_type_hints exposes an instance of ForwardRef (internal class) in its result, with `from __future__ import annotations` enabled

2019-01-27 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

It looks like an opposite side of https://github.com/python/typing/issues/508 
(I wanted to work on it, but never had time to, sorry).

This question appeared couple times before, and I think there are pros and cons 
for both returning a ForwardRef() and for raising a NameError. So as I proposed 
in the issue above, there should be a flag to `get_type_hints()` that controls 
what to do (the name of the flag, and the default are of course debatable).

Of course, we should try to make `get_type_hints()` behave as much similar as 
possible with and without PEP 563, regardless. But my point is that currently 
we have this "in-between" behavior, and it is harder to maintain this 
"in-between" behavior against PEP 563, than two clearly defined extremes.

> So I expect that when calling get_type_hints it should return the unquoted 
> string, rather than a ForwardReference.

I think the values in the returned dictionary should always be types, either 
fully evaluated, or ForwardRefs (expecting two options is easier than expecting 
three).

--

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



[issue36466] Adding a way to strip annotations from compiled bytecode

2019-04-03 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

+1 from me.

There are two ways to enable this:
* Add -OOO that would remove all three: asserts, docstrings, annotations
* Add separate --O-asserts --O-docstrings --O-annotations (or similar)

I think I like the second option more.

@cary Please note that our workflow changed, you can now submit a PR to our 
GitHub repo instead of sending a patch.

Also please include tests and docs in your PR.

--

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



[issue36495] Out-of-bounds array reads in Python/ast.c

2019-04-05 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

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



[issue36470] dataclasses.replace raises an exception if InitVar with default argument is not provided.

2019-03-29 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

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



[issue36466] Adding a way to strip annotations from compiled bytecode

2019-03-29 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +gvanrossum, levkivskyi

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



[issue36555] PEP484 @overload vs. str/bytes

2019-04-08 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Mypy already takes first overload for ambiguous arguments. This example is 
however genuinely unsafe from the static typing point of view. Please read the 
docs 
https://mypy.readthedocs.io/en/latest/more_types.html#type-checking-the-variants

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

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



[issue36042] Setting __init_subclass__ and __class_getitem__ methods are in runtime doesnt make them class method.

2019-02-20 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

I totally agree with Serhiy

--

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



[issue36320] typing.NamedTuple to switch from OrderedDict to regular dict

2019-03-17 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Good idea! This should be easy to fix/update, this was initially discussed in 
https://github.com/python/typing/issues/339.

--

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