Python

共28篇文章。

终于抓住了py-ldap中的内存泄漏!!

Development

之前曾经误认为Python中存在内存泄漏,不过最终证明还是C程序的问题。Py-LDAP2这个模块在某些情况下,会泄漏一个空的List,具体泄漏代码如下:

retval = Py_BuildValue("(OOiO)", result_str, pmsg, res_msgid, pyctrls ? pyctrls : PyList_New(0));

当pyctrls == NULL时,Py_BuildValue()会为PyList_New(0)生成的那个对象再增加一个引用,这样会导致泄漏。这一问题会发生于调用result()而all=0的情形。

阅读全文…:终于抓住了py-ldap中的内存泄漏!!(本文约210字,阅读大致需要1分钟)

Bug in Python re implementation?

Development

Python includes a Regular Expression implementation, called re. However, I thought that I have hit a bug.

The following regular expression is apparantly wrong, but Python spend much CPU time to give a mismatch:

_mailcheck = re.compile("^(\w|.){3,25}$")
_mailcheck.match("foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo")

I think the “.” would override anything (including “\w”), but this does not happen…

参与评论:Bug in Python re implementation?

How to enable Python2.4 for WinCVS?

Development

Because sometimes I use Windows for daily desktop (the company’s IM system can’t run on FreeBSD and that’s the only reason why I can’t use FreeBSD as desktop at company) I have adopted WinCVS as development tool.

Unfortunatelly, when I have started WinCVS, it complained that it can’t find python (the version I have installed is 2.4). After searching the disk I figured out that the file exists in windows/system32/, not python24/dll. Corrected this setting and WinCVS appears to work correctly.

阅读全文…:How to enable Python2.4 for WinCVS?(本文约98字,阅读大致需要1分钟)

关于OpenSource

Development

很多时候我告诫自己不要去想关于OpenSource模式的问题,不过最近还是琢磨了琢磨。很久以前一个前辈跟我讨论过这个问题:

「盈利模式是一个很大的问题。现在Linux的发展模式意味着许多真正核心的开发人员并不能从中获益,这意味着一旦他们开始为生计担忧,项目很可能就会停滞不前;在国外通常会有公司雇用这些开发人员,让他们能够将项目进行下去,但在国内这种情况还非常少。」

阅读全文…:关于OpenSource(本文约276字,阅读大致需要1分钟)
搜索文章…(按ESC退出)