Skip to content

Commit 46b2e4d

Browse files
committed
Fix copyright regexes to capture current year(s)
1 parent e2e840f commit 46b2e4d

File tree

13 files changed

+33
-37
lines changed

13 files changed

+33
-37
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_yield_from.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def g2():
372372
return [42]
373373
self.assertEqual(list(g1()), ["g2"])
374374

375-
375+
@unittest.skipIf(sys.version_info.minor < 7, "Requires Python 3.7+")
376376
def test_generator_return_value(self):
377377
"""
378378
Test generator return value
@@ -419,7 +419,7 @@ def g2(v = None):
419419
"Yielded g2 spam",
420420
"Yielded g2 more spam",
421421
"Finishing g2",
422-
"g2 returned StopIteration(3,)",
422+
"g2 returned StopIteration(3)",
423423
"Yielded g1 eggs",
424424
"Finishing g1",
425425
])
@@ -666,6 +666,7 @@ class LunchError(Exception):
666666
"Finishing g1",
667667
])
668668

669+
@unittest.skipIf(sys.version_info.minor < 7, "Requires Python 3.7+")
669670
def test_next_and_return_with_value(self):
670671
"""
671672
Test next and return with value
@@ -697,17 +698,18 @@ def g(r):
697698
"g starting",
698699
"f resuming g",
699700
"g returning 1",
700-
"f caught StopIteration(1,)",
701+
"f caught StopIteration(1)",
701702
"g starting",
702703
"f resuming g",
703704
"g returning (2,)",
704-
"f caught StopIteration((2,),)",
705+
"f caught StopIteration((2,))",
705706
"g starting",
706707
"f resuming g",
707-
"g returning StopIteration(3,)",
708-
"f caught StopIteration(StopIteration(3,),)",
708+
"g returning StopIteration(3)",
709+
"f caught StopIteration(StopIteration(3))",
709710
])
710711

