[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Brett Cannon
Changes by Brett Cannon : -- resolution: rejected -> stage: resolved -> status: closed -> open ___ Python tracker ___ ___ Python-bug

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Brett Cannon
Brett Cannon added the comment: Could you paste in what the crash looks like? E.g. is it a segfault, SystemError, etc.? And you can tweak the PR or just open a new one if you would rather that fixes the crash itself without taking away duck typing. --

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Oren Milman
Oren Milman added the comment: just checked, and indeed on my Windows 10 the original code I posted here crashes the interpreter. The patch in the PR undermines duck-typing, and that's why I added a comment there, stating I wasn't sure about the patch. an alternate solution would be to simply ch

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Brett Cannon
Brett Cannon added the comment: If it will crash the interpreter then that's different. If that turns out to be the case then please come back here and we can rework the issue and PR to prevent that by being better about checking return values or resulting exception cases. -- ___

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Oren Milman
Oren Milman added the comment: I understand that our goal is to make Python better, not to make me happier :) anyway, I haven't checked, but I am quite sure that similar code might crash the interpreter on a release build of Python. (just wanted to clarify that, as you used the term 'exception'.

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Brett Cannon
Brett Cannon added the comment: I don't think this is a bad thing. This is duck-typing at work to be flexible where the type doesn't really matter, just the provided interface. If someone happens to provide an object that doesn't do the right thing then that's their fault for using the wrong o

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3269 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue31291] an assertion failure in zipimport.zipimporter.get_data()

2017-08-28 Thread Oren Milman
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.zip