Skip to content

Commit d7590a8

Browse files
committed
move our impl specific functions and attrs to __graalpython__ module
1 parent bc81764 commit d7590a8

File tree

32 files changed

+586
-544
lines changed

32 files changed

+586
-544
lines changed

graalpython/com.oracle.graal.python.cext/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0
@@ -53,7 +53,7 @@
5353
libpython_name = "libpython"
5454

5555
verbosity = '--verbose' if sys.flags.verbose else '--quiet'
56-
darwin_native = sys.platform == "darwin" and sys.graal_python_platform_id == "native"
56+
darwin_native = sys.platform == "darwin" and __graalpython__.platform_id == "native"
5757
relative_rpath = "@loader_path" if darwin_native else "\$ORIGIN"
5858
so_ext = get_config_var("EXT_SUFFIX")
5959
SOABI = get_config_var("SOABI")

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def test_java_imports():
339339
from java.util import ArrayList
340340
assert repr(ArrayList()) == "[]"
341341

342-
if sys.graal_python_jython_emulation_enabled:
342+
if __graalpython__.jython_emulation_enabled:
343343
assert java.util.ArrayList == ArrayList
344344

345345
import sun
@@ -349,7 +349,7 @@ def test_java_imports():
349349
assert sun.misc.Signal is not None
350350

351351
def test_java_import_from_jar():
352-
if sys.graal_python_jython_emulation_enabled:
352+
if __graalpython__.jython_emulation_enabled:
353353
import tempfile
354354
import zipfile
355355

@@ -403,7 +403,7 @@ def test_java_import_from_jar():
403403

404404

405405
def test_java_exceptions():
406-
if sys.graal_python_jython_emulation_enabled:
406+
if __graalpython__.jython_emulation_enabled:
407407
from java.lang import Integer, NumberFormatException
408408
try:
409409
Integer.parseInt("99", 8)
@@ -444,7 +444,7 @@ def test_foreign_object_does_not_leak_Javas_toString():
444444
assert "@" not in str(e) # the @ from Java's default toString
445445

446446
def test_java_import_star():
447-
if sys.graal_python_jython_emulation_enabled:
447+
if __graalpython__.jython_emulation_enabled:
448448
d = {}
449449
exec("from java.util.logging.Logger import *", globals=d, locals=d)
450450
assert "getGlobal" in d
@@ -456,7 +456,7 @@ def test_java_null_is_none():
456456
y = Integer.getInteger("something_what_does_not_exists2")
457457
z = None
458458

459-
if sys.graal_python_jython_emulation_enabled:
459+
if __graalpython__.jython_emulation_enabled:
460460

461461
assert x == None
462462
assert (x != None) == False
@@ -491,13 +491,13 @@ def test_java_null_is_none():
491491
assert x is not z
492492

493493
def test_isinstance01():
494-
if sys.graal_python_jython_emulation_enabled:
494+
if __graalpython__.jython_emulation_enabled:
495495
import java.lang.Integer as Integer
496496
i = Integer(1)
497497
assert isinstance(i, Integer)
498498

499499
def test_isinstance02():
500-
if sys.graal_python_jython_emulation_enabled:
500+
if __graalpython__.jython_emulation_enabled:
501501
import java.util.Map as Map
502502
import java.util.HashMap as HashMap
503503
h = HashMap()

graalpython/com.oracle.graal.python.test/testData/testFiles/RuntimeFileTests/builtins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __import__(filename, module_name):
4848
import sys, posix
4949
module = sys.modules[module_name]
5050
if filename.startswith("%s"):
51-
filename = filename % sys.graal_python_core_home
51+
filename = filename % __graalpython__.core_home
5252
fd = posix.open(filename, posix.O_RDONLY)
5353
content = posix.read(fd, sys.maxsize)
5454
posix.close(fd)

graalpython/com.oracle.graal.python.test/testData/testFiles/RuntimeFileTests/functions.py

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

40-
@__builtin__
40+
@__graalpython__.builtin
4141
def hasattr(obj, key):
4242
default = object()
4343
return getattr(obj, key, default) is not default
4444

4545

46-
@__builtin__
46+
@__graalpython__.builtin
4747
def any(iterable):
4848
for i in iterable:
4949
if i:
5050
return True
5151
return False
5252

5353

54-
@__builtin__
54+
@__graalpython__.builtin
5555
def all(iterable):
5656
for i in iterable:
5757
if not i:
5858
return False
5959
return True
6060

6161

62-
@__builtin__
62+
@__graalpython__.builtin
6363
def filter(func, iterable):
6464
result = []
6565
predicate = func if func is not None else lambda a: a
@@ -111,7 +111,7 @@ def __contains__(self, x):
111111
from sys import _getframe as __getframe__
112112

113113

114-
@__builtin__
114+
@__graalpython__.builtin
115115
def vars(*obj):
116116
"""Return a dictionary of all the attributes currently bound in obj. If
117117
called with no argument, return the variables bound in local scope."""
@@ -126,7 +126,7 @@ def vars(*obj):
126126
raise TypeError("vars() argument must have __dict__ attribute")
127127

128128

129-
@__builtin__
129+
@__graalpython__.builtin
130130
def format(value, format_spec=''):
131131
"""Return value.__format__(format_spec)
132132
@@ -136,7 +136,7 @@ def format(value, format_spec=''):
136136
return type(value).__format__(value, format_spec)
137137

138138

139-
@__builtin__
139+
@__graalpython__.builtin
140140
def sorted(iterable, key=None, reverse=False):
141141
"""Return a new list containing all items from the iterable in ascending order.
142142

graalpython/com.oracle.graal.python.test/testData/testFiles/RuntimeFileTests/sys.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def make_hash_info_class():
135135
ps2 = "... "
136136

137137

138-
@__builtin__
138+
@__graalpython__.builtin
139139
def exit(arg=0):
140140
raise SystemExit(arg)
141141

@@ -175,7 +175,7 @@ def __print_traceback__(typ, value, tb):
175175
del make_excepthook
176176

177177

178-
@__builtin__
178+
@__graalpython__.builtin
179179
def breakpointhook(*args, **kws):
180180
import importlib, os, warnings
181181
hookname = os.getenv('PYTHONBREAKPOINT')
@@ -201,12 +201,12 @@ def breakpointhook(*args, **kws):
201201
__breakpointhook__ = breakpointhook
202202

203203

204-
@__builtin__
204+
@__graalpython__.builtin
205205
def getrecursionlimit():
206206
return 1000
207207

208208

209-
@__builtin__
209+
@__graalpython__.builtin
210210
def displayhook(value):
211211
if value is None:
212212
return

0 commit comments

Comments
 (0)