This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: SIGSEGV in os.putenv()
Type: crash Stage: resolved
Components: Library (Lib) Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Paweł Krawczyk, python-dev
Priority: normal Keywords:

Created on 2015-11-15 23:22 by Paweł Krawczyk, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg254700 - (view) Author: Paweł Krawczyk (Paweł Krawczyk) Date: 2015-11-15 23:22
A numerical value argument of the os.putenv() call causes my python3.5 to crash with SIGSEGV, for example:

Python 3.5.0+ (default, Oct 11 2015, 09:05:38) 
[GCC 5.2.1 20151010] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.putenv('AAA', 1)
Segmentation fault (core dumped)

While numerical 1 (one) is not a valid argument for the function which expects a string as value, it shouldn't crash but rather throw an exception. This seems to be the behaviour in python3.4:

Python 3.4.3 (default, Oct 14 2015, 20:28:29) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.putenv('AAA', 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Can't convert 'int' object to str implicitly
>>>

I can provide a strace/ltrace/core dump but it's huge and I'm not sure if it's necessary taking into account that this issue is trivial to reproduce.
msg254714 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-11-16 05:58
New changeset 3ae62099d70b by Benjamin Peterson in branch '3.5':
make the PyUnicode_FSConverter cleanup set the decrefed argument to NULL (closes #25630)
https://hg.python.org/cpython/rev/3ae62099d70b

New changeset d8d67b502bcc by Benjamin Peterson in branch 'default':
merge 3.5 (#25630)
https://hg.python.org/cpython/rev/d8d67b502bcc
History
Date User Action Args
2022-04-11 14:58:23adminsetgithub: 69816
2015-11-16 05:58:19python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg254714

resolution: fixed
stage: resolved
2015-11-15 23:22:18Paweł Krawczykcreate