Skip to content

Commit c9a374c

Browse files
author
Christopher Doris
committed
add pybuiltins to the API
1 parent 8ee3479 commit c9a374c

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

src/API/exports.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
export Py
33
export ispy
44
export PyException
5+
export pybuiltins
56
export pyis
67
export pyrepr
78
export pyascii

src/API/types.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,13 @@ mutable struct PyException <: Exception
3838
_b::Py
3939
_isnormalized::Bool
4040
end
41+
42+
"""
43+
pybuiltins
44+
45+
An object whose fields are the Python builtins, of type [`Py`](@ref).
46+
47+
For example `pybuiltins.None`, `pybuiltins.int`, `pybuiltins.ValueError`.
48+
"""
49+
baremodule pybuiltins
50+
end

src/Core/Core.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ using Markdown: Markdown
3333
import ..PythonCall:
3434
Py,
3535
PyException,
36+
pybuiltins,
3637
pynew,
3738
pyisnull,
3839
pycopy!,

src/Core/consts.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,10 @@ const BUILTINS = Set([
168168
:ResourceWarning,
169169
])
170170

171-
@eval baremodule pybuiltins
171+
# Populate the pybuiltins module imported from API
172+
@eval pybuiltins begin
172173
$([:(const $k = $pynew()) for k in BUILTINS]...)
173174
end
174-
"""
175-
pybuiltins
176-
177-
An object whose fields are the Python builtins, of type [`Py`](@ref).
178-
179-
For example `pybuiltins.None`, `pybuiltins.int`, `pybuiltins.ValueError`.
180-
"""
181-
pybuiltins
182-
export pybuiltins
183175

184176
for k in BUILTINS
185177
if k == :help

0 commit comments

Comments
 (0)