FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Some C-API tests use `assert`, so they don't run in non-debug mode · Issue #95783 · python/cpython · GitHub

Repository navigation

Some C-API tests use assert, so they don't run in non-debug mode #95783

Closed

Description

The assert function in C does nothing in non-debug builds.

Like assert vs. self.assertTrue in Python, tests (in Modules/_testcapimodule.c, Modules/_testapi/* and similar) should not use assert. They should fail regardless of build settings.

Possible fixes for this kind of issue:

  • Raise PyExc_AssertionError or similar explicitly
  • Move the test to Python if possible (or just part of it, but splitting a test up between files has a readability cost)
  • Even Py_FatalError would be better than assert

Activity

  1. self-assigned this
    on Aug 8, 2022
  2. added a commit that references this issue on Aug 8, 2022
  3. encukou commented on Aug 8, 2022

    MemberAuthor

    Ah, _testcapimodule.c has #undef NDEBUG to enable assert. The parts that are being split out just need it too. I'll tie the fix to #93649 rather than this issue.

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

Metadata

Metadata

Assignees

Labels

testsTests in the Lib/test dirtopic-C-APItype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL