[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-09-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Oren!

--

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-09-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-09-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 99a51d4e5b154a7b8d971090fecc1e34769a3ca1 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
[3.6] bpo-31315: Fix an assertion failure in imp.create_dynamic(), when 
spec.name is not a string. (GH-3257) (#3653)
https://github.com/python/cpython/commit/99a51d4e5b154a7b8d971090fecc1e34769a3ca1


--

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-09-19 Thread Roundup Robot

Changes by Roundup Robot :


--
keywords: +patch
pull_requests: +3646

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-09-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 9974e1bcf3d0cec9b38b39b39b7ec8a1ebd9ef54 by Serhiy Storchaka 
(Oren Milman) in branch 'master':
bpo-31315: Fix an assertion failure in imp.create_dynamic(), when spec.name is 
not a string. (#3257)
https://github.com/python/cpython/commit/9974e1bcf3d0cec9b38b39b39b7ec8a1ebd9ef54


--

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-09-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> patch review
versions: +Python 2.7, Python 3.6

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-09-01 Thread Eric Snow

Eric Snow added the comment:

On Thu, Aug 31, 2017 at 1:32 PM, Brett Cannon  wrote:
> I think throwing a TypeError is valid if it's triggering an assertion error 
> that is already there.

+1

> P.S. Thanks for all the fuzz testing you're doing, Oren!

Also a big +1. :)

--

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-08-31 Thread Oren Milman

Changes by Oren Milman :


--
pull_requests: +3301

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-08-31 Thread Brett Cannon

Brett Cannon added the comment:

Yes, I'm saying that instead of hitting the C-level assertion error an explicit 
TypeError should be raised (or some other change like calling str() on the 
object). Either way, a C-level assertion from valid Python code is bad. :)

--

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-08-31 Thread Oren Milman

Oren Milman added the comment:

do you mean that we should fix it to raise a TypeError?

the assertion is there, but not explicitly. 
get_encoded_name() calls PyUnicode_FindChar(), which calls
PyUnicode_READY(), which does assert(_PyUnicode_CHECK).

so i get:
>>> import imp
>>>
>>> class BadSpec:
... name = 42
... origin = 'foo'
...
>>> imp.create_dynamic(BadSpec())
Assertion failed: PyUnicode_Check(op), file ..\Objects\unicodeobject.c, line 380

--

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-08-31 Thread Brett Cannon

Brett Cannon added the comment:

I'm about to go on vacation so I might not be right of mind to comment, but I 
think throwing a TypeError is valid if it's triggering an assertion error that 
is already there.

P.S. Thanks for all the fuzz testing you're doing, Oren!

--

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-08-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +brett.cannon, eric.snow, ncoghlan, serhiy.storchaka

___
Python tracker 

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



[issue31315] assertion failure in imp.create_dynamic(), when spec.name is not a string

2017-08-31 Thread Oren Milman

New submission from Oren Milman:

The following code causes an assertion failure in get_encoded_name(), which is
called by _PyImport_LoadDynamicModuleWithSpec() (in Python/importdl.c):

import imp

class BadSpec:
name = 42
origin = 'foo'

imp.create_dynamic(BadSpec())


this is because _PyImport_LoadDynamicModuleWithSpec() assumes that spec.name is
a string.


should we fix this (even though imp is deprecated)?

--
components: Extension Modules
messages: 301050
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: assertion failure in imp.create_dynamic(), when spec.name is not a string
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