This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 257531

Summary: IllegalArgumentException: Cannot create PyString with non-byte value
Product: python Reporter: Jenselme
Component: -- Other --Assignee: Jenselme
Status: STARTED ---    
Severity: normal CC: Alniks, Jenselme
Priority: P4    
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 222075
Attachments: stacktrace
stacktrace

Description Jenselme 2016-01-12 09:18:54 UTC
This bug was originally marked as duplicate of bug 254204, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 8.1 (Build 201510222201)
VM: OpenJDK 64-Bit Server VM, 25.65-b01, OpenJDK Runtime Environment, 1.8.0_65-b17
OS: Linux

User Comments:
Jenselme: If I create a string with some specific UTF-8 characters, this problems occurs. By instance:

'''A,, b, ?'''




Stacktrace: 
java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
   at org.python.core.PyString.<init>(PyString.java:64)
   at org.python.core.PyString.<init>(PyString.java:70)
   at org.python.antlr.GrammarActions.extractStrings(GrammarActions.java:477)
   at org.python.antlr.PythonParser.atom(PythonParser.java:10996)
   at org.python.antlr.PythonParser.power(PythonParser.java:10363)
   at org.python.antlr.PythonParser.factor(PythonParser.java:10290)
Comment 1 Jenselme 2016-01-12 09:18:55 UTC
Created attachment 158094 [details]
stacktrace
Comment 2 Lou Dasaro 2016-01-15 20:36:45 UTC
Did you include "# -*- coding: utf-8 -*-" or similar?
Reassigning to Vincent for evaluation.
Comment 3 Jenselme 2016-12-02 09:09:08 UTC
Created attachment 163126 [details]
stacktrace

Can reproduce with
params={'text': '+-*/\'"[]()??$??<>^??@??=?%????&|?`???????~????{}\\??????'}
params={'text': '??????'},
Comment 4 Jenselme 2016-12-02 09:12:12 UTC
If I include "# -*- coding: utf-8 -*-" at the top of the file, the problem disappears. However, I write Python 3 and this header is not required any more. I'll look into it.
Comment 5 Jenselme 2016-12-04 12:45:38 UTC
author	Julien Enselme <jenselme@netbeans.org>
	Sun, 04 Dec 2016 13:37:51 +0100 (7 minutes ago)
changeset 18392 	6ccd27d3f884
parent 18391 	044f0cf6fb6b
#257531: Prevent errors on files containing non ascii characters without the encoding header