Eric V. Smith added the comment:
Resolved by issue 32953.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> behavior
___
Python tracker
<https://bugs.python
Eric V. Smith added the comment:
This is the same reason that this fails:
class Base:
__slots__ = ('x',)
x = 3
with:
ValueError: 'x' in __slots__ conflicts with class variable
In the dataclasses case, the error needs to be improved, and moved to when the
base cl
Eric V. Smith added the comment:
My point is that the problem is that after:
@dataclass
class Base:
__slots__ = ('x',)
x: Any
Base.x has a value (it's the member_descriptor for x). That's what's causing
the problem that when adding a field to the derive
Eric V. Smith added the comment:
Path.parents will do what you want. I don't have a Windows box handy, but this
is on MacOS:
>>> from pathlib import Path
>>> p =
>>> Path("/Users/User/AppData/Local/Programs/Python/Python36/Lib/asyncio/__init__.py"
Eric V. Smith added the comment:
Thanks, but I'm already looking at this in the context of a different bug.
--
___
Python tracker
<https://bugs.python.org/is
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +5910
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33100>
___
___
Py
Eric V. Smith added the comment:
New changeset 7389fd935c95b4b6f094312294e703ee0de18719 by Eric V. Smith in
branch 'master':
bpo-33100: Dataclasses now handles __slots__ and default values correctly.
(GH-6152)
https://github.com/python/cpython/commit/7389fd935c95b4b6f094312294e703
Change by Eric V. Smith :
--
assignee: eric.smith ->
___
Python tracker
<https://bugs.python.org/issue1467929>
___
___
Python-bugs-list mailing list
Unsubscrib
Eric V. Smith added the comment:
Are there any remaining issues here? If not, I'm going to close this issue.
--
status: open -> pending
___
Python tracker
<https://bugs.python.org
Eric V. Smith added the comment:
New changeset 3d41f482594b6aab12a316202b3c06757262109a by Eric V. Smith (Miss
Islington (bot)) in branch '3.7':
bpo-33100: Dataclasses now handles __slots__ and default values correctly.
(GH-6152) (GH-6153)
https://github.com/python/cpyt
Change by Eric V. Smith :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue33084>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue33094>
___
___
Change by Eric V. Smith :
--
priority: deferred blocker -> release blocker
versions: +Python 3.8
___
Python tracker
<https://bugs.python.org/issue32896>
___
_
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +5925
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue32896>
___
___
Py
Eric V. Smith added the comment:
New changeset 8f6eccdc64cab735c47620fea948e64b19f83684 by Eric V. Smith in
branch 'master':
bpo-32896: Fix error when subclassing a dataclass with a field that uses a
default_factory (GH-6170)
https://github.com/python/cpyt
Change by Eric V. Smith :
--
dependencies: -Dict order is now guaranteed, so add tests and doc for it
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
New changeset 22136c94b6e43c8c584a54f3a513b83b753b96ee by Eric V. Smith (Miss
Islington (bot)) in branch '3.7':
bpo-32896: Fix error when subclassing a dataclass with a field that uses a
default_factory (GH-6170) (GH-6171)
https://github.com/pyth
Eric V. Smith added the comment:
Thanks again for the bug report. This ended up being a simple fix, but an
important one.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bug
Eric V. Smith added the comment:
Yes, it's cross platform.
For a plain string version, you can use a utility function:
>>> for i in range(n+1):
... path = os.path.dirname(path)
...
I'm not sure it's worth adding this to os.path.
--
__
New submission from Eric V. Smith :
'Field' needs to be added to __all__.
--
assignee: eric.smith
messages: 314222
nosy: eric.smith
priority: normal
severity: normal
status: open
title: Field is not exposed in dataclasses.__all__
type: behavior
versions: Python 3.7,
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +5930
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33116>
___
___
Py
Eric V. Smith added the comment:
New changeset 4ddc99d15963b0374f9dbfd57f14e6194ad65669 by Eric V. Smith (Miss
Islington (bot)) in branch '3.7':
bpo-33116: Add 'Field' to dataclasses.__all__. (GH-6182) (GH-6183)
https://github.com/python/cpython/commit/4ddc99d15963b0374f9d
Change by Eric V. Smith :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
I'm not sure this is worth preventing. I can certainly make it an error, but
since dataclasses ignores anything without a type annotation, I don't think
it's a big deal. Basically I'd have to look through all class attributes that
are of t
Eric V. Smith added the comment:
But surely when you instantiate this:
c = C(1)
you'll notice that's an error?
--
___
Python tracker
<https://bugs.python.o
Eric V. Smith added the comment:
Thanks for the offer. I've already got the code written, I just need to write
some tests. I'll get it done real soon now.
--
components: +Library (Lib)
versions: +Python 3.8
___
Python track
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +5939
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue32505>
___
___
Py
Eric V. Smith added the comment:
New changeset 56970b8ce9d23269d20a76f13c80e670c856ba7f by Eric V. Smith in
branch 'master':
bpo-32505: dataclasses: raise TypeError if a member variable is of type Field,
but doesn't have a type annotation. (GH-6192)
https://github.com/python
Change by Eric V. Smith :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Eric V. Smith :
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issue33129>
___
___
Python-bugs-list mailing list
Unsubscrib
Eric V. Smith added the comment:
Changing this to 3.8: there's not enough time to add this to 3.7.
--
versions: -Python 3.7
___
Python tracker
<https://bugs.python.org/is
New submission from Eric V. Smith :
There's already a table lookup for what action to take when adding __hash__.
Change it to a function dispatch table, instead of using strings and testing
them.
--
assignee: eric.smith
components: Library (Lib)
messages: 314385
nosy: eric.
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +5963
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33134>
___
___
Py
Eric V. Smith added the comment:
New changeset 01d618c5606a239b03ad1269541eddb6e724775d by Eric V. Smith in
branch 'master':
bpo-33134: dataclasses: use function dispatch table for hash, instead of a
string lookup which then is tested with if tests. (GH-6222)
https://github.
Change by Eric V. Smith :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
That's a tough one. Because C.d is not set to a descriptor at type creation
time (it's set to a Field object), the __set_name__ behavior is never invoked.
It's when the @dataclass decorator is called that C.d is set to D().
https://docs.python.
Eric V. Smith added the comment:
I suppose I could, when overwriting the class member, check for
inspect.ismethoddescriptor and call __set_name__ myself.
--
components: +Library (Lib)
versions: +Python 3.8
___
Python tracker
<ht
Eric V. Smith added the comment:
Nick Coghlan suggested (on python-dev) to have Field implement __set_name__ and
call through to the default value, if it exists.
That approach seems to work fine. I'll generate a PR with tests sometime before
today'
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +5984
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33141>
___
___
Py
Eric V. Smith added the comment:
I don't expect there to be too much usage of Field objects, so I'm not so
worried about it.
If you can, try out the code in the PR. Thanks.
--
___
Python tracker
<https://bugs.python.o
Eric V. Smith added the comment:
Yes, I noticed the same thing. I'll remove the test.
--
___
Python tracker
<https://bugs.python.org/issue33141>
___
___
Eric V. Smith added the comment:
I've updated the PR.
I left those lines in, and added a different test. After all, it does need to
work with real descriptors.
--
___
Python tracker
<https://bugs.python.org/is
Eric V. Smith added the comment:
New changeset de7a2f04d6b9427d568fcb43b6f512f9b4c4bd84 by Eric V. Smith in
branch 'master':
bpo-33141: Have dataclasses.Field pass through __set_name__ to any default
argument. (GH-6260)
https://github.com/python/cpyt
Eric V. Smith added the comment:
Thanks for the bug report.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
New submission from Eric V. Smith :
Reported by Jelle Zijlstra at
https://github.com/python/cpython/pull/6260#pullrequestreview-107905037
--
assignee: eric.smith
components: Library (Lib)
messages: 314636
nosy: eric.smith
priority: normal
severity: normal
stage: needs patch
status
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +6023
stage: needs patch -> patch review
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
New changeset 521995205a2cb6b504fe0e39af22a81f785350a3 by Eric V. Smith in
branch 'master':
bpo-33175: dataclasses should look up __set_name__ on class, not instance
(GH-6305)
https://github.com/python/cpython/commit/521995205a2cb6b504fe0e39af22a8
Change by Eric V. Smith :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
You can also cause this same error without dataclasses:
from typing import TypeVar, Generic
from types import new_class
MyTypeVar = TypeVar("MyTypeVar")
MyParent = new_class("MyParent", (Generic[MyTypeVar],), {})
c = type(
Eric V. Smith 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.
--
___
Python tracker
<https://bugs.python.org/is
Eric V. Smith added the comment:
Yeah, no need to change the API. I was over-generalizing.
--
___
Python tracker
<https://bugs.python.org/issue33188>
___
___
Eric V. Smith added the comment:
I agree that it should be deprecated. That's crazy behavior.
I'd also recommend that shlex.shlex with instream=None be deprecated, but maybe
that's too radical. It seems way too easy to accidentally pass in None.
--
no
Change by Eric V. Smith :
--
nosy: +ncoghlan
___
Python tracker
<https://bugs.python.org/issue33265>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
In the loop, you're reassigning the value of name, then using it in the super
call. If you change the name of the loop variable, your code works.
--
nosy: +eric.smith
resolution: -> not a bug
stage: -> resolved
status: open -&g
Eric V. Smith added the comment:
Is 2to3 supposed to be able to parse non-python2 files? I don't recall.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/is
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue33272>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
"built-in modules" has the specific meaning of modules that are compiled in to
the python executable. It doesn't mean modules in the standard library.
See https://docs.python.org/3.6/library/sys.html#sys.builtin_module_names
Python 3.6.4 (defau
Eric V. Smith added the comment:
If you have a suggested improvement, please create a pull request. Thanks!
--
___
Python tracker
<https://bugs.python.org/issue33
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue33211>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
Operator precedence cannot change without breaking existing code.
--
nosy: +eric.smith
type: behavior -> enhancement
versions: +Python 3.8 -Python 3.5
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
Your patch would break the usual and useful behavior of x == eval(repr(x))
>>> f = Fraction(1,2)
>>> repr(f)
'Fraction(1, 2)'
>>> eval(repr(f))
Fraction(1, 2)
>>> f == eval(repr(f))
True
Plus, I'm sure there&
Eric V. Smith added the comment:
I'd bring it up on python-ideas, and point the discussion to this issue. I
think the primary complain will be using non-ASCII characters in a function
that normally doesn't return non-ASCII. But maybe people will be willing to
Change by Eric V. Smith :
--
nosy: +eric.smith
versions: +Python 3.8 -Python 3.7
___
Python tracker
<https://bugs.python.org/issue33408>
___
___
Python-bugs-list m
Eric V. Smith added the comment:
The problem is that type.__format__ doesn't exist, so object.__format__ is
being called, and it throws an error if you provide a format spec. This is done
for future expansion: if we do want to add type.__format__ in the future, we
don't have to w
Eric V. Smith added the comment:
This has to be a 3.8 feature.
It would be best if you could convert this to a github pull request, and use
blurb to generate the news entry. But those aren't strictly necessary, someone
else can do the mechanics of that. I'm willing to do it if
Eric V. Smith added the comment:
You'll need to use blurb:
https://pypi.org/project/blurb/
https://devguide.python.org/committing/#what-s-new-and-news-entries
Well, technically it's possible to not use blurb and do it manually, but you'll
Eric V. Smith added the comment:
It's not clear to me what you're typing to get the output in the first message.
Can you clarify? Is this at the interactive prompt?
--
___
Python tracker
<https://bugs.python.o
Eric V. Smith added the comment:
This is a known issue, but it wasn't being tracked here. So, thanks for opening
the issue.
https://github.com/ericvsmith/dataclasses/issues/92#issuecomment-382473127
Not to put Łukasz on the spot (he's sitting behind me even as we speak), but I
Eric V. Smith added the comment:
I'm okay with the concept, but I don't know how to implement it. You need to
not only know if a class has a __init__, but also if it's expected to be called.
For example, these don't normally get called, but if you inherit from them (and
e
Change by Eric V. Smith :
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issue33452>
___
___
Python-bugs-list mailing list
Unsubscrib
Eric V. Smith added the comment:
See also [2]_ for a brief discussion of forward references, which makes
get_type_hints() undesirable in this case.
> This is why attrs went with the fast way which covers most (but not all)
> bases in this case. If the annotation is a string, just check
Eric V. Smith added the comment:
I see that https://github.com/python/typing/issues/508 is also referenced in
https://github.com/python-attrs/attrs/issues/361, where it contributed to attrs
using string inspection.
--
___
Python tracker
<ht
Eric V. Smith added the comment:
The more I think about this, the more I think Łukasz is correct that just
checking for strings starting with "ClassVar", "typing.ClassVar", or
"t.ClassVar" is the correct thing to do. This is the change he made in
https://gith
Eric V. Smith added the comment:
We can't break the API at this point in the release cycle. But I am open to
what string prefixes we should allow.
--
___
Python tracker
<https://bugs.python.org/is
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +6456
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33453>
___
___
Py
Change by Eric V. Smith :
--
keywords: +patch, patch
pull_requests: +6455, 6456
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
At this stage in the release cycle, if you really feel strongly about this, you
should take it up with Guido directly.
--
assignee: -> eric.smith
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
After locale.setlocale(locale.LC_ALL, ''), what does local.localeconv() return?
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.o
Eric V. Smith added the comment:
Can you explain your use case for this?
Also, how do you envision this working with the existing frozen, hashing, and
equality behavior? There are a lot of interactions there, and we'd want to do
something that makes sense holistically, and isn't
Eric V. Smith added the comment:
There have been comments on the PR, but I'd like to focus the higher level
issue back here. Specifically, see my comment
https://github.com/python/cpython/pull/6768#discussion_r187813919
To summarize: I still think string inspections are the best we c
New submission from Eric V. Smith :
I've had several requests for keyword-only arguments. This is a placeholder to
remind me to work on it. I have not decided if it's a good idea or not.
I propose adding a keyword_only argument to field(), defaulting to False.
I'm thinking that
New submission from Eric V. Smith :
This is especially true for the "type" member, since it might be a string that
looks like a type name (depending on how #33453 is resolved). But repr should
be used for all Field members.
--
assignee: eric.smith
components: Library (Lib
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +6483
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33494>
___
___
Py
Change by Eric V. Smith :
--
pull_requests: -6483
___
Python tracker
<https://bugs.python.org/issue33494>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
pull_requests: -6490
___
Python tracker
<https://bugs.python.org/issue33494>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
pull_requests: +6492
___
Python tracker
<https://bugs.python.org/issue33494>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +6491
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33495>
___
___
Py
Eric V. Smith added the comment:
Followup from our meeting at the sprints: we're going to go with inspecting the
type annotation string and use heuristics to determine if the type is a
ClassVar or InitVar. I'll follow up with more specifics on the approach.
This will obviously ne
Change by Eric V. Smith :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
New submission from Eric V. Smith :
This is mostly a debugging aid, but if you need it, it's very handy.
--
assignee: eric.smith
components: Library (Lib)
messages: 316542
nosy: eric.smith, ned.deily
priority: release blocker
severity: normal
status: open
title: dataclasses: re
Change by Eric V. Smith :
--
priority: release blocker ->
___
Python tracker
<https://bugs.python.org/issue33495>
___
___
Python-bugs-list mailing list
Un
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +6498
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33502>
___
___
Py
Eric V. Smith added the comment:
Note that the documentation should make the implications of #33453 very clear.
In short, if an annotation "looks like" a ClassVar or InitVar, it will be
treated as such. This is true even if it's specified as a string, or if it's a
Eric V. Smith added the comment:
Like #33463, it will require a deprecation cycle. I'm not sure it's worth the
hassle, but I wouldn't oppose it if someone wanted to do the work. 3.8 would be
the first version where it could be added.
--
nosy: +eric.smith
version
Eric V. Smith added the comment:
New changeset 3059042410dce69806b94be72d5c8055d616f3a3 by Eric V. Smith in
branch 'master':
bpo-33502: dataclass._Dataclassparams repr: use repr of each member. (GH-6812)
https://github.com/python/cpython/commit/3059042410dce69806b94be72d5c80
Change by Eric V. Smith :
--
priority: release blocker ->
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python
New submission from Eric V. Smith :
With the recent (and ongoing) change to string annotations, it's no longer
obvious what the type of a field is (normal, ClassVar, or InitVar).
I propose exposing the heretofore undocumented _field_type to the repr. Instead
of writing it directly, I
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +6532
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue33517>
___
___
Py
Eric V. Smith added the comment:
New changeset 01abc6ec3a61769c55ee86834a432fb97801d28f by Eric V. Smith in
branch 'master':
bpo-33517: dataclasses: Add the field type to Field repr (GH-6858)
https://github.com/python/cpython/commit/01abc6ec3a61769c55ee86834a432f
1701 - 1800 of 2699 matches
Mail list logo