[Python-bugs-list] [ python-Bugs-417093 ] Case sensitive import: dir and .py file w/ same name

noreply@sourceforge.net noreply@sourceforge.net
Sun, 29 Apr 2001 15:22:24 -0700


Bugs item #417093, was updated on 2001-04-18 09:09
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=417093&group_id=5470

Category: Python Interpreter Core
Group: Platform-specific
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Thomas Heller (theller)
Assigned to: Tim Peters (tim_one)
Summary: Case sensitive import: dir and .py file w/ same name

Initial Comment:
Consider the following files in the current directory:

Spam.py
spam/__init__.py

Using python 2.0:

Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import Spam
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: Case mismatch for module name Spam
(filename spam)
>>> import spam; print spam
<module 'spam' from 'spam\__init__.py'>
>>>

Using python 2.1:

Python 2.1c2 (#14, Apr 15 2001, 21:29:05) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import Spam
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: NULL result without error in call_object
>>> import spam; print spam
<module 'spam' from 'spam\__init__.py'>
>>>


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

>Comment By: Tim Peters (tim_one)
Date: 2001-04-29 15:22

Message:
Logged In: YES 
user_id=31435

Part of the code I didn't understand at the time assumed 
that something was an error on these platforms; in the new 
scheme, it was no longer an error so the routine it called 
didn't set an error string, but the code returned NULL 
anyway.  Fixed now (it's not an error anymore so should not 
return NULL).  New behavior:

Python 2.2a0 (#16, Apr 20 2001, 23:16:12) [MSC 32 bit 
(Intel)] on win32
>>> import Spam
>>> Spam
<module 'Spam' from 'Spam.py'>
>>> import spam
>>> spam
<module 'spam' from 'spam\__init__.py'>
>>>

Checked into Python/import.c rev 2.177.


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

Comment By: Tim Peters (tim_one)
Date: 2001-04-29 15:11

Message:
Logged In: YES 
user_id=31435

Looks like this bug should pop up on any platform w/ a case-
preserving case-insensitive filesystem, so fiddled 
descriptions and categories accordingly.

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

Comment By: Tim Peters (tim_one)
Date: 2001-04-18 15:56

Message:
Logged In: YES 
user_id=31435

Assigned to me.  Regardless of what should or shouldn't 
happen, a SystemError is *always* "a bug".


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

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