Issue1847091

classification
Title: del statement doesn't work on builtin modules
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: dubnerm, zyasoft
Priority: normal Keywords:

Created on 2007-12-09.01:59:32 by dubnerm, last changed 2008-09-14.05:41:45 by zyasoft.

Messages
msg2038 (view) Author: Michael Dubner (dubnerm) Date: 2007-12-09.01:59:32
Let's create file:
---qq.py
import sys
if hasattr(sys, 'exit'):
  print 'first if'
  del sys.exit
if hasattr(sys, 'exit'):
  print 'second if'
  del sys.exit
print 'done'
---cut
Now let's run it in standard python:
# python qq.py
first if
done
And now in jython:
# jython qq.py
first if
second if
Traceback (innermost last):
  File "qq.py", line 7, in ?
KeyError: exit

Example from standard library:
  # jython Lib/site.py
should output sys.path, but failes with following error:
  Traceback (innermost last):
    File "Lib\site.py", line 254, in ?
  KeyError: setdefaultencoding
msg3581 (view) Author: Jim Baker (zyasoft) Date: 2008-09-14.05:41:44
Only applied to attributes of sys (PySystemState) due to its special way
it's implemented to look like a regular module.
Fixed in 2.5 by r5185
Tested by test_sys.py and test_sys_jy.py
History
Date User Action Args
2008-09-14 05:41:45zyasoftsetstatus: open -> closed
resolution: fixed
messages: + msg3581
nosy: + zyasoft
2007-12-09 01:59:32dubnermcreate