pyobject 1.2.9.1__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyobject-1.2.9.1/pyobject.egg-info → pyobject-1.3.0}/PKG-INFO +10 -7
- {pyobject-1.2.9.1 → pyobject-1.3.0}/README.rst +9 -6
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/__init__.py +4 -4
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/examples/test_inject.py +3 -3
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/objproxy/__init__.py +238 -213
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/objproxy/builtin_hook.py +57 -25
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/objproxy/optimize.py +6 -5
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/objproxy/utils.py +1 -1
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/pyobj_extension.c +1 -1
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/tests/test_objproxy.py +22 -2
- pyobject-1.3.0/pyobject/tests/test_objproxy_perf.py +49 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0/pyobject.egg-info}/PKG-INFO +10 -7
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject.egg-info/SOURCES.txt +2 -2
- pyobject-1.2.9.1/pyobject/objproxy/dynobj.py +0 -190
- {pyobject-1.2.9.1 → pyobject-1.3.0}/LICENSE +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/MANIFEST.in +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/browser.py +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/code.py +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/examples/README.md +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/examples/__init__.py +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/examples/empty_cp37.pyc +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/examples/pyc_zipper_unpack.py +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/examples/pyc_zipper_zlib.py +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/back.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/codeobject.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/dict.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/empty_dict.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/empty_list.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/empty_tuple.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/forward.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/function.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/list.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/number.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/python.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/python.ico +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/refresh.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/string.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/images/tuple.gif +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/other/browser_chs_locale.py +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/search.py +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject/tests/test_code.py +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject.egg-info/dependency_links.txt +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject.egg-info/requires.txt +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/pyobject.egg-info/top_level.txt +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/setup.cfg +0 -0
- {pyobject-1.2.9.1 → pyobject-1.3.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyobject
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: A multifunctional all-in-one utility tool for managing internal Python objects, compatible with nearly all Python 3 versions. 一个多功能合一的提供操作Python对象底层工具的Python包, 支持几乎所有Python 3版本。
|
|
5
5
|
Home-page: https://github.com/qfcy/pyobject
|
|
6
6
|
Author: qfcy
|
|
@@ -351,7 +351,7 @@ Python内部的字节码对象\ ``CodeType``\ ,如\ ``func.__code__``\ ,是
|
|
|
351
351
|
unused_var = func(temp_var)
|
|
352
352
|
|
|
353
353
|
| 代码中\ ``temp_var``\ 只有一条指向\ ``unused_var``\ 的边,而\ ``unused_var``\ 没有任何指出的边。
|
|
354
|
-
| 将\ ``temp_var``\ 的值代入\ ``func(temp_var)``\
|
|
354
|
+
| 将\ ``temp_var``\ 的值代入\ ``func(temp_var)``\ 进行内联,得到\ ``unused_var = func([1,2,3])``\ ,再去掉\ ``unused_var``\ ,优化后的代码会变成\ ``func([1,2,3])``\ 。
|
|
355
355
|
|
|
356
356
|
模块\ ``pyobject.pyobj_extension``
|
|
357
357
|
----------------------------------
|
|
@@ -394,11 +394,12 @@ Python内部的字节码对象\ ``CodeType``\ ,如\ ``func.__code__``\ ,是
|
|
|
394
394
|
lst调用多次==运算符(``__eq__``)相比,
|
|
395
395
|
本函数直接比较对象的指针,提高了效率。
|
|
396
396
|
|
|
397
|
-
**``pyobject``\ 当前版本**: 1.
|
|
397
|
+
**``pyobject``\ 当前版本**: 1.3.0
|
|
398
398
|
|
|
399
399
|
更新日志:
|
|
400
400
|
---------
|
|
401
401
|
|
|
402
|
+
| 2025-6-6(v1.3.0):性能优化,提升了pyobject.objproxy模块的性能。
|
|
402
403
|
| 2025-4-30(v1.2.9):改进和增强了子模块pyobject.objproxy,重命名子模块pyobject.code_为pyobject.code。
|
|
403
404
|
| 2025-3-31(v1.2.8):将pyobject.super_proxy重命名为pyobject.objproxy,并正式发布;修改了pyobject.pyobj_extension模块。
|
|
404
405
|
| 2025-3-6(v1.2.7):为pyobject.browser新增了\ ``dir()``\ 中不存在的类属性(如\ ``__flags__``,
|
|
@@ -829,9 +830,9 @@ Implementation Details
|
|
|
829
830
|
|
|
830
831
|
| Here, ``temp_var`` only has one edge pointing to ``unused_var``, while
|
|
831
832
|
``unused_var`` does not point to any other node.
|
|
832
|
-
| By inlining the value of ``temp_var`` into ``func(temp_var)
|
|
833
|
-
|
|
834
|
-
``func([1, 2, 3])``.
|
|
833
|
+
| By inlining the value of ``temp_var`` into ``func(temp_var)``, the
|
|
834
|
+
code becomes ``unused_var = func([1,2,3])``. After removing
|
|
835
|
+
``unused_var``, the optimized code is ``func([1, 2, 3])``.
|
|
835
836
|
|
|
836
837
|
Module: ``pyobj_extension``
|
|
837
838
|
---------------------------
|
|
@@ -886,11 +887,13 @@ Python call “obj in lst” that invokes the “==” operator (``__eq__``)
|
|
|
886
887
|
multiple times, this function directly compares the pointers to improve
|
|
887
888
|
efficiency.
|
|
888
889
|
|
|
889
|
-
**Current Version of ``pyobject``**: 1.
|
|
890
|
+
**Current Version of ``pyobject``**: 1.3.0
|
|
890
891
|
|
|
891
892
|
Change Log
|
|
892
893
|
----------
|
|
893
894
|
|
|
895
|
+
| 2025-6-6(v1.3.0): Optimized the performance of the pyobject.objproxy
|
|
896
|
+
module.
|
|
894
897
|
| 2025-4-30(v1.2.9): Improved and enhanced the sub-module
|
|
895
898
|
``pyobject.objproxy``, and renamed the sub-module ``pyobject.code_``
|
|
896
899
|
to ``pyobject.code``.
|
|
@@ -334,7 +334,7 @@ Python内部的字节码对象\ ``CodeType``\ ,如\ ``func.__code__``\ ,是
|
|
|
334
334
|
unused_var = func(temp_var)
|
|
335
335
|
|
|
336
336
|
| 代码中\ ``temp_var``\ 只有一条指向\ ``unused_var``\ 的边,而\ ``unused_var``\ 没有任何指出的边。
|
|
337
|
-
| 将\ ``temp_var``\ 的值代入\ ``func(temp_var)``\
|
|
337
|
+
| 将\ ``temp_var``\ 的值代入\ ``func(temp_var)``\ 进行内联,得到\ ``unused_var = func([1,2,3])``\ ,再去掉\ ``unused_var``\ ,优化后的代码会变成\ ``func([1,2,3])``\ 。
|
|
338
338
|
|
|
339
339
|
模块\ ``pyobject.pyobj_extension``
|
|
340
340
|
----------------------------------
|
|
@@ -377,11 +377,12 @@ Python内部的字节码对象\ ``CodeType``\ ,如\ ``func.__code__``\ ,是
|
|
|
377
377
|
lst调用多次==运算符(``__eq__``)相比,
|
|
378
378
|
本函数直接比较对象的指针,提高了效率。
|
|
379
379
|
|
|
380
|
-
**``pyobject``\ 当前版本**: 1.
|
|
380
|
+
**``pyobject``\ 当前版本**: 1.3.0
|
|
381
381
|
|
|
382
382
|
更新日志:
|
|
383
383
|
---------
|
|
384
384
|
|
|
385
|
+
| 2025-6-6(v1.3.0):性能优化,提升了pyobject.objproxy模块的性能。
|
|
385
386
|
| 2025-4-30(v1.2.9):改进和增强了子模块pyobject.objproxy,重命名子模块pyobject.code_为pyobject.code。
|
|
386
387
|
| 2025-3-31(v1.2.8):将pyobject.super_proxy重命名为pyobject.objproxy,并正式发布;修改了pyobject.pyobj_extension模块。
|
|
387
388
|
| 2025-3-6(v1.2.7):为pyobject.browser新增了\ ``dir()``\ 中不存在的类属性(如\ ``__flags__``,
|
|
@@ -812,9 +813,9 @@ Implementation Details
|
|
|
812
813
|
|
|
813
814
|
| Here, ``temp_var`` only has one edge pointing to ``unused_var``, while
|
|
814
815
|
``unused_var`` does not point to any other node.
|
|
815
|
-
| By inlining the value of ``temp_var`` into ``func(temp_var)
|
|
816
|
-
|
|
817
|
-
``func([1, 2, 3])``.
|
|
816
|
+
| By inlining the value of ``temp_var`` into ``func(temp_var)``, the
|
|
817
|
+
code becomes ``unused_var = func([1,2,3])``. After removing
|
|
818
|
+
``unused_var``, the optimized code is ``func([1, 2, 3])``.
|
|
818
819
|
|
|
819
820
|
Module: ``pyobj_extension``
|
|
820
821
|
---------------------------
|
|
@@ -869,11 +870,13 @@ Python call “obj in lst” that invokes the “==” operator (``__eq__``)
|
|
|
869
870
|
multiple times, this function directly compares the pointers to improve
|
|
870
871
|
efficiency.
|
|
871
872
|
|
|
872
|
-
**Current Version of ``pyobject``**: 1.
|
|
873
|
+
**Current Version of ``pyobject``**: 1.3.0
|
|
873
874
|
|
|
874
875
|
Change Log
|
|
875
876
|
----------
|
|
876
877
|
|
|
878
|
+
| 2025-6-6(v1.3.0): Optimized the performance of the pyobject.objproxy
|
|
879
|
+
module.
|
|
877
880
|
| 2025-4-30(v1.2.9): Improved and enhanced the sub-module
|
|
878
881
|
``pyobject.objproxy``, and renamed the sub-module ``pyobject.code_``
|
|
879
882
|
to ``pyobject.code``.
|
|
@@ -6,7 +6,7 @@ import sys
|
|
|
6
6
|
from warnings import warn
|
|
7
7
|
from pprint import pprint
|
|
8
8
|
|
|
9
|
-
__version__="1.
|
|
9
|
+
__version__="1.3.0"
|
|
10
10
|
|
|
11
11
|
__all__=["objectname","bases","describe","desc"]
|
|
12
12
|
_ignore_names=["__builtins__","__doc__"]
|
|
@@ -97,10 +97,10 @@ try:
|
|
|
97
97
|
"set_type_subclasses_by_cls"])
|
|
98
98
|
except ImportError:warn("Failed to import pyobject.pyobj_extension.")
|
|
99
99
|
try:
|
|
100
|
-
from pyobject.objproxy import
|
|
101
|
-
__all__.extend(["
|
|
100
|
+
from pyobject.objproxy import ObjChain,ProxiedObj,unproxy_obj
|
|
101
|
+
__all__.extend(["ObjChain","ProxiedObj","unproxy_obj"])
|
|
102
102
|
except (ImportError, SyntaxError):
|
|
103
|
-
warn("Failed to import pyobject.objproxy.") #
|
|
103
|
+
warn("Failed to import pyobject.objproxy.") # Python 3.5及以下不支持f-string,无法使用objproxy库
|
|
104
104
|
|
|
105
105
|
def desc_demo():
|
|
106
106
|
try:
|
|
@@ -7,7 +7,7 @@ except ImportError:
|
|
|
7
7
|
from importlib._bootstrap import MAGIC_NUMBER
|
|
8
8
|
|
|
9
9
|
MARK=b"#####MyPython####"
|
|
10
|
-
TARGET='empty_cp37.pyc' #
|
|
10
|
+
TARGET='empty_cp37.pyc' # 需Python 3.7
|
|
11
11
|
|
|
12
12
|
def extract_file(filename):
|
|
13
13
|
# 将py,pyc文件还原为Code对象
|
|
@@ -121,10 +121,10 @@ def spread_to_mod(modname,use_pycache=True):
|
|
|
121
121
|
if use_pycache and file.endswith('.py') or file.endswith('.pyw'):
|
|
122
122
|
# 获取目标文件位置
|
|
123
123
|
splited=os.path.split(file)
|
|
124
|
-
os.makedirs(splited[0] + '
|
|
124
|
+
os.makedirs(splited[0] + '/__pycache__',exist_ok=True)
|
|
125
125
|
pyc=os.path.splitext(splited[1])[0] + \
|
|
126
126
|
'.cpython-%d%d' % (sys.version_info.major,sys.version_info.minor)
|
|
127
|
-
target=splited[0] + '
|
|
127
|
+
target=splited[0] + '/__pycache__/'+pyc+'.pyc'
|
|
128
128
|
else:target=None
|
|
129
129
|
co=spread(file,pycfile=target)
|
|
130
130
|
return co
|