From 5f00823b3c9964194c5cd24b2593cf057f925f6a Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 10 Apr 2024 14:53:03 +0800 Subject: [PATCH] bugfix --- ahserver/globalEnv.py | 80 ++++--------------------------------------- 1 file changed, 7 insertions(+), 73 deletions(-) diff --git a/ahserver/globalEnv.py b/ahserver/globalEnv.py index ddea887..1acbc3a 100755 --- a/ahserver/globalEnv.py +++ b/ahserver/globalEnv.py @@ -1,5 +1,6 @@ # -*- coding:utf8 -*- import os +import builtins import sys import codecs from urllib.parse import quote @@ -190,79 +191,12 @@ def initEnv(): g.current_fileno = current_fileno g.get_config_value = get_config_value g.get_definition = get_definition + set_builtins() def set_builtins(): - all_f="""abs -aiter -all -anext -any -ascii -bin -bool -breakpoint -bytearray -bytes -callable -chr -classmethod -compile -complex -delattr -dict -dir -divmod -enumerate -eval -exec -filter -float -format -frozenset -getattr -globals -hasattr -hash -help -hex -id -input -int -isinstance -issubclass -iter -len -list -locals -map -max -memoryview -min -next -object -oct -open -ord -pow -print -property -range -repr -reversed -round -set -setattr -slice -sorted -staticmethod -str -sum -super -tuple -type -vars -zip""" + all_builtins = [ i for i in dir(builtins) if not i.startswith('_')] g = ServerEnv() - for l in all_f.aplit('\n'): - if l != '': - g[l] = l + gg = globals() + for l in all_builtins: + exec(f'g["{l}"] = {l}',{'g':g}) + print(f'{g.sorted=}, {sorted=}, globalEnv.py')