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

Python 3.13 support #1173

Open
gnuletik opened this issue Oct 11, 2024 · 2 comments
Open

Python 3.13 support #1173

gnuletik opened this issue Oct 11, 2024 · 2 comments
Labels
Bug Reports and/or fixes a bug Python Python language support

Comments

@gnuletik
Copy link

When using Python 3.13, following exception is raised:

Traceback (most recent call last):
  File "/Users/gnuletik/Library/Caches/pypoetry/virtualenvs/myapp-sb5BZtsM-py3.13/lib/python3.13/site-packages/protoc_gen_validate/validator.py", line 219, in _validate_all_inner
    return generate_validate_all
           ^^^^^^^^^^^^^^^^^^^^^
NameError: name 'generate_validate_all' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/gnuletik/Library/Caches/pypoetry/virtualenvs/myapp-sb5BZtsM-py3.13/lib/python3.13/site-packages/mylib/run.py", line 46, in run
    exit_code = run_exit(
        handler,
    ...<3 lines>...
        logger,
    )
  File "/Users/gnuletik/Library/Caches/pypoetry/virtualenvs/myapp-sb5BZtsM-py3.13/lib/python3.13/site-packages/mylib/run.py", line 108, in run_exit
    validate_all(init_resp)
    ~~~~~~~~~~~~^^^^^^^^^^^
  File "/Users/gnuletik/Library/Caches/pypoetry/virtualenvs/myapp-sb5BZtsM-py3.13/lib/python3.13/site-packages/protoc_gen_validate/validator.py", line 230, in validate_all
    err = _validate_all(proto_message)
  File "/Users/gnuletik/Library/Caches/pypoetry/virtualenvs/myapp-sb5BZtsM-py3.13/lib/python3.13/site-packages/protoc_gen_validate/validator.py", line 225, in _validate_all
    return _validate_all_inner(ValidatingMessage(proto_message))(proto_message)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gnuletik/Library/Caches/pypoetry/virtualenvs/myapp-sb5BZtsM-py3.13/lib/python3.13/site-packages/protoc_gen_validate/validator.py", line 221, in _validate_all_inner
    return locals()['generate_validate_all']
           ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'generate_validate_all'
@edgarrmondragon
Copy link

Similarly running into

    @lru_cache()
    def _validate_inner(proto_message: Message):
        func = file_template(proto_message)
        global printer
        printer += func + "\n"
        exec(func)
        try:
            return generate_validate
        except NameError:
>           return locals()['generate_validate']
E           KeyError: 'generate_validate'

@stefanvanburen
Copy link
Member

I imagine this is related: https://docs.python.org/3/whatsnew/3.13.html#pep667-porting-notes-py

@rodaine rodaine added Bug Reports and/or fixes a bug Python Python language support labels Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reports and/or fixes a bug Python Python language support
Projects
None yet
Development

No branches or pull requests

4 participants