712+
@unittest.skipIf(sys.version_info.minor < 7, "Requires Python 3.7+")
711713
def test_send_and_return_with_value(self):
712714
"""
713715
Test send and return with value
@@ -742,17 +744,17 @@ def g(r):
742744
"f sending spam to g",
743745
"g received 'spam'",
744746
"g returning 1",
745-
'f caught StopIteration(1,)',
747+
'f caught StopIteration(1)',
746748
'g starting',
747749
'f sending spam to g',
748750
"g received 'spam'",
749751
'g returning (2,)',
750-
'f caught StopIteration((2,),)',
752+
'f caught StopIteration((2,))',
751753
'g starting',
752754
'f sending spam to g',
753755
"g received 'spam'",
754-
'g returning StopIteration(3,)',
755-
'f caught StopIteration(StopIteration(3,),)'
756+
'g returning StopIteration(3)',
757+
'f caught StopIteration(StopIteration(3))'
756758
])
757759

758760
# def test_catching_exception_from_subgen_and_returning(self):

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/exception/BaseExceptionBuiltins.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import static com.oracle.graal.python.nodes.SpecialAttributeNames.__CONTEXT__;
3030
import static com.oracle.graal.python.nodes.SpecialAttributeNames.__TRACEBACK__;
3131
import static com.oracle.graal.python.nodes.SpecialMethodNames.__INIT__;
32-
import static com.oracle.graal.python.nodes.SpecialMethodNames.__REPR__;
3332

3433
import java.util.IllegalFormatException;
3534
import java.util.List;
@@ -48,7 +47,6 @@
4847
import com.oracle.graal.python.nodes.function.PythonBuiltinBaseNode;
4948
import com.oracle.graal.python.nodes.function.PythonBuiltinNode;
5049
import com.oracle.graal.python.nodes.function.builtins.PythonBinaryBuiltinNode;
51-
import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
5250
import com.oracle.graal.python.nodes.object.GetLazyClassNode;
5351
import com.oracle.graal.python.runtime.exception.PythonErrorType;
5452
import com.oracle.graal.python.runtime.formatting.ErrorMessageFormatter;
@@ -80,17 +78,6 @@ Object init(PBaseException self, Object[] args) {
8078
}
8179
}
8280

83-
@Builtin(name = __REPR__, minNumOfPositionalArgs = 1)
84-
@GenerateNodeFactory
85-
public abstract static class ReprNode extends PythonUnaryBuiltinNode {
86-
@Specialization
87-
@TruffleBoundary
88-
public Object repr(PBaseException self,
89-
@Cached("create()") GetLazyClassNode getClassNode) {
90-
return self.getFormattedMessage(getClassNode);
91-
}
92-
}
93-
9481
@Builtin(name = "args", minNumOfPositionalArgs = 1, maxNumOfPositionalArgs = 2, isGetter = true, isSetter = true)
9582
@GenerateNodeFactory
9683
public abstract static class ArgsNode extends PythonBuiltinNode {

graalpython/lib-graalpython/base_exception.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@
3737
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3838
# SOFTWARE.
3939

40+
41+
def __repr__(self):
42+
if self.args:
43+
if len(self.args) == 1:
44+
return "%s(%r)" % (type(self).__name__, self.args[0])
45+
return "%s%r" % (type(self).__name__, self.args)
46+
return "%s()" % type(self).__name__
47+
48+
49+
BaseException.__repr__ = __repr__
50+
51+
4052
def __str__(self):
4153
if self.args:
4254
if len(self.args) == 1:

graalpython/lib-graalpython/exceptions.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,7 @@ def StopIteration__value__set(self, arg):
9696
self.__value__ = arg
9797

9898

99-
def StopIteration__repr__(self):
100-
return "StopIteration%s" % repr(self.args)
101-
102-
10399
StopIteration.value = property(fget=StopIteration__value__get, fset=StopIteration__value__set)
104-
StopIteration.__repr__ = StopIteration__repr__
105100

106101
# These errors are just an alias of OSError (i.e. 'EnvironmentError is OSError == True')
107102
EnvironmentError = OSError

mx.graalpython/copyrights/benchmarks.copyright.hash.regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(?:#!/usr/bin/env python\n)?(?:# coding=.*)?# Copyright 2008-2010 Isaac Gouy
22
# Copyright \(c\) (?:20[0-9][0-9], )*201[0-9], Regents of the University of California
3-
# Copyright \(c\) (?:20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
3+
# Copyright \(c\) (20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
44
# All rights reserved.
55
#
66
# Revised BSD license

mx.graalpython/copyrights/jython.copyright.star.regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/\*
2-
\* Copyright \(c\) (?:20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
2+
\* Copyright \(c\) (20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
33
\* Copyright \(c\) -?2016 Jython Developers
44
\*
55
\* Licensed under PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2

mx.graalpython/copyrights/oracle.copyright.regex.hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright \(c\) (?:20[0-9][0-9], )*(20[0-9][0-9]), Oracle and\/or its affiliates\. All rights reserved\.\s*
1+
# Copyright \(c\) (20[0-9][0-9], )*(20[0-9][0-9]), Oracle and\/or its affiliates\. All rights reserved\.\s*
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER\.\s*
33
#\s*
44
# The Universal Permissive License \(UPL\), Version 1\.0\s*

mx.graalpython/copyrights/pypy-image-demo.copyright.hash.regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright \(c\) (?:20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
1+
# Copyright \(c\) (20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
22
# Copyright \(c\) 2013, Pablo Mouzo
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy

mx.graalpython/copyrights/pypy.copyright.hash.regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(?:# coding=utf-8\n)?# Copyright \(c\) (?:20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
1+
(?:# coding=utf-8\n)?# Copyright \(c\) (20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
22
# Copyright \(c\) 2017, The PyPy Project
33
#
44
# The MIT License

mx.graalpython/copyrights/python.copyright.hash.regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright \(c\) (?:20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
1+
# Copyright \(c\) (20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
22
# Copyright \(C\) 1996-2017 Python Software Foundation
33
#
44
# Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2

mx.graalpython/copyrights/python.copyright.star.regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/\* Copyright \(c\) (?:20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
1+
/\* Copyright \(c\) (20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
22
\* Copyright \(C\) 1996-2017 Python Software Foundation
33
\*
44
\* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2

mx.graalpython/copyrights/zippy.copyright.hash.regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright \(c\) (?:20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
1+
# Copyright \(c\) (20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
22
# Copyright \(c\) (?:20[0-9][0-9], )*201[0-9], Regents of the University of California
33
#
44
# All rights reserved.

mx.graalpython/copyrights/zippy.copyright.star.regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/\*
2-
\* Copyright \(c\) (?:20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
2+
\* Copyright \(c\) (20[0-9][0-9], )*(20[0-9][0-9]), Oracle and/or its affiliates.
33
\* Copyright \(c\) 20[0-9][0-9], Regents of the University of California
44
\*
55
\* All rights reserved.

0 commit comments

Comments
 (0)