gh-131798: Optimize _UNARY_NEGATIVE (GH-135223)

This commit is contained in:
Noam Cohen 2025-06-23 22:42:09 +03:00 committed by GitHub
parent 569fc6870f
commit bda121862e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 2 deletions

View file

@ -452,7 +452,13 @@ dummy_func(void) {
res = sym_new_compact_int(ctx);
}
else {
res = sym_new_not_null(ctx);
PyTypeObject *type = sym_get_type(value);
if (type == &PyLong_Type || type == &PyFloat_Type) {
res = sym_new_type(ctx, type);
}
else {
res = sym_new_not_null(ctx);
}
}
}