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

Re-opening #8255: hexadecimal default arguments are changed to decimal #9781

Closed
mara004 opened this issue Oct 26, 2021 · 3 comments
Closed

Comments

@mara004
Copy link

mara004 commented Oct 26, 2021

Describe the bug

I am experiencing the exact same problem as described in #8255: hexadecimal default arguments are changed to decimal.

How to Reproduce

Autodoc the following function:

def some_function(
        param_a,
        param_b,
        *,  # enforce keyword arguments from this point onwards
        background_colour: int = 0xFFFFFFFF,
        # ... other optional parameters
    ):
    pass

HTML result looks like this

background_colour: int = 4294967295

Expected behavior

Hexadecimal defaults should not be converted to decimal, or at least there should be an option to enforce this behaviour.

Your project

I'm afraid this is private

Screenshots

No response

OS

Linux Ubuntu 20.04

Python version

3.8.10

Sphinx version

4.2.0

Sphinx extensions

autodoc, intersphinx, napoleon

Extra tools

Chromium 94

Additional context

No response

@tk0miya
Copy link
Member

tk0miya commented Oct 27, 2021

@mara004
Copy link
Author

mara004 commented Oct 27, 2021

I had already added

autodoc_preserve_defaults = True

to my conf.py file but it didn't change the output. So no, it doesn't help.

tk0miya added a commit to tk0miya/sphinx that referenced this issue Oct 30, 2021
@tk0miya tk0miya added this to the 4.3.0 milestone Oct 30, 2021
tk0miya added a commit to tk0miya/sphinx that referenced this issue Oct 30, 2021
tk0miya added a commit that referenced this issue Oct 31, 2021
Fix #9781: autodoc_preserve_defaults does not support hexadecimal
@mara004
Copy link
Author

mara004 commented Oct 31, 2021

Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants