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

Oren Milman report at bugs.python.org
Thu Aug 31 12:25:55 EDT 2017


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 <report at bugs.python.org>
<http://bugs.python.org/issue31315>
_______________________________________


More information about the New-bugs-announce mailing list