Message11421

Author zyasoft
Recipients tkanerva, zyasoft
Date 2017-06-09.02:32:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1496975548.47.0.682326862788.issue2593@psf.upfronthosting.co.za>
In-reply-to
Content
In Jython 2.7.1rc2, as well as 2.7.0 (so no regression):

$ ~/jython2.7.1rc2/bin/jython t-write-list.py
Traceback (most recent call last):
  File "t-write-list.py", line 3, in <module>
    f.write(lst)
java.lang.NullPointerException
	at org.python.google.common.base.CharMatcher.matchesAllOf(CharMatcher.java:635)
	at org.python.core.Py.newStringOrUnicode(Py.java:674)
	at org.python.core.Py.newStringOrUnicode(Py.java:659)
	at org.python.core.PyException.<init>(PyException.java:61)
	at org.python.core.Py.TypeError(Py.java:265)
	at org.python.core.PyFile.asWritable(PyFile.java:512)
	at org.python.core.PyFile.file_write(PyFile.java:450)
	at org.python.core.PyFile$file_write_exposer.__call__(Unknown Source)
	at org.python.core.PyObject.__call__(PyObject.java:484)
	at org.python.pycode._pyx0.f$0(t-write-list.py:3)
	at org.python.pycode._pyx0.call_function(t-write-list.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1615)
	at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:296)
	at org.python.util.jython.run(jython.java:362)
	at org.python.util.jython.main(jython.java:142)
java.lang.NullPointerException: java.lang.NullPointerException

In Python 2.7:

$ python t-write-list.py
Traceback (most recent call last):
  File "t-write-list.py", line 3, in <module>
    f.write(lst)
TypeError: must be string or buffer, not list

Note that if the object being written is not a built-in type, one will get the following error:

$ python t-write-obj.py
Traceback (most recent call last):
  File "t-write-obj.py", line 9, in <module>
    f.write(foo)
TypeError: must be convertible to a buffer, not Foo

Ideally we can get this fixed for 2.7.1, since it is an easily observed NPE, which we try to never see in Jython.
History
Date User Action Args
2017-06-09 02:32:28zyasoftsetmessageid: <1496975548.47.0.682326862788.issue2593@psf.upfronthosting.co.za>
2017-06-09 02:32:28zyasoftsetrecipients: + zyasoft, tkanerva
2017-06-09 02:32:28zyasoftlinkissue2593 messages
2017-06-09 02:32:26zyasoftcreate