Mailing List Archive

python/dist/src/Lib/compiler pycodegen.py,1.58.4.2,1.58.4.2.2.1 symbols.py,1.10.8.1,1.10.8.1.2.1
Update of /cvsroot/python/python/dist/src/Lib/compiler
In directory usw-pr-cvs1:/tmp/cvs-serv24937

Modified Files:
Tag: release22-maint
pycodegen.py symbols.py
Log Message:
A couple of fixes for the compiler package:
* always write the mtime to a .pyc in little endian format
* ensure class's docstrings get attached to the class, not the
enclosing scope!

Rather more fixes are needed for the trunk; these will be done in due
course.



Index: pycodegen.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/pycodegen.py,v
retrieving revision 1.58.4.2
retrieving revision 1.58.4.2.2.1
diff -C2 -d -r1.58.4.2 -r1.58.4.2.2.1
*** pycodegen.py 21 Dec 2001 16:11:33 -0000 1.58.4.2
--- pycodegen.py 7 Oct 2002 12:21:09 -0000 1.58.4.2.2.1
***************
*** 137,141 ****
# same effect is to call marshal and then skip the code.
mtime = os.stat(self.filename)[stat.ST_MTIME]
! mtime = struct.pack('i', mtime)
return self.MAGIC + mtime

--- 137,141 ----
# same effect is to call marshal and then skip the code.
mtime = os.stat(self.filename)[stat.ST_MTIME]
! mtime = struct.pack('<i', mtime)
return self.MAGIC + mtime

***************
*** 390,396 ****
gen = self.ClassGen(node, self.scopes,
self.get_module())
- if node.doc:
- self.emit('LOAD_CONST', node.doc)
- self.storeName('__doc__')
walk(node.code, gen)
gen.finish()
--- 390,393 ----
***************
*** 1307,1310 ****
--- 1304,1311 ----
self.graph.setFreeVars(self.scope.get_free_vars())
self.graph.setCellVars(self.scope.get_cell_vars())
+ self.set_lineno(klass)
+ if klass.doc:
+ self.emit("LOAD_CONST", klass.doc)
+ self.storeName("__doc__")

def generateArgList(arglist):

Index: symbols.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/symbols.py,v
retrieving revision 1.10.8.1
retrieving revision 1.10.8.1.2.1
diff -C2 -d -r1.10.8.1 -r1.10.8.1.2.1
*** symbols.py 21 Dec 2001 14:41:02 -0000 1.10.8.1
--- symbols.py 7 Oct 2002 12:21:09 -0000 1.10.8.1.2.1
***************
*** 250,253 ****
--- 250,255 ----
if parent.nested or isinstance(parent, FunctionScope):
scope.nested = 1
+ if node.doc is not None:
+ scope.add_def('__doc__')
self.scopes[node] = scope
prev = self.klass