Bugs item #1589480, was opened at 2006-11-02 20:10
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1589480&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
>Status: Pending
Resolution: None
Priority: 5
Private: No
Submitted By: Daniel Farina (drfarina)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2 does local import of tokenize.py

Initial Comment:
urllib2 may do a relative import of tokenize.py, which
can cause it to function abnormally when the user has a
file named "tokenizer.py" in the directory as a script
that utilizes urllib2.

The attached tarball has a shell script called
"showme.sh" that will give standard input to afile.py,
which contains two import statements and nothing else.
Code in the neighboring tokenize.py will be executed,
resulting in printing those lines to standard output.

Expected behavior:
no code in tokenize.py should be executed.

Reproducible on Ubuntu 6.10


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

>Comment By: Georg Brandl (gbrandl)
Date: 2006-11-03 16:20

Message:
Logged In: YES 
user_id=849994

I can't reproduce that here with your example code, and
there's also no mention of "tokenize" in urllib2.py.

In any case, "import tokenize" is not a relative import, and
it's the only way a standard library module can import
another standard library module. That this can interfere
with user-defined modules is known and must be worked around
by not naming them like builtin modules.

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

Comment By: Daniel Farina (drfarina)
Date: 2006-11-02 20:16

Message:
Logged In: YES 
user_id=425987

Yet another typo: the script is called "show.sh"

It's the only shell script in there, so no fear.

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

Comment By: Daniel Farina (drfarina)
Date: 2006-11-02 20:11

Message:
Logged In: YES 
user_id=425987

Typo in the above:

"tokenizer.py" should just be "tokenize.py"

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1589480&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to