[issue33453] from __future__ import annotations breaks dataclasses ClassVar and InitVar handling

2018-05-11 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Lending my voice to the suggestion of limiting the class attribute check to `typing.ClassVar` and `ClassVar`. It can always be expanded later if it is needed. -- ___ Python tracke

[issue33453] from __future__ import annotations breaks dataclasses ClassVar and InitVar handling

2018-05-10 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: > Is there any scenario where the following code would be useful... Perhaps if someone, in search of a speedup, were sort of rolling their own lighter-weight equivalent to the typing module (in order to avoid importing the full typi

[issue33452] add user notification that parent init will not be called in dataclass init method

2018-05-09 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: The init method that comes up for int, str, float, etc is just the object init: assert int.__init__ is object.__init__ Probably the thing to do is grab any init methods that aren't the object.__init__ while stripping out the dat

[issue33453] from __future__ import annotations breaks dataclasses ClassVar handling

2018-05-09 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Sorry, mean to say it works just fine *without* the import. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33453] from __future__ import annotations breaks dataclasses ClassVar handling

2018-05-09 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: To be clear: it works just fine with the annotations import. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33453] from __future__ import annotations breaks dataclasses ClassVar handling

2018-05-09 Thread Rick Teachey
New submission from Rick Teachey <ri...@teachey.org>: This is broken in 3.7 (both beta 3 and 4): from __future__ import annotations from dataclasses import dataclass from typing import ClassVar, Any @dataclass class C(): class_var: ClassVar[Any] = object() data: str Tra

[issue33452] add user notification that parent init will not be called in dataclass init method

2018-05-09 Thread Rick Teachey
New submission from Rick Teachey <ri...@teachey.org>: The dataclasses module is incredibly easy to use. This is a good thing. BUT one downside is it will definitely be utilized by people who don't have a thorough understanding of how it does what it does. Even for me, despite having

[issue33328] pdb error when stepping through generator

2018-04-29 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Closed as duplicate of issue 13044. -- resolution: -> duplicate stage: -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <https://bu

[issue33328] pdb error when stepping through generator

2018-04-22 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: I am on Anaconda 4.5.1 on Windows 10 (Python 3.6.5). I have confirmed that I DO get the error on another machine with the same version installed, so the lack of an error seems specific to my current machine. I do not know what

[issue33328] pdb error when stepping through generator

2018-04-21 Thread Rick Teachey
Change by Rick Teachey <ri...@teachey.org>: -- components: +Library (Lib) type: -> behavior ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33328] pdb error when stepping through generator

2018-04-21 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: The interactive session result is below: GeneratorExit Exception ignored in: Traceback (most recent call last): File "C:\Users\ricky\AppData\Local\Programs\Python\Python37\lib\types.py", line 27, in _ag File "C

[issue33328] pdb error when stepping through generator

2018-04-21 Thread Rick Teachey
New submission from Rick Teachey <ri...@teachey.org>: Hello: The attached python file runs a pdb interactive session for a generator. It produces an error in Python 3.7 Beta 3, but no error in 3.6. I searched for this issue and there do seem to be things that are related to it a

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

2018-03-30 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Thank you; I gave it a go. Hopefully didn't cause too much additional work for someone. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

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

2018-03-30 Thread Rick Teachey
Change by Rick Teachey <ri...@teachey.org>: -- keywords: +patch pull_requests: +6033 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

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

2018-03-30 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: I'll also say: one of the biggest reasons I was excited to read the `dataclasses` PEP was because I thought "AWESOME! Now I can delete all of the stupid boilerplate __init__ and __repr__ methods for those `typing.Sequences`, `typ

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

2018-03-30 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: > passing keyword arguments to metaclass will be much more rare for dataclasses > than passing a ready namespace The impetus of my running into these issues was assuming that things like `Generic[MyTypeVar]` woul

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

2018-03-30 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Eric: see also Ivan's comment on Issue 33190, which will factor into the solution to this I think. It seems you can't just pass the `namespace` to the `kwds` argument (as I have done in my solution

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

2018-03-30 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Excellent; thank you very much for the explanation. I have never done a PR on a project this size but I'll give it a try. -- ___ Python tracker <rep...@bugs.python.org> <https://

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

2018-03-30 Thread Rick Teachey
New submission from Rick Teachey <ri...@teachey.org>: I am pretty sure this is a bug. If not I apologize. Say I want to dynamically create a new `C` class, with base class `MyABC` (and dynamically assigned abstract method `m`). This works fine if I use `type`, but if I use `new

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

2018-03-30 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Same error on 3.7. Probably getting beyond my knowledge here but from the error message, it seems like the answer is simply that: type('MyChild', (MyParent[int],), {}) ...is just the wrong way to make a new `type` when utilizin

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

2018-03-30 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Sorry: to be clear, the error only occurs when attempting to create the class using `make_dataclass`. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

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

2018-03-30 Thread Rick Teachey
New submission from Rick Teachey <ri...@teachey.org>: I'm getting the following error at when attempting to create a new `dataclass` with any base class that is supplied a type variable: TypeError: type() doesn't support MRO entry resolution; use types.new_class() In principle, it

[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Looks great to me. Thanks! -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Yeah and I think lines 2709-2712 of TestDescriptors also needs removed. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Eric, looking at the PR; note that if you do this for the __set_name__ check: if inspect.ismethoddescriptor(self.default): ...an object like the one below will not get its __set_name__ called, even though PEP 487 says it should: c

[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: I suppose one downside of that solution is __set_name__ will be called for every Field whether or not it is need. Probably can't be helped without major complications. -- ___ Python tracke

[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: Sounds like a relatively easy solution then. Hopefully it makes the beta 3 so I can use it immediately- thanks! -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-26 Thread Rick Teachey
Rick Teachey <ri...@teachey.org> added the comment: hmmm... if I check the C.d class attribute it seems to return the descriptor instance object (not a field object) before any C instances have been created. i guess this is just a part of how the dataclass implementation works. i didn't r

[issue33141] descriptor __set_name__ feature broken for dataclass descriptor fields

2018-03-25 Thread Rick Teachey
New submission from Rick Teachey <ri...@teachey.org>: Summary: The descriptor `__set_name__` functionality (introduced in Python 3.6) does not seem to be working correctly for `dataclass.Field` objects with a default pointing to a descriptor. I have attached a file demonstrating the t