Todo: 集成多平台 解决因SaiNiu线程抢占资源问题 本地提交测试环境打包 和 正式打包脚本与正式环境打包bat 提交Python32环境包 改进多日志文件生成情况修改打包日志细节
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
|
||||
# The cycle GC collector can be executed when any GC-tracked object is
|
||||
# allocated, e.g. during a call to PyList_New(), PyDict_New(), ...
|
||||
# Moreover, it can invoke arbitrary Python code via a weakref callback.
|
||||
# This means that there are many places in the source where an arbitrary
|
||||
# mutation could unexpectedly occur.
|
||||
|
||||
# The example below shows list_slice() not expecting the call to
|
||||
# PyList_New to mutate the input list. (Of course there are many
|
||||
# more examples like this one.)
|
||||
|
||||
|
||||
import weakref
|
||||
|
||||
class A(object):
|
||||
pass
|
||||
|
||||
def callback(x):
|
||||
del lst[:]
|
||||
|
||||
|
||||
keepalive = []
|
||||
|
||||
for i in range(100):
|
||||
lst = [str(i)]
|
||||
a = A()
|
||||
a.cycle = a
|
||||
keepalive.append(weakref.ref(a, callback))
|
||||
del a
|
||||
while lst:
|
||||
keepalive.append(lst[:])
|
||||
Reference in New Issue
Block a user