[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-14 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 5dbb28ececdd0382d85b164aaf37bec1ae08036c by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
[3.6] bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of 
an exception with a bad __module__ attribute. (GH-3539) (#3556)
https://github.com/python/cpython/commit/5dbb28ececdd0382d85b164aaf37bec1ae08036c


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +3548

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset f6e61df01536493f1280cd07639c7ff9bffb2cdc by Serhiy Storchaka 
(Oren Milman) in branch 'master':
bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an 
exception with a bad __module__ attribute. (#3539)
https://github.com/python/cpython/commit/f6e61df01536493f1280cd07639c7ff9bffb2cdc


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
versions: +Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Oren Milman

Changes by Oren Milman :


--
keywords: +patch
pull_requests: +3534
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

PyFile_WriteObject(moduleName, f, Py_PRINT_RAW) implicitly converts its 
argument to string. I mean that treating non-string moduleName the same way as 
string moduleName not equal to string "builtins" and calling 
PyFile_WriteObject() would cause other problem. Treating non-string moduleName 
the same way as moduleName==NULL LGTM.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-13 Thread Oren Milman

Oren Milman added the comment:

what do you mean by 'Implicit converting to str can raise a warning or 
exception if __module__ is a bytes object.'?

should we treat __module__ differently in case it is a bytes object?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think this patch doesn't need a test (which would require using a subprocess).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Printing '' LGTM.

Implicit converting to str can raise a warning or exception if __module__ is a 
bytes object.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

2017-09-11 Thread Oren Milman

New submission from Oren Milman:

The following code causes an assertion failure in PyErr_WriteUnraisable() (in
Python/errors.c):

class BadException(Exception):
__module__ = None

class BadClass:
def __del__(self):
raise BadException

foo = BadClass()
del foo


this is because PyErr_WriteUnraisable() assumes that __module__ is a string,
and passes it to _PyUnicode_EqualToASCIIId(), which asserts it received a 
string.


what is the wanted behavior in such a case?
should we ignore the bad __module__ and print '' as the module name
in the traceback?

--
components: Interpreter Core
messages: 301872
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: assertion failure in PyErr_WriteUnraisable() in case of an exception 
with a bad __module__
type: crash
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com