Skip to content

Commit 6cafbf1

Browse files
committed
use CAN_NULL for 3.11a7 and above
1 parent dc34710 commit 6cafbf1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dill/detect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,14 @@ def nestedglobals(func, recurse=True):
175175
if func is None: return list()
176176
import sys
177177
from .temp import capture
178-
IS_311a7 = sys.hexversion == 51052711 #FIXME: for odd behavior in 3.11a7
178+
CAN_NULL = sys.hexversion >= 51052711 #NULL may be prepended >= 3.11a7
179179
names = set()
180180
with capture('stdout') as out:
181181
dis.dis(func) #XXX: dis.dis(None) disassembles last traceback
182182
for line in out.getvalue().splitlines():
183183
if '_GLOBAL' in line:
184184
name = line.split('(')[-1].split(')')[0]
185-
if IS_311a7:
185+
if CAN_NULL:
186186
names.add(name.replace('NULL + ', ''))
187187
else:
188188
names.add(name)

0 commit comments

Comments
 (0)