Skip to content

Commit a0011fa

Browse files
committed
refine(Lib): use wrapExportSincePy if possible
add version for sys.audit,addaudithook
1 parent d040f7a commit a0011fa

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/pylib/Lib/inspect.nim

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,10 @@ template wrapPyStr1(fun; T){.dirty.} =
4040
4141
wrapPyStr1 getmodulename, PyStr
4242
43-
template markcoroutinefunction*(obj): untyped{.pysince(3,12).} =
44-
isX.markcoroutinefunction(obj)
43+
wrapExportSincePy(3,12, markcoroutinefunction)
4544
46-
template defPredSince(sym, maj, min){.dirty.} =
47-
template sym*(obj): bool{.pysince(maj, min).} =
48-
isX.sym(obj)
49-
50-
defPredSince iscoroutinefunction, 3,5
51-
defPredSince isawaitable, 3,5
45+
wrapExportSincePy(3,5, iscoroutinefunction)
46+
wrapExportSincePy(3,5, isawaitable)
5247
5348
# isasyncgenfunction 3.6
5449

src/pylib/Lib/string.nim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ else:
5555
genSubstitute(Mapping, PyStr, substitute, initRaisesExcHandle)
5656
genSubstitute(Mapping, PyStr, safe_substitute, initIgnoreExcHandle)
5757

58-
proc is_valid*(templ: Template): bool{.pysince(3,11).} =
59-
templateImpl.is_valid(templ)
58+
wrapExportSincePy(3,11, is_valid)
6059

6160
proc get_identifiers*(templ: Template): PyList[PyStr]{.pysince(3,11).} =
6261
result = newPyList[PyStr]()

src/pylib/Lib/sys.nim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88
import ../builtins/list
99
import ../noneType
1010
import ../pystring/strimpl
11+
import ../version as verionLib
1112

1213
import ./n_sys
13-
export n_sys except float_repr_style, platform, getencodings
14+
export n_sys except float_repr_style, platform, getencodings, addaudithook, audit
1415

1516
import ./sys_impl/[genplatform, geninfos, genargs]
17+
18+
wrapExportSincePy(3,8, addaudithook)
19+
wrapExportSincePy(3,8, audit)
20+
1621
const float_repr_style* = str(n_sys.float_repr_style)
1722
genPlatform(str)
1823
genInfos(str, None)

0 commit comments

Comments
 (0)