Skip to content

Commit 4a4d602

Browse files
authored
1 parent 5420206 commit 4a4d602

File tree

17 files changed

+213
-27
lines changed

17 files changed

+213
-27
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### Prerequisites
2+
3+
The issue tracker is used to report bugs and request new features, NOT to ask questions.
4+
5+
Questions should be posted to the users mailing list which can be accessed at
6+
https://ironpython.groups.io/g/users.
7+
8+
* [ ] Are you running the latest version?
9+
* [ ] Are you reporting to the correct repository?
10+
* [ ] Did you perform a cursory search?
11+
12+
### Description
13+
14+
[Description of the bug or feature]
15+
16+
### Steps to Reproduce
17+
18+
1. [First Step]
19+
2. [Second Step]
20+
3. [and so on...]
21+
22+
**Expected behavior:** [What you expected to happen]
23+
24+
**Actual behavior:** [What actually happened]
25+
26+
### Versions
27+
28+
You can get this information from executing `ipy -V`.

Build/steps.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ steps:
4343
msbuild /version
4444
dotnet --info
4545
df -Th
46+
47+
# Dump version info on macOS
48+
- ${{ if eq(parameters.os, 'macOS') }}:
49+
- task: ms-devlabs.utilitytasks.task-Shellpp.Shell++@0
50+
displayName: Version Information
51+
inputs:
52+
type: InlineScript
53+
script: |
54+
# Dump some info about the tools
55+
mono --version
56+
msbuild /version
57+
dotnet --info
4658
4759
- powershell: ./make.ps1
4860
displayName: Build

NuGet.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<add key="globalPackagesFolder" value="./packages" />
55
</config>
66
<packageSources>
7-
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
7+
<add key="nuget.org" value="https://api.nuget.org/api/v3/index.json" />
8+
<add key="nunit.myget.org" value="https://www.myget.org/F/nunit/api/v3/index.json" />
89
</packageSources>
910
</configuration>

