[New-bugs-announce] [issue31291] an assertion failure in zipimport.zipimporter.get_data()

Oren Milman report at bugs.python.org
Mon Aug 28 04:44:26 EDT 2017


New submission from Oren Milman:

on Windows, assuming the file 'foo.zip' exists, the following would cause an
assertion failure in Modules/zipimport.c in zipimport_zipimporter_get_data_impl():

import zipimport

class BadStr(str):
    def replace(self, old, new):
        return 42

zipimport.zipimporter('foo.zip').get_data(BadStr('bar'))


this is because zipimport_zipimporter_get_data_impl() assumes that
BadStr('bar').replace('/', '\\') is a string.

----------
components: Interpreter Core
messages: 300944
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: an assertion failure in zipimport.zipimporter.get_data()
type: crash
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31291>
_______________________________________


More information about the New-bugs-announce mailing list