Skip to content

Commit 963fb95

Browse files
committed
Merge branch 'main' into 3.6
2 parents 4df6d1d + 8bf8cb5 commit 963fb95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2241
-212
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ jobs:
1616
- name: Install tools
1717
if: matrix.os == 'ubuntu-22.04'
1818
run: sudo apt-get -yq install mono-vbnc dos2unix
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v6
2020
with:
2121
submodules: true
2222

2323
# Setup .NET
2424
- name: Setup .NET 10.0
25-
uses: actions/setup-dotnet@v4
25+
uses: actions/setup-dotnet@v5
2626
with:
2727
dotnet-version: '10.0.x'
2828
- name: Setup .NET 9.0
29-
uses: actions/setup-dotnet@v4
29+
uses: actions/setup-dotnet@v5
3030
with:
3131
dotnet-version: '9.0.x'
3232
- name: Setup .NET 8.0
33-
uses: actions/setup-dotnet@v4
33+
uses: actions/setup-dotnet@v5
3434
with:
3535
dotnet-version: '8.0.x'
3636

@@ -49,7 +49,7 @@ jobs:
4949
run: pwsh make.ps1 package
5050

5151
# Upload package
52-
- uses: actions/upload-artifact@v4
52+
- uses: actions/upload-artifact@v7
5353
with:
5454
name: packages-${{ matrix.os }}
5555
path: Package/Release/Packages
@@ -65,21 +65,21 @@ jobs:
6565

6666
steps:
6767
# Prerequisites
68-
- uses: actions/checkout@v4
68+
- uses: actions/checkout@v6
6969
with:
7070
submodules: true
7171

7272
# Setup .NET
7373
- name: Setup .NET 10.0
74-
uses: actions/setup-dotnet@v4
74+
uses: actions/setup-dotnet@v5
7575
with:
7676
dotnet-version: '10.0.x'
7777
- name: Setup .NET 9.0
78-
uses: actions/setup-dotnet@v4
78+
uses: actions/setup-dotnet@v5
7979
with:
8080
dotnet-version: '9.0.x'
8181
- name: Setup .NET 8.0
82-
uses: actions/setup-dotnet@v4
82+
uses: actions/setup-dotnet@v5
8383
with:
8484
dotnet-version: '8.0.x'
8585

IronPython.slnx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
<File Path="Build.proj" />
1414
<File Path="CurrentVersion.props" />
1515
<File Path="Directory.Build.props" />
16-
<File Path="IronPython.ruleset" />
1716
<File Path="LICENSE" />
1817
<File Path="make.ps1" />
19-
<File Path="NuGet.config" />
2018
<File Path="README.md" />
2119
</Folder>
2220
<Folder Name="/Solution Items/Build/">

eng/scripts/CompareDirs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ def compare_dirs(dir1, dir2):
2121

2222
def main():
2323
if len(sys.argv)!=3:
24-
print 'Usage: CompareDirs <dir1> <dir2>'
24+
print('Usage: CompareDirs <dir1> <dir2>')
2525
sys.exit(-1)
2626

2727
if compare_dirs(sys.argv[1],sys.argv[2]):
28-
print "The directories are identical"
28+
print("The directories are identical")
2929
sys.exit(0)
3030
else: #the part that differed is explained via dircmp.report() above
31-
print "The directories differ"
31+
print("The directories differ")
3232
sys.exit(1)
3333

3434
if __name__=="__main__":

eng/scripts/clean.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def do_dir(dirname):
1717
if os.path.isdir(filename):
1818
do_dir(filename)
1919
elif is_binary(filename):
20-
print 'deleting', filename
20+
print('deleting', filename)
2121
os.remove(filename)
2222

2323
TOP_DIR = "c:\\IronPython-0.7"

eng/scripts/copyrights.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@
5151
def add_header(filename, old_header, new_header):
5252
text = open(filename, 'r').read()
5353
if text.startswith(old_header):
54-
print "replacing header", filename
54+
print("replacing header", filename)
5555
text = new_header + text[len(old_header):]
5656
open(filename, 'w').write(text)
5757
elif not text.startswith(new_header):
58-
print 'no old header', filename
58+
print('no old header', filename)
5959
text = new_header + "\n" + text
6060
open(filename, 'w').write(text)
6161

6262
def do_dir(dirname):
6363
import os
6464
for file in os.listdir(dirname):
65-
print "Processing:", file
65+
print("Processing:", file)
6666
if file == "ExternalCode": continue
6767
filename = os.path.join(dirname, file)
6868
if os.path.isdir(filename):

eng/scripts/generate_casts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def mark_cls_compliance(cw, t):
8282
def generate_type_cast(cw, t):
8383
mark_cls_compliance(cw, t)
8484
cw.enter_block("public static %(type)s ExplicitCastTo%(type)s(object o)", type = t)
85-
cw.enter_block("if (o != null)")
85+
cw.enter_block("if (o is not null)")
8686
cw.write("Type type = o.GetType();");
8787

