Skip to content

re.compile inference returns incorrect result #520

Description

@brycepg

Steps to reproduce

  1. Execute
import astroid
code = """
import re
_ENCODING_RGX = re.compile(r"f")
_ENCODING_RGX #@
"""
print(astroid.extract_node(code).inferred())

This is causing the Travis CI pylint env to fail with:

************* Module astroid.builder
E: 64,20: Instance of 'str' has no 'match' member (no-member)

Current behavior

The above prints [Uninferable, <Const.str l.3 at 0x79558a71e7f0>]

Expected behavior

Should return an Instance of _sre.SRE_Pattern

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

5d21b20

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions