IronLanguages / main

Work for this repo has moved to https://github.com/IronLanguages/ironpython2
1.16k stars 350 forks source link

Calling compile on a bad encoding string doesnt throw error #316

Open ironpythonbot opened 9 years ago

ironpythonbot commented 9 years ago

This is from cpython test - test_coding.py

(Note that the encoding is uft instead of utf)

D:\Merlin\External\Languages\IronPython20\25\Lib>ipyd
IronPython 2.0 Alpha (2.0.0.800) on .NET 2.0.50727.1434
Copyright (c) Microsoft Corporation. All rights reserved.

compile("# - - coding: uft-8 - -", "" ,"exec")
<code object at 0x000000000000002B>
^Z

D:\Merlin\External\Languages\IronPython20\25\Lib>cpy
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
compile("# - - coding: uft-8 - -", "" ,"exec")
Traceback (most recent call last):
File "", line 1, in
File "", line 0
SyntaxError: unknown encoding: uft-8
^Z

Work Item Details

Original CodePlex Issue: Issue 15508 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Mar 8, 2008 at 2:22 AM Reported by: srivatsn Updated on: Feb 22, 2013 at 2:15 AM Updated by: jdhardy Test: (CPy)test_coding.py (verify_bad_module)

ironpythonbot commented 9 years ago

On 2009-05-22 10:21:48 UTC, unknown user commented:

We appear to behave the same as CPython 2.6 and this test only seems to exist as a file (where we throw an exception too).  Here's what CPython now outputs:   Python 2.6 (r26:66721, Oct  2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> compile("# -- coding: uft-8 --", "" ,"exec")<code object at 012C7698, file "", line 1>>>> ^Z

ironpythonbot commented 9 years ago

On 2009-08-04 07:33:53 UTC, dfugate commented:

Not fixed: E:\vslrgrs\Merlin\External.LCA_RESTRICTED\Languages\IronPython\26\Lib>ipyd test\test_coding.py

test_bad_coding (main.CodingTest) ... FAIL test_bad_coding2 (main.CodingTest) ... FAIL FAIL: test_bad_coding (main.CodingTest) Traceback (most recent call last): File "test\test_coding.py", line 8, in test_bad_coding self.verify_bad_module(module_name) File "test\test_coding.py", line 21, in verify_bad_module self.assertRaises(SyntaxError, compile, text, filename, 'exec') AssertionError: SyntaxError not raised FAIL: test_bad_coding2 (main.CodingTest) Traceback (most recent call last): File "test\test_coding.py", line 12, in test_bad_coding2 self.verify_bad_module(module_name) File "test\test_coding.py", line 21, in verify_bad_module self.assertRaises(SyntaxError, compile, text, filename, 'exec') AssertionError: SyntaxError not raised Ran 2 tests in 0.265s

FAILED (failures=2) Traceback (most recent call last): File "test\test_coding.py", line 27, in test\test_coding.py File "test\test_coding.py", line 24, in test_main File "E:\vslrgrs\Merlin\External.LCA_RESTRICTED\Languages\IronPython\26\Lib\test\test_support.py", line 746, in run_un

ittest File "E:\vslrgrs\Merlin\External.LCA_RESTRICTED\Languages\IronPython\26\Lib\test\test_support.py", line 729, in _run_s

uite test.test_support.TestFailed: errors occurred; run in verbose mode for details E:\vslrgrs\Merlin\External.LCA_RESTRICTED\Languages\IronPython\26\Lib>

and this passed under CPython 2.6.

ironpythonbot commented 9 years ago

On 2010-12-12 06:36:03 UTC, rjnienaber commented:

The behavior is still similar CPython 2.6 as shown below:

IronPython 2.7 Beta 1 (2.7.0.10) on .NET 4.0.30319.1 Type "help", "copyright", "credits" or "license" for more information.

compile("# -- coding: uft-8 --", "" ,"exec") <code object at 0x000000000000002B>

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

compile("# -- coding: uft-8 --", "" ,"exec") <code object at 00A8A848, file "", line 1>

One of the test_coding.py tests is failing however: ipy test\test_coding.py test_bad_coding (main.CodingTest) ... ok test_bad_coding2 (main.CodingTest) ... ? FAIL

FAIL: test_bad_coding2 (main.CodingTest) Traceback (most recent call last): File "test\test_coding.py", line 12, in test_bad_coding2 self.verify_bad_module(module_name) File "test\test_coding.py", line 15, in verify_bad_module self.assertRaises(SyntaxError, import, 'test.' + module_name) AssertionError: SyntaxError not raised