Skip to content

Commit 7a4d757

Browse files
committed
Reduce diff with imported CPython files
1 parent bad6005 commit 7a4d757

29 files changed

+73
-167
lines changed

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_call.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,3 @@
6262
*graalpython.lib-python.3.test.test_call.FastCallTests.test_vectorcall
6363
*graalpython.lib-python.3.test.test_call.FastCallTests.test_vectorcall_dict
6464
*graalpython.lib-python.3.test.test_call.FunctionCalls.test_kwargs_order
65-
*graalpython.lib-python.3.test.test_call.TestPEP590.test_method_descriptor_flag
66-
*graalpython.lib-python.3.test.test_call.TestPEP590.test_vectorcall
67-
*graalpython.lib-python.3.test.test_call.TestPEP590.test_vectorcall_flag
68-
*graalpython.lib-python.3.test.test_call.TestPEP590.test_vectorcall_override

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_importlib.txt

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,8 @@
629629
*test.test_importlib.test_abc.Frozen_InspectLoader.test_subclasses
630630
*test.test_importlib.test_abc.Frozen_InspectLoader.test_superclasses
631631
*test.test_importlib.test_abc.Frozen_InspectLoaderDefaultsTests.test_get_source
632+
*test.test_importlib.test_abc.Frozen_InspectLoaderDefaultsTests.test_get_source
633+
*test.test_importlib.test_abc.Frozen_InspectLoaderDefaultsTests.test_is_package
632634
*test.test_importlib.test_abc.Frozen_InspectLoaderDefaultsTests.test_is_package
633635
*test.test_importlib.test_abc.Frozen_InspectLoaderGetCodeTests.test_get_code
634636
*test.test_importlib.test_abc.Frozen_InspectLoaderGetCodeTests.test_get_code_source_is_None
@@ -695,6 +697,8 @@
695697
*test.test_importlib.test_abc.Source_InspectLoader.test_subclasses
696698
*test.test_importlib.test_abc.Source_InspectLoader.test_superclasses
697699
*test.test_importlib.test_abc.Source_InspectLoaderDefaultsTests.test_get_source
700+
*test.test_importlib.test_abc.Source_InspectLoaderDefaultsTests.test_get_source
701+
*test.test_importlib.test_abc.Source_InspectLoaderDefaultsTests.test_is_package
698702
*test.test_importlib.test_abc.Source_InspectLoaderDefaultsTests.test_is_package
699703
*test.test_importlib.test_abc.Source_InspectLoaderGetCodeTests.test_get_code
700704
*test.test_importlib.test_abc.Source_InspectLoaderGetCodeTests.test_get_code_source_is_None
@@ -825,11 +829,32 @@
825829
*test.test_importlib.test_lazy.LazyLoaderTests.test_mutated_attr
826830
*test.test_importlib.test_lazy.LazyLoaderTests.test_mutated_preexisting_attr
827831
*test.test_importlib.test_lazy.LazyLoaderTests.test_new_attr
828-
*test.test_importlib.test_locks.Frozen_LifetimeTests.test_all_locks
829-
*test.test_importlib.test_locks.Frozen_LifetimeTests.test_lock_lifetime
832+
*test.test_importlib.test_locks.Frozen_DeadlockAvoidanceTests.test_deadlock
833+
*test.test_importlib.test_locks.Frozen_DeadlockAvoidanceTests.test_no_deadlock
834+
*test.test_importlib.test_locks.Frozen_ModuleLockAsRLockTests.test_acquire_contended
835+
*test.test_importlib.test_locks.Frozen_ModuleLockAsRLockTests.test_acquire_destroy
836+
*test.test_importlib.test_locks.Frozen_ModuleLockAsRLockTests.test_acquire_release
837+
*test.test_importlib.test_locks.Frozen_ModuleLockAsRLockTests.test_constructor
838+
*test.test_importlib.test_locks.Frozen_ModuleLockAsRLockTests.test_different_thread
839+
*test.test_importlib.test_locks.Frozen_ModuleLockAsRLockTests.test_reacquire
840+
*test.test_importlib.test_locks.Frozen_ModuleLockAsRLockTests.test_release_unacquired
841+
*test.test_importlib.test_locks.Frozen_ModuleLockAsRLockTests.test_thread_leak
842+
*test.test_importlib.test_locks.Frozen_ModuleLockAsRLockTests.test_weakref_deleted
843+
*test.test_importlib.test_locks.Frozen_ModuleLockAsRLockTests.test_weakref_exists
844+
*test.test_importlib.test_locks.Source_DeadlockAvoidanceTests.test_deadlock
845+
*test.test_importlib.test_locks.Source_DeadlockAvoidanceTests.test_no_deadlock
830846
*test.test_importlib.test_locks.Source_LifetimeTests.test_all_locks
831847
*test.test_importlib.test_locks.Source_LifetimeTests.test_lock_lifetime
832-
*test.test_importlib.test_locks.TestMain.test_main
848+
*test.test_importlib.test_locks.Source_ModuleLockAsRLockTests.test_acquire_contended
849+
*test.test_importlib.test_locks.Source_ModuleLockAsRLockTests.test_acquire_destroy
850+
*test.test_importlib.test_locks.Source_ModuleLockAsRLockTests.test_acquire_release
851+
*test.test_importlib.test_locks.Source_ModuleLockAsRLockTests.test_constructor
852+
*test.test_importlib.test_locks.Source_ModuleLockAsRLockTests.test_different_thread
853+
*test.test_importlib.test_locks.Source_ModuleLockAsRLockTests.test_reacquire
854+
*test.test_importlib.test_locks.Source_ModuleLockAsRLockTests.test_release_unacquired
855+
*test.test_importlib.test_locks.Source_ModuleLockAsRLockTests.test_thread_leak
856+
*test.test_importlib.test_locks.Source_ModuleLockAsRLockTests.test_weakref_deleted
857+
*test.test_importlib.test_locks.Source_ModuleLockAsRLockTests.test_weakref_exists
833858
*test.test_importlib.test_main.BasicTests.test_for_name_does_not_exist
834859
*test.test_importlib.test_main.BasicTests.test_new_style_classes
835860
*test.test_importlib.test_main.BasicTests.test_retrieves_version_of_self

