Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv18396 Modified Files: compile.c Log Message: A tentative fix for SF bug #503837 (Roeland Rengelink): type.__module__ problems (again?) This simply initializes the __module__ local in a class statement from the __name__ global. I'm not 100% sure that this is the correct fix, although it usually does the right thing. The problem is that if the class statement executes in a custom namespace, the __name__ global may be taken from __builtins__, in which case it would have the value __builtin__, or it may not exist at all (if the custom namespace also has a custom __builtins__), in which case the class statement will fail. Nevertheless, unless someone finds a better solution, this is a 2.2.1 bugfix too. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.235 retrieving revision 2.236 diff -C2 -d -r2.235 -r2.236 *** compile.c 2002/01/01 19:59:11 2.235 --- compile.c 2002/01/15 21:06:07 2.236 *************** *** 3927,3930 **** --- 3927,3933 ---- c->c_name = STR(CHILD(n, 1)); c->c_private = c->c_name; + /* Initialize local __module__ from global __name__ */ + com_addop_name(c, LOAD_GLOBAL, "__name__"); + com_addop_name(c, STORE_NAME, "__module__"); ch = CHILD(n, NCH(n)-1); /* The suite */ doc = get_docstring(c, ch);
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4