python / python/cpython

Use of `.version` attribute in `ipaddress` classes break many methods

Aperta
#141,647 16 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@picnixz ci sta già lavorando.

Dal 22/11/2025.

stdlib type-bug
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Bug report

Bug description:

The following self-contained snippet behaves correctly with python 3.13 and with 3.14 IF I remove the version attribute.

But with 3.14 and the version attribute, the __eq__ method of AlwaysTrue is never called, and the script prints False for both.

import sys
from ipaddress import IPv4Network, IPv6Network


class AlwaysTrue:
    # without this attribute, everything works correctly
    version = 42

    def __eq__(self, other) -> bool:
        return True


print('sys.version', sys.version)
print('IPv4Network == AlwaysTrue', IPv4Network('43.48.0.0/12') == AlwaysTrue())
print('IPv6Network == AlwaysTrue', IPv6Network('::eeff:ae3f:d473/128') == AlwaysTrue())
CPython versions tested on:

3.14

Operating systems tested on:

macOS and linux

Linked PRs
  • gh-141651
  • gh-141842

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.