graalpython/lib-python/3/importlib/_bootstrap_external.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,7 @@ def get_code(self, fullname):
884884
}
885885
try:
886886
flags = _classify_pyc(data, fullname, exc_details)
887-
# See issue GR-23189. Originally there is memoryview(data)[16:]
888-
bytes_data = data[16:]
887+
bytes_data = memoryview(data)[16:]
889888
hash_based = flags & 0b1 != 0
890889
if hash_based:
891890
check_source = flags & 0b10 != 0

graalpython/lib-python/3/site.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,12 @@ def _get_path(userbase):
267267
version = sys.version_info
268268

269269
if os.name == 'nt':
270-
return '%s\\Python%s%s\\site-packages' % (userbase, version[0], version[1])
270+
return f'{userbase}\\Python{version[0]}{version[1]}\\site-packages'
271271

272272
if sys.platform == 'darwin' and sys._framework:
273-
return '%s/lib/python/site-packages' % version
273+
return f'{userbase}/lib/python/site-packages'
274274

275-
return '%s/lib/python%s.%s/site-packages'% (userbase, version[0], version[1])
275+
return f'{userbase}/lib/python{version[0]}.{version[1]}/site-packages'
276276

277277

278278
def getuserbase():
@@ -567,7 +567,6 @@ def main():
567567
known_paths = venv(known_paths)
568568
if ENABLE_USER_SITE is None:
569569
ENABLE_USER_SITE = check_enableusersite()
570-
571570
known_paths = addusersitepackages(known_paths)
572571
known_paths = addsitepackages(known_paths)
573572
setquit()

graalpython/lib-python/3/sysconfig.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""Access to Python's configuration information."""
22

3-
import sys
4-
53
import os
4+
import sys
65
from os.path import pardir, realpath
76

