1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00

Use new standard function for generator function check.

This commit is contained in:
Jan Decaluwe 2009-04-26 18:10:37 +02:00
parent 9e416df6ff
commit e3cb33b029

View File

@ -1,7 +1,7 @@
# This file is part of the myhdl library, a Python package for using
# Python as a Hardware Description Language.
#
# Copyright (C) 2003-2008 Jan Decaluwe
# Copyright (C) 2003-2009 Jan Decaluwe
#
# The myhdl library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
@ -27,9 +27,6 @@ import sys
import inspect
import re
from types import FunctionType, GeneratorType, ListType, TupleType
import compiler
# hope this will always work ...
from compiler.consts import CO_GENERATOR
from tokenize import generate_tokens, untokenize, INDENT
from cStringIO import StringIO
@ -43,10 +40,7 @@ def _printExcInfo():
msg += ": %s" % value
print >> sys.stderr, msg
def _isGenFunc(obj):
if isinstance(obj, FunctionType):
return bool(obj.func_code.co_flags & CO_GENERATOR)
return bool(0)
_isGenFunc = inspect.isgeneratorfunction
def _flatten(*args):
arglist = []