Issue495602

classification
Title: os.path.dirname() can result in an NPE
Type: Severity: normal
Components: Library Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: bckfnn Nosy List: bckfnn, bzimmer
Priority: normal Keywords:

Created on 2001-12-20.20:47:10 by bzimmer, last changed 2001-12-27.15:18:50 by bckfnn.

Messages
msg537 (view) Author: Brian Zimmer (bzimmer) Date: 2001-12-20.20:47:10
os.path.dirname() does not check if the the filename 
is None.

$ jython
Jython 2.1b2 on java1.3.1 (JIT: null)
Type "copyright", "credits" or "license" for more 
information.
>>> import os.path
>>> os.path.dirname(None)
Traceback (innermost last):
  File "<console>", line 1, in ?
  
File "c:\home\development\sourceforge\jython\Lib\javapa
th.py", line 25, in dirname
java.lang.NullPointerException
        at java.io.File.<init>(File.java:180)
        at java.lang.reflect.Constructor.newInstance
(Native Method)
        at 
org.python.core.PyReflectedConstructor.__call__
(PyReflectedConstructor.java:126)

$ python
Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit 
(Intel)] on win32
Type "copyright", "credits" or "license" for more 
information.
>>> import os.path
>>> os.path.dirname(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "c:\python\cpython\2.1\Lib\ntpath.py", line 
156, in dirname
    return split(p)[0]
  File "c:\python\cpython\2.1\Lib\ntpath.py", line 
105, in split
    d, p = splitdrive(p)
  File "c:\python\cpython\2.1\Lib\ntpath.py", line 60, 
in splitdrive
    if p[1:2] == ':':
TypeError: unsliceable object
>>>

msg538 (view) Author: Finn Bock (bckfnn) Date: 2001-12-27.11:44:46
Logged In: YES 
user_id=4201

Added as test352.py
msg539 (view) Author: Finn Bock (bckfnn) Date: 2001-12-27.15:18:50
Logged In: YES 
user_id=4201

Fixed in javapath.py: 1.9
History
Date User Action Args
2001-12-20 20:47:10bzimmercreate