87
__all__ = [

graalpython/lib-python/3/test/pickletester.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,6 @@ def test_truncated_data(self):
13721372
for p in badpickles:
13731373
self.check_unpickling_error(self.truncated_errors, p)
13741374

1375-
@support.impl_detail("GR-16579: support for multi-threading", graalvm=False)
13761375
@reap_threads
13771376
def test_unpickle_module_race(self):
13781377
# https://bugs.python.org/issue34572
@@ -3213,7 +3212,6 @@ def test_dumps_loads_oob_buffers(self):
32133212
def test_dump_load_oob_buffers(self):
32143213
# Test out-of-band buffers (PEP 574) with top-level dump() and load()
32153214
def dumps(obj, **kwargs):
3216-
# breakpoint()
32173215
f = io.BytesIO()
32183216
self.dump(obj, f, **kwargs)
32193217
return f.getvalue()

graalpython/lib-python/3/test/support/__init__.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,15 @@
5454
except ImportError:
5555
gzip = None
5656

57-
5857
try:
5958
import bz2
6059
except ImportError:
6160
bz2 = None
6261

63-
# TODO: Truffle reenable me once supported (GR-9149,GR-23309)
64-
# try:
65-
# import lzma
66-
# except ImportError:
67-
lzma = None
62+
try:
63+
import lzma
64+
except ImportError:
65+
lzma = None
6866

6967
try:
7068
import resource
@@ -2164,7 +2162,6 @@ def run_unittest(*classes):
21642162
def _check_docstrings():
21652163
"""Just used to check if docstrings are enabled"""
21662164

2167-
21682165
MISSING_C_DOCSTRINGS = (check_impl_detail() and
21692166
sys.platform != 'win32' and
21702167
not sysconfig.get_config_var('WITH_DOC_STRINGS'))

graalpython/lib-python/3/test/support/graalpython.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

graalpython/lib-python/3/test/test_buffer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
ndarray = None
3030

3131
try:
32-
# skipIfGraalPython(reason="not yet supported, causes SEGFAULT")
33-
# import struct
34-
struct = None
32+
import struct
3533
except ImportError:
3634
struct = None
3735

@@ -47,6 +45,7 @@
4745
except ImportError:
4846
numpy_array = None
4947

48+
5049
SHORT_TEST = True
5150

5251

graalpython/lib-python/3/test/test_call.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datetime
22
import unittest
3-
from test.support import cpython_only, impl_detail
3+
from test.support import cpython_only
44
try:
55
import _testcapi
66
except ImportError:
@@ -492,7 +492,6 @@ def testfunction_kw(self, *, kw):
492492

493493
class TestPEP590(unittest.TestCase):
494494

495-
@impl_detail("_testcapi missing", graalvm=False)
496495
def test_method_descriptor_flag(self):
497496
import functools
498497
cached = functools.lru_cache(1)(testfunction)
@@ -512,7 +511,6 @@ class MethodDescriptorHeap(_testcapi.MethodDescriptorBase):
512511
pass
513512
self.assertFalse(MethodDescriptorHeap.__flags__ & Py_TPFLAGS_METHOD_DESCRIPTOR)
514513

515-
@impl_detail("_testcapi missing", graalvm=False)
516514
def test_vectorcall_flag(self):
517515
self.assertTrue(_testcapi.MethodDescriptorBase.__flags__ & Py_TPFLAGS_HAVE_VECTORCALL)
518516
self.assertTrue(_testcapi.MethodDescriptorDerived.__flags__ & Py_TPFLAGS_HAVE_VECTORCALL)
@@ -524,7 +522,6 @@ class MethodDescriptorHeap(_testcapi.MethodDescriptorBase):
524522
pass
525523
self.assertFalse(MethodDescriptorHeap.__flags__ & Py_TPFLAGS_HAVE_VECTORCALL)
526524

527-
@impl_detail("_testcapi missing", graalvm=False)
528525
def test_vectorcall_override(self):
529526
# Check that tp_call can correctly override vectorcall.
530527
# MethodDescriptorNopGet implements tp_call but it inherits from
@@ -535,7 +532,6 @@ def test_vectorcall_override(self):
535532
f = _testcapi.MethodDescriptorNopGet()
536533
self.assertIs(f(*args), args)
537534

538-
@impl_detail("_testcapi missing", graalvm=False)
539535
def test_vectorcall(self):
540536
# Test a bunch of different ways to call objects:
541537
# 1. vectorcall using PyVectorcall_Call()

0 commit comments

Comments
 (0)