From e3cb33b0294a9e63407ead93d59acd59d11fe731 Mon Sep 17 00:00:00 2001 From: Jan Decaluwe Date: Sun, 26 Apr 2009 18:10:37 +0200 Subject: [PATCH] Use new standard function for generator function check. --- myhdl/_util.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/myhdl/_util.py b/myhdl/_util.py index 42a7c26b..fa4bca9c 100644 --- a/myhdl/_util.py +++ b/myhdl/_util.py @@ -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 = []