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.
Type the following exactly letter for letter: test = '\u while pressing the opening quote (') the editor places the closing ' automatically behind it. While entering the letter "u" a pop-up with an error is raised, so as far as I'm aware you are unable to enter an escaped hex. character sequence without getting this pop-up. I believe this is a different issue than the other reported UnicodeDecodeError issues. Exception in popup: Annotation: Was parsing C:\Users\Vincent\Documents\NetBeansProjects\NewPythonProject3\src\newpythonproject3.py Annotation: Was parsing C:\Users\Vincent\Documents\NetBeansProjects\NewPythonProject3\src\newpythonproject3.py Was parsing C:\Users\Vincent\Documents\NetBeansProjects\NewPythonProject3\src\newpythonproject3.py Was parsing C:\Users\Vincent\Documents\NetBeansProjects\NewPythonProject3\src\newpythonproject3.py Caused: UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 1-2: truncated \xXX at org.python.core.codecs.strict_errors(codecs.java:217) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.python.core.JavaFunc.__call__(Py.java:2015) at org.python.core.PyObject.__call__(PyObject.java:367) at org.python.core.codecs.decoding_error(codecs.java:1267) at org.python.core.codecs.insertReplacementAndGetResume(codecs.java:1243) at org.python.core.PyString.hexescape(PyString.java:408) at org.python.core.PyString.decode_UnicodeEscape(PyString.java:297) at org.python.antlr.GrammarActions.extractString(GrammarActions.java:463) at org.python.antlr.GrammarActions.extractStrings(GrammarActions.java:400) at org.python.antlr.PythonParser.atom(PythonParser.java:11292) at org.python.antlr.PythonParser.power(PythonParser.java:10406) at org.python.antlr.PythonParser.factor(PythonParser.java:10337) at org.python.antlr.PythonParser.term(PythonParser.java:9914) at org.python.antlr.PythonParser.arith_expr(PythonParser.java:9654) at org.python.antlr.PythonParser.shift_expr(PythonParser.java:9395) at org.python.antlr.PythonParser.and_expr(PythonParser.java:9235) at org.python.antlr.PythonParser.xor_expr(PythonParser.java:9078) at org.python.antlr.PythonParser.expr(PythonParser.java:8920) at org.python.antlr.PythonParser.comparison(PythonParser.java:8492) at org.python.antlr.PythonParser.not_test(PythonParser.java:8432) at org.python.antlr.PythonParser.and_test(PythonParser.java:8214) at org.python.antlr.PythonParser.or_test(PythonParser.java:8057) at org.python.antlr.PythonParser.test(PythonParser.java:7904) at org.python.antlr.PythonParser.testlist(PythonParser.java:13069) at org.python.antlr.PythonParser.expr_stmt(PythonParser.java:2954) at org.python.antlr.PythonParser.small_stmt(PythonParser.java:2613) at org.python.antlr.PythonParser.simple_stmt(PythonParser.java:2462) at org.python.antlr.PythonParser.stmt(PythonParser.java:2376) at org.python.antlr.PythonParser.file_input(PythonParser.java:631) [catch] at org.netbeans.modules.python.editor.PythonParser.parse(PythonParser.java:306) at org.netbeans.modules.python.editor.PythonParser.parse(PythonParser.java:145) at org.netbeans.modules.parsing.impl.TaskProcessor.callParse(TaskProcessor.java:621) at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:251) at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:798) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:304) at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:725) at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:686) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1425) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2038)
Hi Vincent, I'm not seeing any errors while replicating your test. I entered test = '\u' character by character and received no errors, using this environment: Product Version: NetBeans IDE Dev (Build 201504040001) Java: 1.8.0_31; Java HotSpot(TM) Client VM 25.31-b07 Runtime: Java(TM) SE Runtime Environment 1.8.0_31-b13 System: Windows 8 version 6.2 running on x86; Cp1252; en_US (nb) Python: Jython 2.5.1 Please make sure you are using a recent DEVELOPMENT version of NetBeans IDE from http://bits.netbeans.org/download/trunk/nightly/latest/ AND with Python plugin installed from "Latest Build" update center at http://bits.netbeans.org/dev/nbms-and-javadoc/lastSuccessfulBuild/artifact/nbbuild/nbms/updates.xml.gz
Created attachment 153087 [details] Exception UnicodeDecodeError UPDATE: Although '\u' produced no anomaly for me, just for sanity sake, I tested '\a' through '\z' and an Exception (UnicodeDecodeError) occurred, but ONLY for '\x' Therefore this bug is valid for the case where test = '\x'
Sorry Lou, I should have been much more careful. It happens both with: '\x' and u'\u' (\u escaping is only recognized on unicode strings, while \x works with any encoding) Fore more information about valid escape characters in Python 2.x, see https://docs.python.org/2/reference/lexical_analysis.html
The thing is, users are going to type randomly, and good testers will type all sorts of nonsense. They need to be shown errors instead of exceptions...
Resolved in: changeset: 18519:517409415907 bookmark: main tag: tip user: Julien Enselme <jenselme@netbeans.org> date: Tue Jun 27 21:26:18 2017 +0200 summary: #251705: UnicodeDecodeError pop-up while entering \x code