[New-bugs-announce] [issue34539] namedtuple's exec() throws segmentation fault
Álvaro Justen
report at bugs.python.org
Wed Aug 29 00:20:50 EDT 2018
New submission from Álvaro Justen <alvarojusten at gmail.com>:
I was working on a library called rows[https://github.com/turicas/rows] when a segmentation fault was thrown in the moment I've tried to read a CSV file. Since this part of the code is implemented completely in Python, I thought it could be a bug in Python itself.
Investigating the code I found it was faulting at exec()'s line inside namedtuple code (Lib/collections/__init__.py). After some time testing, I've came up with this piece of code to reproduce it:
```
try:
float('áxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
except:
from collections import namedtuple
namedtuple('T', 'f')
```
The code works if I:
- Run passing `PYTHONMALLOC=debug`
- Place 'from collections import namedtuple' into the first line
- Remove any char from the string in the 'float(...)' line
- Remove the 'á' from the string in the 'float(...)' line
I've tested the code on Python 3.6.6, 3.7.0, 3.7-dev and 3.8-dev (versions installed using pyenv on a Debian GNU/Linux machine) and the problem happened only in 3.7.0.
This issue seems to be related to https://bugs.python.org/issue34087 but I preferred to create a new one since I don't know if there are automated tests for this specific case.
----------
components: Library (Lib)
files: namedtuple_bug.py
messages: 324300
nosy: turicas
priority: normal
severity: normal
status: open
title: namedtuple's exec() throws segmentation fault
type: crash
versions: Python 3.7
Added file: https://bugs.python.org/file47772/namedtuple_bug.py
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34539>
_______________________________________
More information about the New-bugs-announce
mailing list