Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression : ValueError: Invalid co_name '_results_bag' for created function on python 2 #91

Closed
smarie opened this issue Feb 23, 2023 · 1 comment · Fixed by #92
Closed

Comments

@smarie
Copy link
Owner

smarie commented Feb 23, 2023

@smarie
Copy link
Owner Author

smarie commented Feb 23, 2023

The problem is that the is_identifier function proposed is too restrictive:

def is_identifier(string):
    """
    Replacement for `str.isidentifier` when it is not available (e.g. on Python 2).
    :param string:
    :return:
    """
    if len(string) == 0 or string[0].isdigit():
        return False
    return all([s.isalnum() for s in string.split("_")])

# problem with double underscores or leading underscores
is_identifier("_hello")  # False
is_identifier("hell__o")  # False

smarie pushed a commit that referenced this issue Feb 23, 2023
…me of a function to create starts or ends with

   `_` or contains a double `__` . Fixes #91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant