Repository navigation
Commit 68b5d3d
committed
gh-160106: Fix csv.Dialect.__replace__() losing slot-backed attributes
copy.replace() on a csv.Dialect subclass that stores dialect options in
__slots__ would silently drop those attributes. __replace__() only copied
self.__dict__, so any attribute stored in a slot was missing from the new
object, causing csv.reader/writer to fall back to the default value.
Fix by iterating the MRO for __slots__ entries and copying any dialect
attribute that was not already set via __dict__.1 parent ffe1315 commit 68b5d3d
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
128 | 137 | | |
129 | 138 | | |
130 | 139 | | |
| |||
0 commit comments