Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

dataclass(a=nan) == dataclass(a=nan) change in truthnes between 3.12 and 3.13 #120645

Copy link
Copy link
Open
@hroncok

Description

@hroncok
Issue body actions

Bug report

Bug description:

from dataclasses import dataclass
@dataclass
class a:
    a: float

nan = float('nan')

Python 3.12.3

>>> nan == nan
False
>>> a(nan) == a(nan)
True

Python 3.13.0b2

>>> nan == nan
False
>>> a(nan) == a(nan)
False

The new behavior kinda makes sense, but it is a behavior change nevertheless.

Was it intentional or accidental? I cannot find anything relevant in https://docs.python.org/3.13/whatsnew/3.13.html

Possibly related to #104904 but I have not yet bisected this.

This breaks expectations in the testsuite of cattrs: python-attrs/cattrs#547

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.