New submission from Álvaro Justen <alvarojus...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue34539>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to