diff --git a/Src/IronPython/Compiler/Ast/ClassDefinition.cs b/Src/IronPython/Compiler/Ast/ClassDefinition.cs index 03008edc6..1b126d4fe 100644 --- a/Src/IronPython/Compiler/Ast/ClassDefinition.cs +++ b/Src/IronPython/Compiler/Ast/ClassDefinition.cs @@ -299,7 +299,7 @@ private Microsoft.Scripting.Ast.LightExpression> MSAst.Expression? docStmt = null; string? doc = GetDocumentation(Body); if (doc is not null) { - docStmt = SetLocalName("__doc__", Ast.Constant(doc, typeof(object))); + docStmt = SetLocalName("__doc__", Ast.Constant(doc, typeof(string))); } // Create the body diff --git a/Tests/test_regressions.py b/Tests/test_regressions.py index bb7165e09..c3408a8e0 100644 --- a/Tests/test_regressions.py +++ b/Tests/test_regressions.py @@ -824,24 +824,6 @@ class SomeOtherError(SomeError, IOError): except SomeOtherError: pass - - @unittest.skipIf(is_netcoreapp, 'no clr.CompileModules') - @skipUnlessIronPython() - def test_gh1357(self): - filename = os.path.join(self.temporary_dir, 'gh1357_%d.py' % os.getpid()) - dll = os.path.join(self.temporary_dir, "test_%d.dll" % os.getpid()) - with open(filename, 'w') as f: - f.write('{(1,): None}') - - import clr - try: - clr.CompileModules(dll, filename) - except: - Fail('Failed to compile the specified file') - finally: - os.unlink(filename) - os.unlink(dll) - @skipUnlessIronPython() def test_gh1435(self): import clr diff --git a/Tests/test_regressions_compiled.py b/Tests/test_regressions_compiled.py index 1b15cb94b..1fb109680 100644 --- a/Tests/test_regressions_compiled.py +++ b/Tests/test_regressions_compiled.py @@ -6,11 +6,49 @@ Test issues related to compiled code. """ -from iptest import IronPythonTestCase, run_test +import os +import unittest + +from iptest import IronPythonTestCase, is_netcoreapp, skipUnlessIronPython, run_test class RegressionCompiledTest(IronPythonTestCase): def test_gh_ipy2_563(self): """https://github.com/IronLanguages/ironpython2/issues/563""" eval('3.14') + @unittest.skipIf(is_netcoreapp, 'no clr.CompileModules') + @skipUnlessIronPython() + def test_gh1357(self): + filename = os.path.join(self.temporary_dir, 'gh1357_%d.py' % os.getpid()) + dll = os.path.join(self.temporary_dir, "test_%d.dll" % os.getpid()) + with open(filename, 'w') as f: + f.write('{(1,): None}') + + import clr + try: + clr.CompileModules(dll, filename) + except: + Fail('Failed to compile the specified file') + finally: + os.unlink(filename) + os.unlink(dll) + + @unittest.skipIf(is_netcoreapp, 'no clr.CompileModules') + @skipUnlessIronPython() + def test_ipy3_gh1601(self): + filename = os.path.join(self.temporary_dir, 'test_ipy3_gh1601_%d.py' % os.getpid()) + dll = os.path.join(self.temporary_dir, "test_ipy3_gh1601_%d.dll" % os.getpid()) + with open(filename, 'w') as f: + f.write('class MyClass:\n') + f.write(' """description"""\n') + + import clr + try: + clr.CompileModules(dll, filename) + except: + Fail('Failed to compile the specified file') + finally: + os.unlink(filename) + os.unlink(dll) + run_test(__name__)