8888
cond = cw.conditions()
@@ -112,7 +112,7 @@ def generate_type_cast(cw, t):
112112
def generate_nullable_type_cast(cw, t):
113113
mark_cls_compliance(cw, t)
114114
cw.enter_block("public static Nullable<%(type)s> ExplicitCastToNullable%(type)s(object o)", type = t)
115-
cw.enter_block("if (o == null)")
115+
cw.enter_block("if (o is null)")
116116
cw.write("return new Nullable<%(type)s>();", type = t);
117117
cw.exit_block()
118118
cw.write("Type type = o.GetType();");

eng/scripts/generate_comdispatch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def gen_exposed_code_security(cw):
187187
"return null;"
188188
],
189189
setStatements=[
190-
"if (value != null) {",
190+
"if (value is not null) {",
191191
" Marshal.GetNativeVariantForObject(value, UnsafeMethods.ConvertVariantByrefToPtr(ref this));",
192192
"}"
193193
],
@@ -202,7 +202,7 @@ def gen_exposed_code_security(cw):
202202
"return null;"
203203
],
204204
setStatements=[
205-
"if (value != null) {",
205+
"if (value is not null) {",
206206
" _typeUnion._unionTypes._unknown = Marshal.GetIUnknownForObject(value);",
207207
"}"
208208
],
@@ -217,7 +217,7 @@ def gen_exposed_code_security(cw):
217217
"return null;"
218218
],
219219
setStatements=[
220-
"if (value != null) {",
220+
"if (value is not null) {",
221221
" _typeUnion._unionTypes._unknown = GetIDispatchForObject(value);",
222222
"}"
223223
],

eng/scripts/generate_dynamic_instructions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def gen_instruction(cw, n):
4141
func_type_params = ','.join(['CallSite'] + type_names + ['TRet'])
4242
func_type = 'Func<%s>' % func_type_params
4343

44-
cw.enter_block('internal class DynamicInstruction<%s> : Instruction' % class_type_params)
44+
cw.enter_block('internal sealed class DynamicInstruction<%s> : Instruction' % class_type_params)
4545
cw.write('private CallSite<%s> _site;' % func_type)
4646
cw.write('')
4747
cw.enter_block('public static Instruction Factory(CallSiteBinder binder)')
@@ -116,7 +116,7 @@ def gen_run_method(cw, n, is_void):
116116
types,
117117
','.join(param_names)))
118118

119-
cw.enter_block('if (_compiled != null || TryGetCompiled())')
119+
cw.enter_block('if (_compiled is not null || TryGetCompiled())')
120120
args = ', '.join(['arg%d' % i for i in range(n)])
121121
if is_void:
122122
cw.write('((Action%s)_compiled)(%s);' % (types, args))

eng/scripts/generate_exceptions.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def MakeNewException(self):
8585
ExceptionInfo('Exception', 'IronPython.Runtime.Exceptions.PythonException', None, (), (
8686
ExceptionInfo('StopIteration', 'IronPython.Runtime.Exceptions.StopIterationException', None, ('value',), ()),
8787
ExceptionInfo('StopAsyncIteration', 'IronPython.Runtime.Exceptions.StopAsyncIterationException', None, ('value',), ()),
88+
ExceptionInfo('CancelledError', 'System.OperationCanceledException', None, (), ()),
8889
ExceptionInfo('ArithmeticError', 'System.ArithmeticException', None, (), (
8990
ExceptionInfo('FloatingPointError', 'IronPython.Runtime.Exceptions.FloatingPointException', None, (), ()),
9091
ExceptionInfo('OverflowError', 'System.OverflowException', None, (), ()),
@@ -261,16 +262,26 @@ def gen_topython_helper(cw):
261262
cw.exit_block()
262263

263264

265+
_clr_name_overrides = {
266+
'CancelledError': 'OperationCanceledException',
267+
}
268+
264269
def get_clr_name(e):
270+
if e in _clr_name_overrides:
271+
return _clr_name_overrides[e]
265272
return e.replace('Error', '') + 'Exception'
266273

267274
FACTORY = """
268275
internal static Exception %(name)s(string message) => new %(clrname)s(message);
269276
public static Exception %(name)s(string format, params object?[] args) => new %(clrname)s(string.Format(format, args));
270277
""".rstrip()
271278

279+
# Exceptions that map to existing CLR types (no generated CLR class needed),
280+
# but still need factory methods in PythonOps.
281+
_factory_only_exceptions = ['CancelledError']
282+
272283
def factory_gen(cw):
273-
for e in pythonExcs:
284+
for e in pythonExcs + _factory_only_exceptions:
274285
cw.write(FACTORY, name=e, clrname=get_clr_name(e))
275286

276287
CLASS1 = """\

eng/scripts/generate_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
kwlist = [
1111
'and', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except',
1212
'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass',
13-
'raise', 'return', 'try', 'while', 'yield', 'as', 'with', 'async', 'nonlocal'
13+
'raise', 'return', 'try', 'while', 'yield', 'as', 'with', 'async', 'nonlocal', 'await'
1414
]
1515

1616
class Symbol:

0 commit comments

Comments
 (0)