Add Python 3.8 language level (PY-33884)

Additionally, I did the following:

* re-generated lists of supported/unsupported interpreter modules
* updated test data wherever Python versions appear in warnings

Still need to figure out, though, why _bz2/bz2 modules were not found
for some old versions of Python, hence information about their presense
should be updated by hand in versions.xml.
This commit is contained in:
Semyon Proshev
2019-03-19 13:38:12 +03:00
parent 38f4026184
commit 8966e016d5
28 changed files with 577 additions and 49 deletions
File diff suppressed because it is too large Load Diff
@@ -76,7 +76,8 @@ public enum LanguageLevel {
PYTHON34(34, true, false, true, true),
PYTHON35(35, true, false, true, true),
PYTHON36(36, true, false, true, true),
PYTHON37(37, true, false, true, true);
PYTHON37(37, true, false, true, true),
PYTHON38(38, true, false, true, true);
/**
* This value is mostly bound to the compatibility of our debugger and helpers.
@@ -191,6 +192,9 @@ public enum LanguageLevel {
if (pythonVersion.startsWith("3.7")) {
return PYTHON37;
}
if (pythonVersion.startsWith("3.8")) {
return PYTHON38;
}
return DEFAULT3;
}
return getDefault();
@@ -39,7 +39,7 @@ import java.io.File
*/
object PyTypeShed {
private const val ONLY_SUPPORTED_PY2_MINOR = 7
private val SUPPORTED_PY3_MINORS = 2..7
private val SUPPORTED_PY3_MINORS = 2..8
/**
* Returns true if we allow to search typeshed for a stub for [name].
@@ -74,7 +74,7 @@ class PyAddNewCondaEnvPanel(private val project: Project?,
layout = BorderLayout()
// https://conda.io/docs/user-guide/install/index.html#system-requirements
val supportedLanguageLevels = LanguageLevel.SUPPORTED_LEVELS.asReversed().map { it.toString() }
val supportedLanguageLevels = LanguageLevel.SUPPORTED_LEVELS.asReversed().filter { it != LanguageLevel.PYTHON38 }.map { it.toString() }
languageLevelsField = JComboBox(supportedLanguageLevels.toTypedArray()).apply {
selectedItem = if (itemCount > 0) getItemAt(0) else null
@@ -1,4 +1,4 @@
print(<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support <>, use != instead.">a <> b</warning>)
print(<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support <>, use != instead.">a <> b</warning>)
if <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support <>, use != instead.">a <> 2</warning>:
if <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support <>, use != instead.">a <> 2</warning>:
var = a
@@ -1 +1 @@
<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not have type long. Use int instead.">long("abc")</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not have type long. Use int instead.">long("abc")</warning>
@@ -2,7 +2,7 @@ class A(B):
def __init__(self):
<warning descr="Python version 2.6, 2.7 do not support this syntax. super() should have arguments in Python 2">super()</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not have method cmp">cmp()</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not have method reduce">reduce()</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not have method cmp">cmp()</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not have method reduce">reduce()</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not have method buffer">buffer()</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not have method buffer">buffer()</warning>
@@ -1,4 +1,4 @@
try:
do_smth()
<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support this syntax.">except ImportError, ImportWarning:
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support this syntax.">except ImportError, ImportWarning:
do()</warning>
@@ -1 +1 @@
from <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not have module Bastion">Bastion</warning> import BastionClass
from <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not have module Bastion">Bastion</warning> import BastionClass
@@ -1,4 +1,4 @@
import <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not have module Bastion">Bastion</warning>
import <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not have module Bastion">Bastion</warning>
from <warning descr="Python version 2.6, 2.7 do not have module asyncio">asyncio</warning> import Queue
from io import StringIO
@@ -1,3 +1,3 @@
<error descr="Python version 2.7 does not have module builtins"><warning descr="Python version 2.6 does not have module builtins">import builtins</warning></error>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not have module __builtin__">import __builtin__</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not have module __builtin__">import __builtin__</warning>
@@ -1 +1 @@
var = [x for x in <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support this syntax in list comprehensions.">1, 2, 3</warning>]
var = [x for x in <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support this syntax in list comprehensions.">1, 2, 3</warning>]
@@ -1,2 +1,2 @@
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support a trailing 'l' or 'L'.">12l</warning>
v = <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support this syntax. It requires '0o' prefix for octal literals">04</warning><error descr="End of statement expected">8</error>
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support a trailing 'l' or 'L'.">12l</warning>
v = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support this syntax. It requires '0o' prefix for octal literals">04</warning><error descr="End of statement expected">8</error>
@@ -1 +1 @@
<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support this syntax. The print statement has been replaced with a print() function">print "One value"</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support this syntax. The print statement has been replaced with a print() function">print "One value"</warning>
@@ -1,4 +1,4 @@
try:
a
except :
<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support this syntax.">raise ImportError, ImportWarning</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support this syntax.">raise ImportError, ImportWarning</warning>
@@ -1 +1 @@
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support backquotes, use repr() instead">`imp.acquire_lock()`</warning>
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support backquotes, use repr() instead">`imp.acquire_lock()`</warning>
@@ -6,11 +6,11 @@ a = <error descr="Python version 2.7 does not support a 'F' prefix"><warning des
a = <error descr="Python version 2.7 does not support a 'F' prefix"><warning descr="Python version 2.6, 3.4, 3.5 do not support a 'F' prefix">F</warning></error>""
a = <error descr="Python version 2.7 does not support a 'RF' prefix"><warning descr="Python version 2.6, 3.4, 3.5 do not support a 'RF' prefix">rf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FR' prefix"><warning descr="Python version 2.6, 3.4, 3.5 do not support a 'FR' prefix">fr</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FU' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7 do not support a 'FU' prefix">fu</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UF' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7 do not support a 'UF' prefix">uf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'BF' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7 do not support a 'BF' prefix">bf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FB' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7 do not support a 'FB' prefix">fb</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UFR' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7 do not support a 'UFR' prefix">ufr</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FU' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8 do not support a 'FU' prefix">fu</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UF' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8 do not support a 'UF' prefix">uf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'BF' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8 do not support a 'BF' prefix">bf</warning></error>""
a = <error descr="Python version 2.7 does not support a 'FB' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8 do not support a 'FB' prefix">fb</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UFR' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8 do not support a 'UFR' prefix">ufr</warning></error>""
# python 3.3
@@ -35,7 +35,7 @@ a = b""
a = u""
a = r""
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support a 'UR' prefix">ur</warning>""
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support a 'UR' prefix">ur</warning>""
a = b""
a = br""
@@ -43,14 +43,14 @@ a = br""
a = u""
a = r""
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support a 'UR' prefix">ur</warning>""
a = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support a 'UR' prefix">ur</warning>""
# combined, PY-32321
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not allow to mix bytes and non-bytes literals">u"" b""</warning>
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not allow to mix bytes and non-bytes literals">r"" b""</warning>
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not allow to mix bytes and non-bytes literals"><error descr="Python version 2.7 does not support a 'F' prefix"><warning descr="Python version 2.6, 3.4, 3.5 do not support a 'F' prefix">f</warning></error>"" b""</warning>
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not allow to mix bytes and non-bytes literals">u"" b""</warning>
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not allow to mix bytes and non-bytes literals">r"" b""</warning>
b = <warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not allow to mix bytes and non-bytes literals"><error descr="Python version 2.7 does not support a 'F' prefix"><warning descr="Python version 2.6, 3.4, 3.5 do not support a 'F' prefix">f</warning></error>"" b""</warning>
# never was available
a = <error descr="Python version 2.7 does not support a 'RR' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7 do not support a 'RR' prefix">rr</warning></error>""
a = <error descr="Python version 2.7 does not support a 'BB' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7 do not support a 'BB' prefix">bb</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UU' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7 do not support a 'UU' prefix">uu</warning></error>""
a = <error descr="Python version 2.7 does not support a 'RR' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8 do not support a 'RR' prefix">rr</warning></error>""
a = <error descr="Python version 2.7 does not support a 'BB' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8 do not support a 'BB' prefix">bb</warning></error>""
a = <error descr="Python version 2.7 does not support a 'UU' prefix"><warning descr="Python version 2.6, 3.4, 3.5, 3.6, 3.7, 3.8 do not support a 'UU' prefix">uu</warning></error>""
@@ -3,7 +3,7 @@
# oct
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0o1_23</warning>
<error descr="Python version 3.6 does not support this syntax. It requires '0o' prefix for octal literals"><warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals"><warning descr="Python version 3.4, 3.5, 3.7 do not support this syntax. It requires '0o' prefix for octal literals">01_23</warning></warning></error>
<error descr="Python version 3.6 does not support this syntax. It requires '0o' prefix for octal literals"><warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals"><warning descr="Python version 3.4, 3.5, 3.7, 3.8 do not support this syntax. It requires '0o' prefix for octal literals">01_23</warning></warning></error>
# bin
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0b_0011_1111_0100_1110</warning>
@@ -1,14 +1,14 @@
class <warning descr="Python version 3.7 does not allow 'async' and 'await' as names">async</warning>(object):
class <warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">async</warning>(object):
pass
class <warning descr="Python version 3.7 does not allow 'async' and 'await' as names">await</warning>(object):
class <warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">await</warning>(object):
pass
def <warning descr="Python version 3.7 does not allow 'async' and 'await' as names">async</warning>():
def <warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">async</warning>():
pass
def <warning descr="Python version 3.7 does not allow 'async' and 'await' as names">await</warning>():
def <warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">await</warning>():
pass
<warning descr="Python version 3.7 does not allow 'async' and 'await' as names">async</warning> = 1
<warning descr="Python version 3.7 does not allow 'async' and 'await' as names">await</warning> = 2
<warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">async</warning> = 1
<warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">await</warning> = 2
@@ -1 +1 @@
print(<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support <>, use != instead.">a<caret> <> b</warning>)
print(<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support <>, use != instead.">a<caret> <> b</warning>)
+1 -1
View File
@@ -1 +1 @@
<warning descr="Python version 3.4, 3.5, 3.6, 3.7 do not support this syntax. The print statement has been replaced with a print() function">print "foo"</warning>
<warning descr="Python version 3.4, 3.5, 3.6, 3.7, 3.8 do not support this syntax. The print statement has been replaced with a print() function">print "foo"</warning>
@@ -1,2 +1,2 @@
class <warning descr="Python version 3.7 does not allow 'async' and 'await' as names">a<caret>sync</warning>(object):
class <warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">a<caret>sync</warning>(object):
pass
@@ -1,2 +1,2 @@
def <warning descr="Python version 3.7 does not allow 'async' and 'await' as names">a<caret>sync</warning>():
def <warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">a<caret>sync</warning>():
pass
@@ -1 +1 @@
<warning descr="Python version 3.7 does not allow 'async' and 'await' as names">async</warning> = 1
<warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">async</warning> = 1
@@ -1,2 +1,2 @@
class <warning descr="Python version 3.7 does not allow 'async' and 'await' as names">a<caret>wait</warning>(object):
class <warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">a<caret>wait</warning>(object):
pass
@@ -1,2 +1,2 @@
def <warning descr="Python version 3.7 does not allow 'async' and 'await' as names">a<caret>wait</warning>():
def <warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">a<caret>wait</warning>():
pass
@@ -1 +1 @@
<warning descr="Python version 3.7 does not allow 'async' and 'await' as names">await</warning> = 1
<warning descr="Python version 3.7, 3.8 do not allow 'async' and 'await' as names">await</warning> = 1
@@ -50,6 +50,6 @@ public class PyiParsingTest extends ParsingTestCase {
doTest();
assertInstanceOf(myFile, PyiFile.class);
final PyiFile pyiFile = (PyiFile)myFile;
assertEquals(LanguageLevel.PYTHON37, pyiFile.getLanguageLevel());
assertEquals(LanguageLevel.PYTHON38, pyiFile.getLanguageLevel());
}
}