Description
Bug report
I'm using a 3rd-party library as part of my CI process, and since github updated their mac image to include python 3.11.1 it is breaking. It worked fine in 3.11.0.
The 3rd-party tool is in pip; codemagic-cli-tools
. When importing, it fails when declaring an enum. This can be reproduced by running from codemagic.tools import Keychain
after installing version 0.36.4.
As near as I can tell, a class inheriting NamedTuple
is being interpreted as a tuple
when declared as part of an enum. When declared elsewhere it doesn't seem to exhibit this behaviour.
I've managed to reproduce this with a much more minimal example; when you run the following:
import enum
from typing import NamedTuple
class NT(NamedTuple):
s: str
nt0 = NT(s="s0")
nt0._replace(s="other") # this is valid
class E(enum.Enum):
nt1 = NT(s="s1")
nt2 = nt1._replace(s="s2")
it fails with the error AttributeError: 'tuple' object has no attribute '_replace'
in python 3.11.1 but not python 3.11.0.
If it this is in fact just incorrect python, fair enough - I'll open a bug against the codemagic-cli-tools library, but this does seem like unexpected behaviour to me.
Your environment
Python 3.11.1; I reproduced this in the docker image python:3.11.1. In the docker image python:3.11.0 the code above produces no errors.
- CPython versions tested on: 3.11.1, 3.11.0
- Operating system and architecture: macos x64, but run in docker