mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Flush out support for `class B(): pass
` syntax by adding support to the
'parser' module and 'compiler' package. Closes patch #1176012. Thanks logistix.
This commit is contained in:
parent
4ebc7e3bd0
commit
f4189916e3
5 changed files with 27 additions and 8 deletions
|
@ -280,12 +280,14 @@ class Transformer:
|
|||
return Lambda(names, defaults, flags, code, lineno=nodelist[1][2])
|
||||
|
||||
def classdef(self, nodelist):
|
||||
# classdef: 'class' NAME ['(' testlist ')'] ':' suite
|
||||
# classdef: 'class' NAME ['(' [testlist] ')'] ':' suite
|
||||
|
||||
name = nodelist[1][1]
|
||||
doc = self.get_docstring(nodelist[-1])
|
||||
if nodelist[2][0] == token.COLON:
|
||||
bases = []
|
||||
elif nodelist[3][0] == token.RPAR:
|
||||
bases = []
|
||||
else:
|
||||
bases = self.com_bases(nodelist[3])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue