Eric V. Smith added the comment:
Thanks for the fix!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
I agree with Ned. This is why I'm not sure it’s worth changing the message:
googling gives good information, and the exact thing to do in order resolve
this (if it’s even possible) is dependent on a number of factors that the code
raising the exception
Eric V. Smith added the comment:
@shreyanavigyan: Thank you for your efforts to improve Python!
--
resolution: -> wont fix
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
Thanks!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: -Python 3.6, Python 3.7
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
New changeset 8a34a0793bcb830350dac675524310bb285e5e4f by Miss Islington (bot)
in branch '3.9':
bpo-43176: Fix processing of empty dataclasses (GH-24484) (GH-25205)
https://github.com/python/cpython/commit/8a34a0793bcb830350dac675524310
Change by Eric V. Smith :
--
pull_requests: +23953
pull_request: https://github.com/python/cpython/pull/25215
___
Python tracker
<https://bugs.python.org/issue43
Eric V. Smith added the comment:
New changeset 1744c96ebc98b240f2564f75191097704b37244f by Eric V. Smith in
branch 'master':
Fix blurb for bpo-43176. (GH-25215)
https://github.com/python/cpython/commit/1744c96ebc98b240f2564f75191097
Eric V. Smith added the comment:
New changeset 2df971afd5f29574be3bb44f2d8569cc240b800d by Miss Islington (bot)
in branch '3.9':
Fix blurb for bpo-43176. (GH-25215) (GH-25217)
https://github.com/python/cpython/commit/2df971afd5f29574be3bb44f2d8569
Change by Eric V. Smith :
--
resolution: fixed -> not a bug
___
Python tracker
<https://bugs.python.org/issue43759>
___
___
Python-bugs-list mailing list
Un
Eric V. Smith added the comment:
Turning off the generation of __match_args__ should be a separate issue.
--
___
Python tracker
<https://bugs.python.org/issue43
Eric V. Smith added the comment:
What's the situation where having __match_args__ is actually harmful in some
way? I understand that if the generated version is wrong, you'd want to specify
it yourself. But what's the use case for not having __match_args__ at all?
Eric V. Smith added the comment:
The reproducer is:
>>> ipaddress.IPv4Address(b"PING")
IPv4Address('80.73.78.71')
--
components: +Library (Lib) -Unicode
nosy: +eric.smith
___
Python tracker
<ht
Eric V. Smith added the comment:
This is documented behavior. See
https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Address
"The following constitutes a valid IPv4 address:
...
An integer packed into a bytes object of length 4 (most significant octet
first).
"
Eric V. Smith added the comment:
Closing as a duplicate. Any discussion should be on the original issue.
--
nosy: +eric.smith
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Missing api-ms-win-core-path-l1-1.0.dll for
python-3.9.0
Eric V. Smith added the comment:
You might have more luck asking on the capi-sig mailing list:
https://mail.python.org/mailman3/lists/capi-sig.python.org/
I'm going to close this, because it looks like a usage question and not a bug.
If it turns out to be a bug, please re-open this
Eric V. Smith added the comment:
Can you put together an example we can actually run?
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue43
Change by Eric V. Smith :
--
Removed message: https://bugs.python.org/msg390548
___
Python tracker
<https://bugs.python.org/issue43746>
___
___
Python-bugs-list m
Eric V. Smith added the comment:
Can you put together an example we can run? Either from a single file, or
multiple modules in the current directory? The "..." import makes it
complicated to reproduce.
--
___
Python track
Eric V. Smith added the comment:
init=False is used to make sure there's no __init__ defined, because there's a
difference between a class with an __init__ and one without. If there was a
difference between __match_args__ being not present and __match_args__=(), then
I'd supp
Eric V. Smith added the comment:
I do think it's worth mentioning that __match_args__ is automatically generated
by @dataclass (if the class doesn't already define __match_args__). That seems
like behavior that's very specific to @dataclass. Where else would you find out
tha
Eric V. Smith added the comment:
Hmm, good point on the inheritance case. I'd forgotten that this is where
init=False and others would come in handy. Although I'm having a hard time
figuring out why you'd want a derived class that adds fields but wants to use
the parent'
Eric V. Smith added the comment:
> Do you need anything from me here?
No, I don't think so. Thanks.
--
___
Python tracker
<https://bugs.python.org
Eric V. Smith added the comment:
> So, should we reopen this ad add the flag to suppress __match_args__
> generation after all?
I think so, although I'm still contemplating it.
I can't decide if we should also add match_arg=False to field(). Or is it good
enough to just
Eric V. Smith added the comment:
Okay, I'll re-open this to just add @dataclass(match_args=False).
--
resolution: rejected ->
stage: resolved -> needs patch
status: closed -> open
___
Python tracker
<https://bugs.pyth
Eric V. Smith added the comment:
Here's a question. If __init__ is not being generated, either because the user
supplied one to this class, or if init=False is specified, should
__match_args__ be generated? I think the answer should be no, since the code
has no idea what the paramete
Eric V. Smith added the comment:
> Are there other cases where suppressing one thing affects others?
Only the complex interactions among the unsafe_hash, eq, and frozen parameters.
It feels like if __init__ is not being generated, then the @dataclass code
would have no idea what it sho
Eric V. Smith added the comment:
I can go either way. It's easy enough for the user to add their own
__match_args__, so I won't link them.
Here's what I have for the documentation, which is why the issue came up:
- ``match_args``: If true (the default is
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +24072
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/25337
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
New changeset 750f484752763fe9ac1d6455780aabcb67f25508 by Eric V. Smith in
branch 'master':
bpo-43764: Add match_args=False parameter to dataclass decorator and to
make_dataclasses function. (GH-25337)
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
Eric V. Smith added the comment:
Wouldn't the next thing you do be to convert it to a float, so you'd call
float() twice? I think you'd be better off just catching the exception
yourself, and using the result of float().
I'm opposed to such a simple function being a mem
New submission from Eric V. Smith :
https://github.com/python/cpython/blob/3.8/Lib/types.py
The documentation says "If no callback is provided, it has the same effect as
passing in lambda ns: ns."
I read this as saying that the callback should return the namespace, but in
reality
Eric V. Smith added the comment:
These files were probably added as part of str.format() or short float repr. I
think the fact that they've been moved to Include/cpython means that user code
shouldn't be using them. See https://bugs.python.org/issue35134 and
https://vstinner.githu
New submission from Eric V. Smith :
In make_dataclasses(), the "namespace" argument is copied because it is
mutated. This isn't really necessary: the callback passed to types.new_class()
could just update its "ns" parameter with "namespace" and with the
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +24105
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25372
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
dataclasses doesn't know the signature of the base class's __init__, so it
can't know how to call it. I realize you've given an example that would accept
any parameters, but that isn't typical.
What if the base class was:
@datacl
Eric V. Smith added the comment:
New changeset 11159d2c9d6616497ef4cc62953a5c3cc8454afb by Lewis Gaul in branch
'master':
bpo-43080: pprint for dataclass instances (GH-24389)
https://github.com/python/cpython/commit/11159d2c9d6616497ef4cc62953a5c
Eric V. Smith added the comment:
Thanks for all of the work, LewisGaul.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
> The dataclass doesn't need to know what arguments the parent __init__
> accepts. It should consume the arguments it needs to initialize its instance
> attributes, and forward the rest to the parent __init__.
The generated __init__() uses ever
Eric V. Smith added the comment:
But Bar(1, 2), Bar(1, foo=2), Bar(bar=1, foo=2) all give errors. These are all
valid if both Foo and Bar are decorated with @dataclass.
Calling base class __init__() functions is an incompatible change, and I don't
think we'll make any chang
Eric V. Smith added the comment:
Yes, I'm sure it happens.
from dataclasses import dataclass
@dataclass
class Foo:
foo: int
def __init__(self, a, b, c):
self.foo = a * b * c
@dataclass
class Bar(Foo):
bar: int
print(Bar(1, 2))
print(Foo(1,
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/issue43835>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue43858>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eric V. Smith :
--
nosy: +vinay.sajip
___
Python tracker
<https://bugs.python.org/issue43858>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
It's almost certainly not a bug in CPython. But you haven't even shown us what
the error is, so it's impossible to say. What error are you seeing?
--
nosy: +eric.smith
___
Python tracker
<https
Eric V. Smith added the comment:
Okay, and good luck!
--
resolution: -> not a bug
___
Python tracker
<https://bugs.python.org/issue43872>
___
___
Python-
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue43901>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
> If o.__annotations__ is None, should this function set the empty dict on the
> object? That seems slightly too opinionated to me. On the other hand, the
> user would probably expect that they could change the dict they got back.
Are you saying
Eric V. Smith added the comment:
I agree this is working as designed and documented, so I'm closing this.
Olli: You might want to read
https://en.wikipedia.org/wiki/Rounding#Round_half_to_even
--
nosy: +eric.smith
resolution: -> not a bug
stage: -> resolved
status: ope
Eric V. Smith added the comment:
If we're trying to be poetic, I think the last line should be "I intended it".
--
nosy: +eric.smith
___
Python tracker
<https://bugs.pyt
Eric V. Smith added the comment:
Unfortunately this can't be changed, although I suppose it should be documented.
In general I think this API was a mistake, and should not have been added.
There are just too many cases where it doesn't do what you want, or where it
fails.
I
Eric V. Smith added the comment:
The reason for the deep copying was to support changing a hierarchy of
dataclasses into something that could be JSON serialized. But it didn't really
work out. It recurses into dataclasses, namedtuples, lists, tuples, and dicts,
and deep copies every
Eric V. Smith added the comment:
> And since there are definitely circumstances in which it can't return
> __annotations__ directly, that indicates that it should never return
> __annotations__ directly.
And the follow on here is that get_annotations() shouldn't set __ann
Change by Eric V. Smith :
--
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue43906>
___
___
Python-bugs-list mailing list
Unsubscrib
Eric V. Smith added the comment:
> To be honest, I've never been really sure if the idea of PEP 563 stringized
> annotations are supposed to be a hidden implementation detail, or a
> first-class concept that the user (and the standard library) is expected to
> deal
Eric V. Smith added the comment:
> p.s. assuming you meant PEP 563, not PEP 573.
Yes. Someday I'll figure out this keyboard.
--
___
Python tracker
<https://bugs.python.org
Change by Eric V. Smith :
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue43923>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eric V. Smith added the comment:
It's find to have advice of "do X in 3.9", and "do Y in 3.10+". I think the
issue is: if you have code that needs to run in 3.9 and 3.10+, what should you
do? There needs to be
Eric V. Smith added the comment:
"It's fine to have advice ..."
--
___
Python tracker
<https://bugs.python.org/issue43901>
___
___
Python-b
New submission from Eric V. Smith :
This is a newcomer friendly issue. The documentation just needs a sentence that
FrozenInstanceError is derived from AttributeError.
--
assignee: docs@python
components: Documentation
keywords: easy, newcomer friendly
messages: 391861
nosy: docs
Change by Eric V. Smith :
--
pull_requests: +24320
pull_request: https://github.com/python/cpython/pull/25608
___
Python tracker
<https://bugs.python.org/issue43
Eric V. Smith added the comment:
I've checked in the code, tests, and some basic documentation. I didn't finish
the documentation in order to make sure I could get this in before beta 1. I'm
going to leave this issue open until I have time for the rest of the
Eric V. Smith added the comment:
New changeset 8a307e488d596914a7a5df6b2fdd945f8ce81e69 by Llandy Riveron Del
Risco in branch 'master':
bpo-43938: improve dataclasses.FrozenInstanceError documentation (GH-25603)
https://github.com/python/cpyt
Eric V. Smith added the comment:
New changeset 081bfe4eb58e107de0a38e98c44a3253e4ed1240 by Miss Islington (bot)
in branch '3.8':
bpo-43938: improve dataclasses.FrozenInstanceError documentation (GH-25603)
(GH-25636)
https://github.com/python/cpyt
Eric V. Smith added the comment:
New changeset c9c1dbd253d70665c1fd20e6341f9a08e21f37f4 by Miss Islington (bot)
in branch '3.9':
bpo-43938: improve dataclasses.FrozenInstanceError documentation (GH-25603)
(GH-25635)
https://github.com/python/cpyt
Eric V. Smith added the comment:
Thanks for the patch!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
I'd like to see the default behavior be to raise an exception if eval fails on
any annotation.
I think it's reasonable to provide a way to find out which specific keys have
problems, but I don't think that should be the default. Wouldn'
Eric V. Smith added the comment:
This is just how Python works. The default values for .x and .y are set on the
class A, not its instances. Here's the equivalent without dataclasses:
>>> class A:
... x = 0
... y = 1
...
>>> a = A()
>>> a.x
0
>>&g
Change by Eric V. Smith :
--
assignee: -> eric.smith
type: -> behavior
versions: -Python 3.11, Python 3.7, Python 3.8
___
Python tracker
<https://bugs.python.org/i
Eric V. Smith added the comment:
I'm not aware of what problems it would cause, but there's no doubt someone
who's relying on it.
Since it's a behavior of normal classes, changing it would violate dataclasses
desire (not always realized) to have as little impact as p
Eric V. Smith added the comment:
> Will this close https://bugs.python.org/issue36077 ?
No, not directly, although I'm going to close that issue as "won't fix".
But you can specify that the child class requires all params as kw_only.
Continuing the example:
>
Eric V. Smith added the comment:
I'm open to suggestions on how this could be fixed, but I don't see how it's
possible. I guess the best thing to do would be to fail if __init__() isn't the
one that was generated by @dataclass. But that might be too pessimistic: the
user
Eric V. Smith added the comment:
New changeset 4a85718212fd032c922ca7d630b2602dd4b29a35 by kfollstad in branch
'master':
bpo-43970: Optimize Path.cwd() in pathlib by not instantiating a class
unnecessarily (GH-25699)
https://github.com/python/cpyt
Eric V. Smith added the comment:
I'm merging this not so much because of the performance aspect, but just to
remove some unnecessary code.
But in any event, thanks for the contribution!
--
resolution: -> fixed
stage: patch review -> resolved
status: ope
Eric V. Smith added the comment:
I'm going to close this in favor of the kw_only work done in issue 43532. I
realize they're not quite the same thing, but we'll see how it works out in
Python 3.10, and possibly make adjustments when we have some real world
experience.
--
Change by Eric V. Smith :
--
nosy: eric.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: dataclasses documentation needs version added for match_args, kw_only,
and slots
versions: Python 3.10
___
Python tracker
<ht
Change by Eric V. Smith :
--
assignee: -> docs@python
components: +Documentation
keywords: +easy, newcomer friendly
nosy: +docs@python
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
New changeset c24199184bea0c851c1a7296ae54aaf18ee56752 by Yurii Karabas in
branch 'master':
bpo-42269: Add slots parameter to dataclass decorator (GH-24171)
https://github.com/python/cpython/commit/c24199184bea0c851c1a7296ae54aa
Eric V. Smith added the comment:
Thanks for all of your work, Yurii.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
New submission from Eric V. Smith :
Originally reported in https://github.com/ericvsmith/dataclasses/issues/154
import pickle
from dataclasses import dataclass
@dataclass(frozen=True, slots=True)
class ExampleDataclass:
foo: str
bar: int
assert ExampleDataclass.__slots__ == (&quo
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +24477
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25786
___
Python tracker
<https://bugs.python.org/issu
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:
Thanks, shreyneil!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
Sorry, ZackerySpytz. I saw PR 25742 first and reviewed and merged it before I
saw that you have an earlier PR on this issue.
--
nosy: +eric.smith
___
Python tracker
<https://bugs.python.org/issue41
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 :
--
type: -> behavior
___
Python tracker
<https://bugs.python.org/issue43999>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Eric V. Smith :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> behavior
___
Python tracker
<https://bugs.python
New submission from Eric V. Smith :
Specifying KW_ONLY twice should raise an exception, but does not:
>>> @dataclasses.dataclass
... class foo:
... _: dataclasses.KW_ONLY
... x: dataclasses.KW_ONLY
...
--
assignee: eric.smith
components: Library (Lib)
messages: 39
Change by Eric V. Smith :
--
keywords: +patch
pull_requests: +24525
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25841
___
Python tracker
<https://bugs.python.org/issu
Eric V. Smith added the comment:
New changeset 99ad742ea913e421d012c1a623029eac31bdfe85 by Eric V. Smith in
branch 'master':
bpo-44015: dataclasses should allow KW_ONLY to be specified only once per class
(GH-25841)
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 :
--
assignee: eric.smith ->
___
Python tracker
<https://bugs.python.org/issue43558>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Eric V. Smith :
--
keywords: +newcomer friendly
___
Python tracker
<https://bugs.python.org/issue43558>
___
___
Python-bugs-list mailing list
Unsub
Eric V. Smith added the comment:
I don’t see any way of changing this behavior, so I’m going to close this issue.
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eric V. Smith added the comment:
I think we'd want to look at the 33 uses with hyphens to make sure removing the
hyphen is correct (as opposed to just blindly make a change). But I'm generally
supportive.
--
nosy: +eric.smith
___
Pyth
New submission from Eric V. Smith :
If you think this is a bug, please attach the text of a stand-alone example
demonstrating the problem. Please do not attach an image or a screen capture,
use text so we can run and reproduce the problem.
That said, it's unlikely this is a bug in P
Eric V. Smith added the comment:
Can you provide a small snippet of code showing the kind of thing that broke?
--
___
Python tracker
<https://bugs.python.org/issue43
Eric V. Smith added the comment:
Sure. Take your time! Thank you in advance for your contribution.
--
___
Python tracker
<https://bugs.python.org/issue43
Eric V. Smith added the comment:
Hmm. I think maybe the intent was that if you're frozen, treat all the fields
as frozen, including ones you inherit, regardless if the base classes are
frozen or not.
--
___
Python tracker
&
4301 - 4400 of 6702 matches
Mail list logo