Src/IronPython.Modules/pyexpat.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ private void parse(CodeContext context, TextReader textReader) {
338338
case XmlNodeType.Text:
339339
BufferText(xmlReader.Value);
340340
break;
341+
case XmlNodeType.SignificantWhitespace:
342+
case XmlNodeType.Whitespace:
343+
if (xmlReader.Depth > 0)
344+
BufferText(xmlReader.Value);
345+
break;
341346
case XmlNodeType.ProcessingInstruction:
342347
handleProcessingInstruction();
343348
break;
@@ -386,14 +391,15 @@ private void handleElement() {
386391
}
387392

388393
while (xmlReader.MoveToNextAttribute()) {
389-
if (xmlReader.Prefix == "xmlns") {
390-
var prefix = xmlReader.LocalName;
394+
if (namespace_separator != null
395+
&& (xmlReader.Prefix == "xmlns" || xmlReader.Prefix == string.Empty && xmlReader.LocalName == "xmlns")) {
396+
var prefix = xmlReader.Prefix == string.Empty ? string.Empty : xmlReader.LocalName;
391397
var uri = xmlReader.Value;
392398
ns_stack.Push(prefix);
393399
var startNamespaceDeclHandler = StartNamespaceDeclHandler;
394400
if (startNamespaceDeclHandler != null) {
395401
FlushBuffer();
396-
startNamespaceDeclHandler(prefix, uri);
402+
startNamespaceDeclHandler(prefix == string.Empty ? null : prefix, uri);
397403
}
398404
continue;
399405
}
@@ -434,7 +440,7 @@ private void handleEndElement() {
434440
var endNamespaceDeclHandler = EndNamespaceDeclHandler;
435441
if (endNamespaceDeclHandler != null) {
436442
FlushBuffer();
437-
endNamespaceDeclHandler(prefix);
443+
endNamespaceDeclHandler(prefix == string.Empty ? null : prefix);
438444
}
439445
}
440446
}

Src/IronPython/Lib/iptest/ipunittest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ def _find_root():
133133
root = os.getcwd()
134134
test = all([os.path.exists(os.path.join(root, x)) for x in test_dirs])
135135
while not test:
136+
last_root = root
136137
root = os.path.dirname(root)
138+
if root == last_root: raise Exception("Root not found")
137139
test = all([os.path.exists(os.path.join(root, x)) for x in test_dirs])
138140
return root
139141

Src/IronPython/Modules/_bytesio.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,30 @@ public BigInteger seek(int pos, int whence=0) {
278278
public BigInteger seek(double pos, int whence=0) {
279279
throw PythonOps.TypeError("'float' object cannot be interpreted as an index");
280280
}
281+
282+
public BigInteger seek(int pos, BigInteger whence) => seek(pos, (int)whence);
283+
public BigInteger seek(int pos, double whence) => throw PythonOps.TypeError("integer argument expected, got float");
284+
public BigInteger seek(double pos, [DefaultParameterValue(0)]object whence) => throw PythonOps.TypeError("'float' object cannot be interpreted as an index");
281285

282286
public override BigInteger seek(CodeContext/*!*/ context, BigInteger pos, [DefaultParameterValue(0)]object whence) {
283287
_checkClosed();
284288

285289
int posInt = (int)pos;
286-
if (whence is double || whence is Extensible<double>) {
287-
throw PythonOps.TypeError("integer argument expected, got float");
290+
switch (whence) {
291+
case int v:
292+
return seek(posInt, v);
293+
case Extensible<int> v:
294+
return seek(posInt, v);
295+
case BigInteger v:
296+
return seek(posInt, v);
297+
case Extensible<BigInteger> v:
298+
return seek(posInt, v);
299+
case double _:
300+
case Extensible<double> _:
301+
throw PythonOps.TypeError("integer argument expected, got float");
302+
default:
303+
return seek(posInt, GetInt(whence));
288304
}
289-
290-
return seek(posInt, GetInt(whence));
291305
}
292306

293307
public override bool seekable(CodeContext/*!*/ context) {

Src/IronPython/Runtime/Binding/MetaPythonType.Calls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ partial class MetaPythonType : MetaPythonObject, IPythonInvokable {
9494
private DynamicMetaObject/*!*/ MakeStandardDotNetTypeCall(DynamicMetaObjectBinder/*!*/ call, Expression/*!*/ codeContext, DynamicMetaObject/*!*/[]/*!*/ args) {
9595
CallSignature signature = BindingHelpers.GetCallSignature(call);
9696
PythonContext state = PythonContext.GetPythonContext(call);
97-
MethodBase[] ctors = CompilerHelpers.GetConstructors(Value.UnderlyingSystemType, state.Binder.PrivateBinding);
97+
MethodBase[] ctors = PythonTypeOps.GetConstructors(Value.UnderlyingSystemType, state.Binder.PrivateBinding);
9898

9999
if (ctors.Length > 0) {
100100
return state.Binder.CallMethod(

Src/IronPython/Runtime/Binding/PythonBinder.Create.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public DynamicMetaObject Create(CallSignature signature, DynamicMetaObject targe
4545
signature,
4646
contextExpression
4747
),
48-
CompilerHelpers.GetConstructors(t, PrivateBinding),
48+
PythonTypeOps.GetConstructors(t, PrivateBinding),
4949
target.Restrictions.Merge(BindingRestrictions.GetInstanceRestriction(target.Expression, target.Value))
5050
);
5151
}

Src/IronPython/Runtime/Binding/PythonBinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ private static DynamicMetaObject ReturnMemberTracker(Type type, MemberTracker me
463463
case TrackerTypes.MethodGroup:
464464
return new DynamicMetaObject(ReturnMethodGroup((MethodGroup)memberTracker), BindingRestrictions.Empty); ;
465465
case TrackerTypes.Constructor:
466-
MethodBase[] ctors = CompilerHelpers.GetConstructors(type, privateBinding, true);
466+
MethodBase[] ctors = PythonTypeOps.GetConstructors(type, privateBinding, true);
467467
object val;
468468
if (PythonTypeOps.IsDefaultNew(ctors)) {
469469
if (IsPythonType(type)) {

Src/IronPython/Runtime/Exceptions/SystemExitException.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ public int GetExitCode(out object otherCode) {
5151
return 0;
5252
} else if (Builtin.isinstance(t[0], TypeCache.Int32)) {
5353
return Converter.ConvertToInt32(t[0]);
54+
} else if (Builtin.isinstance(t[0], TypeCache.BigInteger)) {
55+
var b = Converter.ConvertToBigInteger(t[0]);
56+
if(b > int.MaxValue) {
57+
return -1;
58+
}
59+
return (int)b;
5460
}
5561

5662
otherCode = t[0];

0 commit comments

Comments
 (0)