Skip to content

Conversation

tomasr8
Copy link
Member

@tomasr8 tomasr8 commented May 11, 2025

  • Simplify patterns such as
if (sym_is_const(ctx, flag)) {
  PyObject *value = sym_get_const(ctx, flag);
  // use value
}

into

PyObject *value = sym_get_const(ctx, flag);
if (value) {
  // use value
}
  • Remove sym_is_const and sym_has_type. They can be replaced by sym_get_const and sym_get_type respectively. This part is more of an exploration, these functions might still be useful in some situations. If we do decide to keep them, we can still simplify them quite a bit.

Check out the issue for more context!

@Fidget-Spinner
Copy link
Member

LGTM. But let's wait for #132733 to merge, then your diff can be smaller as half of the manual constants will be gone :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants