Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions IronPython.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@
<Project Path="src/extensions/IronPython.SQLite/IronPython.SQLite.csproj" />
<Project Path="src/extensions/IronPython.Wpf/IronPython.Wpf.csproj" />
<Project Path="src/roslyn/IronPython.Analyzer/IronPython.Analyzer.csproj" />
<Project Path="src/roslyn/IronPython.SourceGenerator/IronPython.SourceGenerator.csproj" />
<Project Path="tests/IronPython.Tests/IronPython.Tests.csproj" />
</Solution>
7 changes: 7 additions & 0 deletions src/core/IronPython/IronPython.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
</ProjectReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\roslyn\IronPython.SourceGenerator\IronPython.SourceGenerator.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Analyzer</OutputItemType>
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
</ItemGroup>
Expand Down
10 changes: 3 additions & 7 deletions src/core/IronPython/Modules/sys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static void setcheckinterval(int value) {
throw PythonOps.NotImplementedError("IronPython does not support sys.setcheckinterval");
}

// warnoptions is set by PythonContext and updated on each reload
// warnoptions is set by PythonContext and updated on each reload

public static PythonTuple exc_info(CodeContext/*!*/ context) {
return PythonOps.GetExceptionInfo(context);
Expand Down Expand Up @@ -294,7 +294,7 @@ public override string __repr__(CodeContext context) {

#if PROFILE_SUPPORT
// not enabled because we don't yet support tracing built-in functions. Doing so is a little
// difficult because it's hard to flip tracing on/off for them w/o a perf overhead in the
// difficult because it's hard to flip tracing on/off for them w/o a perf overhead in the
// non-profiling case.
public static void setprofile(CodeContext/*!*/ context, TracebackDelegate o) {
PythonContext pyContext = context.LanguageContext;
Expand Down Expand Up @@ -489,11 +489,7 @@ public override string __repr__(CodeContext context) {
}
}

#if NETCOREAPP3_1_OR_GREATER
public static string float_repr_style = "short";
#else
public static string float_repr_style = "legacy";
#endif

public static floatinfo float_info = new floatinfo(
Double.MaxValue, // DBL_MAX
Expand Down Expand Up @@ -603,7 +599,7 @@ public static void PerformModuleReload(PythonContext/*!*/ context, PythonDiction

dict["platform"] = PythonContext.GetPlatform();

// !!! These fields do need to be reset on "reload(sys)". However, the initial value is specified by the
// !!! These fields do need to be reset on "reload(sys)". However, the initial value is specified by the
// engine elsewhere. For now, we initialize them just once to some default value
dict["warnoptions"] = new PythonList(0);

Expand Down
23 changes: 2 additions & 21 deletions src/core/IronPython/Runtime/Operations/FloatOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -733,27 +733,8 @@ public static bool NotEquals(Double x, int y) {
return x != y;
}

internal static string Repr(CodeContext/*!*/ context, double self, bool trailingZeroAfterWholeFloat) {
if (double.IsNaN(self)) {
return "nan";
}

// first format using Python's specific formatting rules...
string res = StringFormatter.Format(context, "%.17g", self, trailingZeroAfterWholeFloat: trailingZeroAfterWholeFloat);
if (LiteralParser.ParseFloat(res) == self) {
return res;
}
#if NETCOREAPP3_1_OR_GREATER
Debug.Assert(false);
#endif

// if it's not round trippable though use .NET's round-trip format
res = self.ToString("R", CultureInfo.InvariantCulture);
if (trailingZeroAfterWholeFloat && !res.Contains('.')) {
res += ".0";
}
return res;
}
internal static string Repr(CodeContext/*!*/ context, double self, bool trailingZeroAfterWholeFloat)
=> Schubfach.dtoa(self, trailingZeroAfterWholeFloat);

public static string __repr__(CodeContext/*!*/ context, double self)
=> Repr(context, self, trailingZeroAfterWholeFloat: true);
Expand Down
Loading
Loading