[Python-bugs-list] [ python-Bugs-771097 ] frozen programs fail due to implicit import of "warnings"

SourceForge.net noreply@sourceforge.net
Mon, 14 Jul 2003 11:02:38 -0700


Bugs item #771097, was opened at 2003-07-14 11:32
Message generated for change (Comment added) made by atuining
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=771097&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Anthony Tuininga (atuining)
Assigned to: Nobody/Anonymous (nobody)
Summary: frozen programs fail due to implicit import of "warnings"

Initial Comment:
With Python 2.3b2, pythonrun.c now imports the
"warnings" module at startup, which causes problems
with freezing programs like py2exe, cx_Freeze and Installer

The main reason there is a problem is because this
takes place during Py_Initialize() so there is no way
of overriding the import so that it can find a copy of
the warnings module in anything but the filesystem. Is
there any way of getting around this?

What's worse is that warnings.py imports a raft of
other modules (14 others which I can list if necesary)
and so the workaround of simply copying the needed
files is unwieldy.

This is somewhat related to bug 683658.

----------------------------------------------------------------------

>Comment By: Anthony Tuininga (atuining)
Date: 2003-07-14 12:02

Message:
Logged In: YES 
user_id=619560

In current CVS (revision 2.193 of
dist/src/Python/pythonrun.c) at line 193 there is this line

        PyModule_WarningsModule =
PyImport_ImportModule("warnings");

There is no check afterward for any errors. Couldn't a
PyErr_Clear() be done so that further statements don't fail
because the import of warnings failed?


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=771097&group_id=5470