Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue32216>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue32284>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ivan Levkivskyi added the comment:
> As for __class_getitem__, why not implement type.__getitem__ instead of
> hacking PyObject_GetItem()?
This question was raised by Mark Shannon on python-dev. Actually, my initial
implementation did exactly this, but I didn't like it for two
Ivan Levkivskyi added the comment:
Guido, what is your preference for the implementation of ``__class_getitem__``:
``PyObject_GetItem`` (current one) or ``type.__getitem__`` (old one)? Can we
just go ahead with the version you like and then re-consider if some objections
will appear? I am
Ivan Levkivskyi added the comment:
New changeset 5364b5cd7571f2dfa75acd37b388c14ac33fef73 by Ivan Levkivskyi in
branch 'master':
bpo-32225: Implementation of PEP 562 (#4731)
https://github.com/python/cpython/commit/5364b5cd7571f2dfa75acd37b388c1
Ivan Levkivskyi added the comment:
Travis build on master successful, so I am closing this issue.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ivan Levkivskyi added the comment:
New changeset 2b5fd1e9ca9318673989e6ccac2c8acadc3809cd by Ivan Levkivskyi in
branch 'master':
bpo-32226: Implementation of PEP 560 (core components) (#4732)
https://github.com/python/cpython/commit/2b5fd1e9ca9318673989e6ccac2c8a
Ivan Levkivskyi added the comment:
Interesting. I have noticed similar when I tried to add a fast loop proposed by
Serhiy. It should save at least one pointer comparison for base class, but
sometimes it actually led to slow-downs (although very small). How can one
fight this kind of problems
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue32320>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Ivan Levkivskyi :
--
pull_requests: +4800
___
Python tracker
<https://bugs.python.org/issue32226>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ivan Levkivskyi added the comment:
Stefan, your last example is formally speaking OK, if one reads the "Execution
model" literally. The original example is however too ambiguous, so it is good
that it triggers an error.
I think there is a chance to improve the error message h
Ivan Levkivskyi added the comment:
I have also noticed this problem and I like the idea. It appeared some time ago
on python-ideas, but no one has written a patch.
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue32
Ivan Levkivskyi added the comment:
A possible question here is should we give an error for any non-callable name
in `__dict__` which is not in `__annotations__` or only for `Field`s?
After some thinking I am actually leaning towards the first option.
--
nosy: +gvanrossum, levkivskyi
Ivan Levkivskyi added the comment:
> I'm not sure I understand the distinction.
Initially I thought about only flagging code like this:
@dataclass
class C:
x = field()
But not this:
@dataclass
class C:
x = 42
Now I think we should probably flag both as errors.
> How
Ivan Levkivskyi added the comment:
> I liked the original design better, where things without annotations would
> just be ignored. What changed?
With the original proposal the ignored variables without annotations will
behave as class variables. This "conflicts" with PEP 52
Ivan Levkivskyi added the comment:
Just to clarify the previous comment, I still think that flagging this
@dataclass
class C:
x = field()
is important, since simply ignoring a ``field()`` will be too confusing
(especially for ``attrs`` users).
The previous comment is about
@dataclass
Ivan Levkivskyi added the comment:
> There is no real conflict with PEP 526 though. PEP 526 introduces ClassVar so
> the type checker can be made to understand. PEP 557 allows omitting ClassVar
> in case you don't care about type checkers. So I think we should stick with
>
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue32473>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue32471>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ivan Levkivskyi added the comment:
@Eric
> I'm closing this, and will open another issue to raise an error for: ...
I think we also need a separate issue for not overriding __repr__ etc, if
'__repr__' in cls.__dict__.
--
___
Pyth
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue32513>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Ivan Levkivskyi :
--
pull_requests: +6624
___
Python tracker
<https://bugs.python.org/issue28556>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ivan Levkivskyi added the comment:
New changeset f65e31fee3b55dfb6ed5398179d5c5d6b502dee5 by Ivan Levkivskyi in
branch 'master':
bpo-28556: Don't simplify unions at runtime (GH-6841)
https://github.com/python/cpython/commit/f65e31fee3b55dfb6ed539817
Ivan Levkivskyi added the comment:
New changeset 09ca5906b7d1619b7efed0bebb6f3c424fe3d83b by Ivan Levkivskyi (Miss
Islington (bot)) in branch '3.7':
bpo-28556: Don't simplify unions at runtime (GH-6841) (GH-6979)
https://github.com/python
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue33616>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue33569>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ivan Levkivskyi added the comment:
This is now fixed.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ivan Levkivskyi :
--
keywords: +patch
pull_requests: +6746
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33616>
___
___
Py
Ivan Levkivskyi added the comment:
New changeset 6e33f810c9e3a549c9379f24cf1d1752c29195f0 by Ivan Levkivskyi
(Andrés Delfino) in branch 'master':
bpo-32769: A new take on annotations/type hinting glossary entries (GH-6829)
https://github.com/python/cpyt
Change by Ivan Levkivskyi :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue33624>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue33649>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ivan Levkivskyi added the comment:
New changeset 717204ffcccfe04a34b6c4a52f0e844fde3cdebe by Ivan Levkivskyi
(Andrés Delfino) in branch '3.6':
[3.6] bpo-32769: A new take on annotations/type hinting glossary entries
(GH-6829) (GH-7128)
https://github.com/python/cpyt
Ivan Levkivskyi added the comment:
New changeset 09f3221fbbf72692308149054e4f7668b08b22eb by Ivan Levkivskyi
(Serhiy Storchaka) in branch 'master':
bpo-33652: Improve pickle support in the typing module. (GH-7123)
https://github.com/python/cpyt
Ivan Levkivskyi added the comment:
Yes, these are just legacy from times when TypeVars were serialized by value,
not by identity like now. I think it should be safe to remove them. Would you
like to make a PR?
--
___
Python tracker
<ht
Ivan Levkivskyi added the comment:
New changeset 97b523db7c79c18c48516fba9410014d9896abc4 by Ivan Levkivskyi
(Serhiy Storchaka) in branch 'master':
bpo-33652: Remove __getstate__ and __setstate__ methods in typing. (GH-7144)
https://github.com/python/cpyt
Ivan Levkivskyi added the comment:
I think this can be closed now.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ivan Levkivskyi added the comment:
Hm, replacing the return with a random string, this leads to another crash:
Traceback (most recent call last):
File "", line 1, in
File "/Users/ilevkivskyi/src/cpython/Lib/_sitebuiltins.py", line 103, in
__call__
return pydo
Ivan Levkivskyi added the comment:
Adding Yury as an inspect expert. I don't think this is something urgent, we
can probably postpone this to 3.7.1.
--
nosy: +yselivanov
___
Python tracker
<https://bugs.python.org/is
Change by Ivan Levkivskyi :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.o
Ivan Levkivskyi added the comment:
Oh yes, this is a "stateful" bug. It will not appear if run in isolation. Btw,
the underlying bug will be worse with `from __future__ import annotations`, so
it would make sense to fix this sooner than later.
--
nosy: +lu
Ivan Levkivskyi added the comment:
> 3.7 is less convenient and less consistent
Taking into account that internal API is something one should never use, I
don't think these terms apply here. Anyway, we will provide some helpers for
external use in one of the next
Ivan Levkivskyi added the comment:
New changeset 336c945858055059a65134d4c501a85037d70d99 by Ivan Levkivskyi
(Ville Skyttä) in branch 'master':
bpo-34336: Don't promote possibility to leave out typing.Optional (#8677)
https://github.com/python
Change by Ivan Levkivskyi :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ivan Levkivskyi added the comment:
FWIW I am rather -1 on this. More detailed errors messages are always good, but
in the proposed form it looks more like a distraction. I think just showing a
fully qualified name of the function would be both more concise and more
informative, since the
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue34363>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ivan Levkivskyi added the comment:
OK, so the crux of the bug is this difference:
>>> a = (1, 2)
>>> tuple(x for x in a)
(1, 2)
>>> NamedTupleAttribute(x for x in a)
NamedTupleAttribute(example= at 0x10e2e52a0>)
A potential solution would be to either
Ivan Levkivskyi added the comment:
The problem with this solution is that it may brea (relatively common) use case
of tuple valued fields, e.g.:
>>> tuple(*[x for x in a])
Traceback (most recent call last):
File "", line 1, in
TypeError: tuple expected at most
Ivan Levkivskyi added the comment:
Eric, I like your solution. It is probably not perfect, but at least it solves
the existing problem without introducing obvious problems.
Neil, your way will not work since named tuples don't have NamedTuple in their
MROs:
CustomNT.mro == (CustomNT,
Ivan Levkivskyi added the comment:
This is an intentional change. It would be a bad idea to use `_name` instead of
`__name__`, because semantics is subtly different. Also the fact that type in
typing object used to be actual class object was an implementation detail (also
typing is still
Ivan Levkivskyi added the comment:
Oh I just re-read my comment and there are so many typos that I will write a
new one, sorry.
--
___
Python tracker
<https://bugs.python.org/issue34
Ivan Levkivskyi added the comment:
This is an intentional change. It would be a bad idea to use `__name__` instead
of what is currently `_name`, because semantics is subtly different. Also the
fact that types in typing module used to be actual class objects was an
implementation detail
Change by Ivan Levkivskyi :
--
Removed message: https://bugs.python.org/msg323770
___
Python tracker
<https://bugs.python.org/issue34422>
___
___
Python-bug
Ivan Levkivskyi added the comment:
This is why we have 4 months of betas :-)
On one hand making objects in `typing` module not classes was intentional, but
on another hand this use case looks totally fine.
I would say we could update the check in `functools` to accept more things. I
am
Ivan Levkivskyi added the comment:
> Could we revert abstract types in `typing` to respond True to
> `isinstance(..., type)` again?
No, making them classes will cause significant performance penalty (I don't
remember numbers now, but importing `typing` may be twice slower). Plus
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue34499>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ivan Levkivskyi added the comment:
TBH, I don't like this idea. Consider this situation:
@singledispatch
def what(x: Iterable) -> None:
print('general case')
@what.register
def _(x: Sequence[int]) -> None:
print('special case'
Ivan Levkivskyi added the comment:
It was a deliberate decision. You can find some motivation in PEP 560, and yes
we used provisional status here. It was a hard decision, but we decided that
giving up few percent of backwards compatibility is a reasonable price for up
to 5x performance
Ivan Levkivskyi added the comment:
> but even then types in the typing could themselves implement
> `__instancecheck__` and `__subclasscheck__` and retain the old behavior.
It doesn't work that way. `__instancecheck__` and `__subclasscheck__` tweaks
the behaviour of superclas
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
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
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.or
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, th
Change by Ivan Levkivskyi :
--
assignee: -> levkivskyi
___
Python tracker
<https://bugs.python.org/issue34700>
___
___
Python-bugs-list mailing list
Un
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue34776>
___
___
Python-bugs-list mailing list
Unsubscribe:
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/5eea0ad50c32d38909ff4e29309e2c
Change by Ivan Levkivskyi :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
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/issue34
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
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/c8a8d6b347d5a6899feb7c810
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 consiste
Change by Ivan Levkivskyi :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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.or
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue35143>
___
___
Python-bugs-list mailing list
Unsubscribe:
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: clo
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/cpyt
Change by Ivan Levkivskyi :
--
nosy: -miss-islington
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
Change by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<https://bugs.python.org/issue35232>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ivan Levkivskyi added the comment:
SETUP_ANNOTATIONS and STORE_ANNOTATION opcodes are documented in documentation
for dis module. Should they be documented also somewhere else?
--
nosy: +levkivskyi
___
Python tracker
<http://bugs.python.
New submission from Ivan Levkivskyi:
__module__ attribute is set differently depending on whether a metaclass is
explicitly called or invoked in a class statement:
>>> A = ABCMeta('A', (), {})
>>> A.__module__
'abc'
>>> class B(metaclas
Changes by Ivan Levkivskyi :
--
type: -> behavior
___
Python tracker
<http://bugs.python.org/issue28869>
___
___
Python-bugs-list mailing list
Unsubscrib
Ivan Levkivskyi added the comment:
> As a matter of fact, A.__module__ in this case is abc.ABCMeta.__module__. A
> class body creates a __module__ key, while a direct metaclass call does not.
But
>>> A = ABCMeta('A', (), {})
>>> ABCMeta.__module__ = '
Ivan Levkivskyi added the comment:
The failure is fixed now, but it is fixed not in an elegant way (sys._getframe
is used).
I think this is not urgent. If there are no objections, then I would propose to
change priority to normal.
--
___
Python
Ivan Levkivskyi added the comment:
Serhiy, here is a patch that might be helpful. It detects global-and-parameter
errors sooner (when possible). This will cause the following:
>>> if 1:
... def error(a):
... global a
... def error2():
... b = 1
...
New submission from Ivan Levkivskyi:
In 3.6 importing antigravity prints a warning (although it does what it should
do):
>>> import antigravity
/home/ivan/.../Lib/subprocess.py:761: ResourceWarning: subprocess 15501 is
still running
ResourceWarning, source=self)
This is probably r
Ivan Levkivskyi added the comment:
I don't think this is a bug, but detecting first a SyntaxError that appears
textually first might be seen as an improvement. I would say such behaviour
seems more intuitive. A possible downside could be a (probably very minor)
slow-down of compilatio
Ivan Levkivskyi added the comment:
Updated patch as proposed by Serhiy.
--
Added file: http://bugs.python.org/file45948/syntax-error-order-v2.patch
___
Python tracker
<http://bugs.python.org/issue28
Changes by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<http://bugs.python.org/issue29002>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<http://bugs.python.org/issue29011>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<http://bugs.python.org/issue29051>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<http://bugs.python.org/issue28702>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<http://bugs.python.org/issue28559>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<http://bugs.python.org/issue29116>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Ivan Levkivskyi :
--
nosy: +levkivskyi
___
Python tracker
<http://bugs.python.org/issue29198>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ivan Levkivskyi added the comment:
Thank you for catching this corner case!
I have made a PR upstream based on your patch:
https://github.com/python/typing/pull/350
As I understand the fix will go in 3.6.1 and 3.5.4
--
___
Python tracker
<h
Ivan Levkivskyi added the comment:
In principle, such a function could be added if it is not called
``isinstance``. For example, we could add a helper ``is_union(tp)`` (or maybe
also ``is_generic(tp)`` etc). Such function(s) will be simple one-liners
wrapping private API in a right way (e.g
Ivan Levkivskyi added the comment:
This will be a bit unusual since ``isinstance`` is typically called for
instances (i.e. not types) as in ``isinstance(func, Callable)``. But on the
other hand this is probably what one would expect when one sees
``isinstance(tp, Union)``. Thus I am fine with
Ivan Levkivskyi added the comment:
> Maybe we need to take a step back and look at the needs for code that wants
> to implement runtime type checking more in general?
I would say that the most convenient way for me would be a set of
"inspect-style" simple helpers
401 - 500 of 681 matches
Mail list logo