Re: [Python-Dev] where is the python "import" implemented

2012-12-11 Thread Antoine Pitrou
Hello, Le Tue, 11 Dec 2012 14:08:27 +0800, "Isml" <76069...@qq.com> a écrit : > Hi, everyone, > I am testing modifying the pyc file when it is imported. As I > know, there is three situation: 1、runing in the python.exe > eg: python.exe test.pyc > in this situation, I find the

Re: [Python-Dev] where is the python "import" implemented

2012-12-11 Thread martin
    in this situation, I can not find the source code how python implement it. I test a wrong format pyc, and got a error "ImportError: bad magic number",and I search "bad magic number" in the source code,  I find it is in importlib/_bootstrap.py(line 815),but when I modify this error info(eg:

[Python-Dev] where is the python "import" implemented

2012-12-10 Thread Isml
Hi, everyone,     I am testing modifying the pyc file when it is imported. As I know, there is three situation:     1、runing in the python.exe eg: python.exe test.pyc     in this situation, I find the source on line 1983 in file pythonrun.c     2、import the pyc from a zip file