[New-bugs-announce] [issue34213] Frozen dataclass __init__ fails for "object" property"

Edward Jones report at bugs.python.org
Tue Jul 24 14:34:20 EDT 2018


New submission from Edward Jones <Edwardrjones97 at gmail.com>:

When `__init__` is called for a class which 1) is annotated with `@dataclasses.dataclass(frozen=True)` and 2) has a attribute named `object` a TypeError is raised because `object` is overridden for the local scope and as a result `__setattr__` is called on the passed in argument value instead of the standard `object` base type.

I was able to reproduce this in a Docker container running https://github.com/docker-library/python/blob/7a794688c7246e7eff898f5288716a3e7dc08484/3.7/stretch/Dockerfile with the attached .py file.
Python 3.7.0 (default, Jul 17 2018, 11:04:33) 
[GCC 6.3.0 20170516] on linux

----------
components: Library (Lib)
files: frozen_dataclass_init_typeerror.py
messages: 322321
nosy: Omenien
priority: normal
severity: normal
status: open
title: Frozen dataclass __init__ fails for "object" property"
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file47710/frozen_dataclass_init_typeerror.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34213>
_______________________________________


More information about the New-bugs-announce mailing list