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

The binary files produced by compiling python twice are different #93317

Closed
zhuofeng6 opened this issue May 28, 2022 · 2 comments
Closed

The binary files produced by compiling python twice are different #93317

zhuofeng6 opened this issue May 28, 2022 · 2 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@zhuofeng6
Copy link

hi, man, i find a problem, that the binary files produced by compiling python twice are different. I was confused for a long time. The different pyc files are the following.

image

i find different places are DA and FA with Beyond Compare.

image
configparser.cpython-39.pyc

image
argparse.cpython-39.pyc

then, i see this is string instern after i study the source code of cpython, These strings are ”{“ ”{{“ ”}“ ”}“

static int
maybe_init_static_strings(void)
{
    if (!_str_open_br &&
        !(_str_open_br = PyUnicode_InternFromString("{"))) {
        return -1;
    }
    if (!_str_dbl_open_br &&
        !(_str_dbl_open_br = PyUnicode_InternFromString("{{"))) {
        return -1;
    }
    if (!_str_close_br &&
        !(_str_close_br = PyUnicode_InternFromString("}"))) {
        return -1;
    }
    if (!_str_dbl_close_br &&
        !(_str_dbl_close_br = PyUnicode_InternFromString("}}"))) {
        return -1;
    }
    if (!_str_inf &&
        !(_str_inf = PyUnicode_FromString("inf"))) {
        return -1;
    }
    if (!_str_replace_inf &&
        !(_str_replace_inf = PyUnicode_FromFormat("1e%d", 1 + DBL_MAX_10_EXP))) {
        return -1;
    }
    return 0;
}

python >3.8 compile with multithreading, so there may be different by compiling python twice. and if i add code here, it is OK! This is just my temporary plan, but i don't think this is a good idea, and i hope you could fix it

image

@zhuofeng6 zhuofeng6 added the type-bug An unexpected behavior, bug, or error label May 28, 2022
@JelleZijlstra
Copy link
Member

#73894 is the general issue about this.

@ericvsmith
Copy link
Member

Closing on favor of #73894.

@erlend-aasland erlend-aasland closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants