[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2016-09-14 Thread Sye van der Veen
Sye van der Veen added the comment: I would also agree that failing to load the main codec should be an abort. This bug was specifically the race condition in writing the .pyc file. Thanks for all your help! -- ___ Python tracker

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2016-09-12 Thread Eric Snow
Eric Snow added the comment: With issue #28007 wrapped up, there isn't a lot left to do here. I was considering that we don't want to abort when we have problems loading a codec during startup. However, Steve Dower made the point to me that a problem with the main codec during startup

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2016-09-07 Thread Eric Snow
Eric Snow added the comment: I've opened #28007 to cover the concerns about bad a .pyc file blocking import from a valid .py file. -- ___ Python tracker

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2016-09-07 Thread Eric Snow
Changes by Eric Snow : Removed file: http://bugs.python.org/file44424/issue16384.diff ___ Python tracker ___

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2016-09-07 Thread Eric Snow
Eric Snow added the comment: Here's an updated patch. Per a suggestion from Brett, I've chained the original EOFError with an ImportError. The consequence is that the problematic encoding is skipped (silently) rather than causing the interpreter to abort. FYI, I've opened issue #28005 to

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2016-09-07 Thread Brett Cannon
Brett Cannon added the comment: It's a question of whether you want the error that your .pyc files have somehow ended up in a bad state to pass silently or you should know you that something on your system is corrupting .pyc files (hence why the EOFError has been allowed to propagate).

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2016-09-07 Thread Sye van der Veen
Sye van der Veen added the comment: I feel this patch (file44424) misses the mark. Any two Python processes that try to import a module, without a pyc, at the same time could suffer race conditions. The first process will start to write the pyc, get interrupted, and the second will fail with an

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2016-09-06 Thread Eric Snow
Eric Snow added the comment: After looking more closely, it looks like we should be ignoring such bogus modules. Here's a patch to do so. -- keywords: +patch stage: test needed -> patch review Added file: http://bugs.python.org/file44424/issue16384.diff

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2016-09-06 Thread Eric Snow
Eric Snow added the comment: I have verified that this is still a problem (basically 3.6b1). Fatal Python error: Py_Initialize: Unable to get the locale encoding Traceback (most recent call last): File "/opt/python3.6/lib/python3.6/encodings/__init__.py", line 99, in search_function File

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2012-11-12 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16384 ___ ___ Python-bugs-list

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2012-11-02 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16384 ___ ___ Python-bugs-list

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2012-11-02 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- type: crash - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16384 ___ ___ Python-bugs-list

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2012-11-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: The import machinery was changed in 3.3.0. I suggest checking if it gives you *exactly* the same behavior. -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16384

[issue16384] import.c doesn't handle EOFError from PyMarshal_Read*

2012-11-01 Thread Sye van der Veen
New submission from Sye van der Veen: The PyMarshal_Read* functions raise EOFError when the end of the file is unexpectedly met. The current import.c functions propagate this error when reading .pyc or .pyo files. One consequence of this is that Python will abort on startup if, say,