|
37 | 37 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
38 | 38 | # SOFTWARE.
|
39 | 39 |
|
40 |
| -# __all__ = ['Struct', '_clearcache', 'calcsize', 'error', 'iter_unpack', 'pack', 'pack_into', 'unpack', 'unpack_from'] |
41 | 40 |
|
42 |
| - |
43 |
| -@__graalpython__.builtin |
44 |
| -def _clearcache(*args): |
45 |
| - import _cpython_struct |
46 |
| - return _cpython_struct.clearcache(*args) |
47 |
| - |
48 |
| - |
49 |
| -@__graalpython__.builtin |
50 |
| -def calcsize(fmt): |
51 |
| - import _cpython_struct |
52 |
| - return _cpython_struct.calcsize(fmt) |
53 |
| - |
54 |
| - |
55 |
| -@__graalpython__.builtin |
56 |
| -def iter_unpack(fmt, buffer): |
57 |
| - import _cpython_struct |
58 |
| - return _cpython_struct.calcsize(fmt, buffer) |
59 |
| - |
60 |
| - |
61 |
| -@__graalpython__.builtin |
62 |
| -def pack(fmt, *vals): |
63 |
| - import _cpython_struct |
64 |
| - return _cpython_struct.pack(fmt, *vals) |
65 |
| - |
66 |
| - |
67 |
| -@__graalpython__.builtin |
68 |
| -def pack_into(fmt, buffer, offset, *vals): |
69 |
| - import _cpython_struct |
70 |
| - return _cpython_struct.pack_into(fmt, buffer, offset, *vals) |
71 |
| - |
72 |
| - |
73 |
| -@__graalpython__.builtin |
74 |
| -def unpack(fmt, *vals): |
75 |
| - import _cpython_struct |
76 |
| - return _cpython_struct.unpack(fmt, *vals) |
77 |
| - |
78 |
| - |
79 |
| -@__graalpython__.builtin |
80 |
| -def unpack_from(fmt, buffer, offset=0): |
81 |
| - import _cpython_struct |
82 |
| - return _cpython_struct.unpack_from(fmt, buffer, offset=offset) |
83 |
| - |
84 |
| - |
85 |
| -# error and Struct |
86 |
| -def __getattr__(name): |
87 |
| - if name in ['error', 'Struct']: |
88 |
| - import _cpython_struct |
89 |
| - return __getattr__(_cpython_struct, name) |
90 |
| - raise AttributeError("module {} has no attribute {}".format(__name__, name)) |
91 |
| - |
92 |
| - |
93 |
| -__graalpython__.import_current_as_named_module("_struct") |
| 41 | +__graalpython__.lazy_attribute_loading_from_module( |
| 42 | + ['Struct', '_clearcache', 'calcsize', 'error', 'iter_unpack', 'pack', 'pack_into', 'unpack', 'unpack_from'], |
| 43 | + '_cpython_struct', globals()) |
| 44 | +__graalpython__.import_current_as_named_module("_struct", globals()) |
0 commit comments